chore: use shorter map names (#14445)

This commit is contained in:
DaniPopes
2025-02-12 12:59:42 +01:00
committed by GitHub
parent 9090125f0d
commit fc7a3e5bc6
30 changed files with 90 additions and 108 deletions

View File

@ -1,7 +1,7 @@
use crate::{
AccountReader, BlockHashReader, ExecutionDataProvider, StateProvider, StateRootProvider,
};
use alloy_primitives::{map::B256HashMap, Address, BlockNumber, Bytes, B256};
use alloy_primitives::{map::B256Map, Address, BlockNumber, Bytes, B256};
use reth_primitives::{Account, Bytecode};
use reth_storage_api::{HashedPostStateProvider, StateProofProvider, StorageRootProvider};
use reth_storage_errors::provider::ProviderResult;
@ -177,7 +177,7 @@ impl<SP: StateProvider, EDP: ExecutionDataProvider> StateProofProvider
&self,
mut input: TrieInput,
target: HashedPostState,
) -> ProviderResult<B256HashMap<Bytes>> {
) -> ProviderResult<B256Map<Bytes>> {
let bundle_state = self.block_execution_data_provider.execution_outcome().state();
input.prepend(self.hashed_post_state(bundle_state));
self.state_provider.witness(input, target)

View File

@ -23,7 +23,7 @@ use alloy_consensus::{transaction::TransactionMeta, BlockHeader, Header, TxRecei
use alloy_eips::{eip2718::Encodable2718, eip4895::Withdrawals, BlockHashOrNumber};
use alloy_primitives::{
keccak256,
map::{hash_map, B256HashMap, HashMap, HashSet},
map::{hash_map, B256Map, HashMap, HashSet},
Address, BlockHash, BlockNumber, TxHash, TxNumber, B256, U256,
};
use itertools::Itertools;
@ -291,7 +291,7 @@ impl<TX: DbTx + DbTxMut + 'static, N: NodeTypesForProvider> DatabaseProvider<TX,
// Unwind storage hashes. Add changed account and storage keys to corresponding prefix
// sets.
let mut storage_prefix_sets = B256HashMap::<PrefixSet>::default();
let mut storage_prefix_sets = B256Map::<PrefixSet>::default();
let storage_entries = self.unwind_storage_hashing(changed_storages.iter().copied())?;
for (hashed_address, hashed_slots) in storage_entries {
account_prefix_set.insert(Nibbles::unpack(hashed_address));
@ -2351,7 +2351,7 @@ impl<TX: DbTxMut + DbTx + 'static, N: NodeTypes> StorageTrieWriter for DatabaseP
/// updates by the hashed address, writing in sorted order.
fn write_storage_trie_updates(
&self,
storage_tries: &B256HashMap<StorageTrieUpdates>,
storage_tries: &B256Map<StorageTrieUpdates>,
) -> ProviderResult<usize> {
let mut num_entries = 0;
let mut storage_tries = Vec::from_iter(storage_tries);

View File

@ -3,9 +3,7 @@ use crate::{
HashedPostStateProvider, ProviderError, StateProvider, StateRootProvider,
};
use alloy_eips::merge::EPOCH_SLOTS;
use alloy_primitives::{
map::B256HashMap, Address, BlockNumber, Bytes, StorageKey, StorageValue, B256,
};
use alloy_primitives::{map::B256Map, Address, BlockNumber, Bytes, StorageKey, StorageValue, B256};
use reth_db::{tables, BlockNumberList};
use reth_db_api::{
cursor::{DbCursorRO, DbDupCursorRO},
@ -388,7 +386,7 @@ impl<Provider: DBProvider + BlockNumReader + StateCommitmentProvider> StateProof
&self,
mut input: TrieInput,
target: HashedPostState,
) -> ProviderResult<B256HashMap<Bytes>> {
) -> ProviderResult<B256Map<Bytes>> {
input.prepend(self.revert_state()?);
TrieWitness::overlay_witness(self.tx(), input, target).map_err(ProviderError::from)
}

View File

@ -2,9 +2,7 @@ use crate::{
providers::state::macros::delegate_provider_impls, AccountReader, BlockHashReader,
HashedPostStateProvider, StateProvider, StateRootProvider,
};
use alloy_primitives::{
map::B256HashMap, Address, BlockNumber, Bytes, StorageKey, StorageValue, B256,
};
use alloy_primitives::{map::B256Map, Address, BlockNumber, Bytes, StorageKey, StorageValue, B256};
use reth_db::tables;
use reth_db_api::{cursor::DbDupCursorRO, transaction::DbTx};
use reth_primitives::{Account, Bytecode};
@ -146,11 +144,7 @@ impl<Provider: DBProvider + StateCommitmentProvider> StateProofProvider
Proof::overlay_multiproof(self.tx(), input, targets).map_err(ProviderError::from)
}
fn witness(
&self,
input: TrieInput,
target: HashedPostState,
) -> ProviderResult<B256HashMap<Bytes>> {
fn witness(&self, input: TrieInput, target: HashedPostState) -> ProviderResult<B256Map<Bytes>> {
TrieWitness::overlay_witness(self.tx(), input, target).map_err(ProviderError::from)
}
}

View File

@ -55,7 +55,7 @@ macro_rules! delegate_provider_impls {
StateProofProvider $(where [$($generics)*])? {
fn proof(&self, input: reth_trie::TrieInput, address: alloy_primitives::Address, slots: &[alloy_primitives::B256]) -> reth_storage_errors::provider::ProviderResult<reth_trie::AccountProof>;
fn multiproof(&self, input: reth_trie::TrieInput, targets: reth_trie::MultiProofTargets) -> reth_storage_errors::provider::ProviderResult<reth_trie::MultiProof>;
fn witness(&self, input: reth_trie::TrieInput, target: reth_trie::HashedPostState) -> reth_storage_errors::provider::ProviderResult<alloy_primitives::map::B256HashMap<alloy_primitives::Bytes>>;
fn witness(&self, input: reth_trie::TrieInput, target: reth_trie::HashedPostState) -> reth_storage_errors::provider::ProviderResult<alloy_primitives::map::B256Map<alloy_primitives::Bytes>>;
}
HashedPostStateProvider $(where [$($generics)*])? {
fn hashed_post_state(&self, bundle_state: &revm::db::BundleState) -> reth_trie::HashedPostState;

View File

@ -11,7 +11,7 @@ use alloy_consensus::{
use alloy_eips::{eip4895::Withdrawals, BlockHashOrNumber, BlockId, BlockNumberOrTag};
use alloy_primitives::{
keccak256,
map::{B256HashMap, HashMap},
map::{B256Map, HashMap},
Address, BlockHash, BlockNumber, Bytes, StorageKey, StorageValue, TxHash, TxNumber, B256, U256,
};
use parking_lot::Mutex;
@ -724,7 +724,7 @@ impl<T: Transaction, ChainSpec: EthChainSpec> StateProofProvider for MockEthProv
&self,
_input: TrieInput,
_target: HashedPostState,
) -> ProviderResult<B256HashMap<Bytes>> {
) -> ProviderResult<B256Map<Bytes>> {
Ok(HashMap::default())
}
}