Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions crates/evm/src/block/state_changes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use alloc::boxed::Box;
use alloy_consensus::BlockHeader;
use alloy_eips::eip4895::{Withdrawal, Withdrawals};
use alloy_hardforks::EthereumHardforks;
use alloy_primitives::{map::HashMap, Address};
use alloy_primitives::{map::AddressMap, Address};
use revm::{
context::Block,
state::{Account, AccountStatus, EvmState},
Expand All @@ -22,11 +22,11 @@ pub fn post_block_balance_increments<H>(
block_env: impl Block,
ommers: &[H],
withdrawals: Option<&Withdrawals>,
) -> HashMap<Address, u128>
) -> AddressMap<u128>
where
H: BlockHeader,
{
let mut balance_increments = HashMap::with_capacity_and_hasher(
let mut balance_increments = AddressMap::with_capacity_and_hasher(
withdrawals.map_or(ommers.len(), |w| w.len()),
Default::default(),
);
Expand Down Expand Up @@ -69,9 +69,9 @@ pub fn post_block_withdrawals_balance_increments(
spec: impl EthereumHardforks,
block_timestamp: u64,
withdrawals: &[Withdrawal],
) -> HashMap<Address, u128> {
) -> AddressMap<u128> {
let mut balance_increments =
HashMap::with_capacity_and_hasher(withdrawals.len(), Default::default());
AddressMap::with_capacity_and_hasher(withdrawals.len(), Default::default());
insert_post_block_withdrawals_balance_increments(
spec,
block_timestamp,
Expand All @@ -90,7 +90,7 @@ pub fn insert_post_block_withdrawals_balance_increments(
spec: impl EthereumHardforks,
block_timestamp: u64,
withdrawals: Option<&[Withdrawal]>,
balance_increments: &mut HashMap<Address, u128>,
balance_increments: &mut AddressMap<u128>,
) {
// Process withdrawals
if spec.is_shanghai_active_at_timestamp(block_timestamp) {
Expand All @@ -109,7 +109,7 @@ pub fn insert_post_block_withdrawals_balance_increments(
/// to load accounts from. No balance increment is done in the function.
/// Zero balance increments are ignored and won't create state entries.
pub fn balance_increment_state<DB>(
balance_increments: &HashMap<Address, u128>,
balance_increments: &AddressMap<u128>,
state: &mut DB,
) -> Result<EvmState, BlockExecutionError>
where
Expand Down
8 changes: 4 additions & 4 deletions crates/evm/src/precompiles.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use crate::{Database, EvmInternals};
use alloc::{borrow::Cow, boxed::Box, string::String, sync::Arc};
use alloy_consensus::transaction::Either;
use alloy_primitives::{
map::{HashMap, HashSet},
map::{AddressMap, AddressSet},
Address, Bytes, U256,
};
use core::fmt::Debug;
Expand Down Expand Up @@ -90,7 +90,7 @@ impl PrecompilesMap {
// apply the transformation to each precompile
let entries = dyn_precompiles.inner.drain();
let mut new_map =
HashMap::with_capacity_and_hasher(entries.size_hint().0, Default::default());
AddressMap::with_capacity_and_hasher(entries.size_hint().0, Default::default());
for (addr, precompile) in entries {
if filter(&addr, &precompile) {
let transformed = f(&addr, precompile);
Expand Down Expand Up @@ -562,9 +562,9 @@ impl core::fmt::Debug for DynPrecompile {
#[derive(Clone, Default)]
pub struct DynPrecompiles {
/// Precompiles
inner: HashMap<Address, DynPrecompile>,
inner: AddressMap<DynPrecompile>,
/// Addresses of precompile
addresses: HashSet<Address>,
addresses: AddressSet,
}

impl DynPrecompiles {
Expand Down