perf: trie micro optimizations (#13282)

This commit is contained in:
DaniPopes
2024-12-11 05:52:42 +01:00
committed by GitHub
parent 0144a433df
commit 0494ca01d5
37 changed files with 306 additions and 246 deletions

View File

@ -253,7 +253,7 @@ mod tests {
fn test_rpc_gas_cap() {
let args = CommandParser::<RpcServerArgs>::parse_from(["reth"]).args;
let config = args.eth_config();
assert_eq!(config.rpc_gas_cap, Into::<u64>::into(RPC_DEFAULT_GAS_CAP));
assert_eq!(config.rpc_gas_cap, u64::from(RPC_DEFAULT_GAS_CAP));
let args =
CommandParser::<RpcServerArgs>::parse_from(["reth", "--rpc.gascap", "1000"]).args;

View File

@ -2,14 +2,11 @@
//! <https://github.com/rust-lang/rust/issues/100013> in default implementation of
//! `reth_rpc_eth_api::helpers::Call`.
use alloy_primitives::{
map::{HashMap, HashSet},
Address, B256, U256,
};
use alloy_primitives::{Address, B256, U256};
use reth_errors::ProviderResult;
use reth_revm::{database::StateProviderDatabase, db::CacheDB, DatabaseRef};
use reth_storage_api::{HashedPostStateProvider, StateProvider};
use reth_trie::HashedStorage;
use reth_trie::{HashedStorage, MultiProofTargets};
use revm::Database;
/// Helper alias type for the state's [`CacheDB`]
@ -91,7 +88,7 @@ impl reth_storage_api::StateProofProvider for StateProviderTraitObjWrapper<'_> {
fn multiproof(
&self,
input: reth_trie::TrieInput,
targets: HashMap<B256, HashSet<B256>>,
targets: MultiProofTargets,
) -> ProviderResult<reth_trie::MultiProof> {
self.0.multiproof(input, targets)
}
@ -100,7 +97,7 @@ impl reth_storage_api::StateProofProvider for StateProviderTraitObjWrapper<'_> {
&self,
input: reth_trie::TrieInput,
target: reth_trie::HashedPostState,
) -> reth_errors::ProviderResult<alloy_primitives::map::HashMap<B256, alloy_primitives::Bytes>>
) -> reth_errors::ProviderResult<alloy_primitives::map::B256HashMap<alloy_primitives::Bytes>>
{
self.0.witness(input, target)
}