diff --git a/crates/rbuilder/src/roothash/prefetcher.rs b/crates/rbuilder/src/roothash/prefetcher.rs index 5190810b..b878242c 100644 --- a/crates/rbuilder/src/roothash/prefetcher.rs +++ b/crates/rbuilder/src/roothash/prefetcher.rs @@ -1,5 +1,4 @@ use std::{iter, time::Instant}; - use ahash::{HashMap, HashSet}; use alloy_primitives::{Address, B256}; use eth_sparse_mpt::{ @@ -16,7 +15,8 @@ use tokio_util::sync::CancellationToken; use tracing::{error, trace, warn}; use crate::{ - building::evm_inspector::SlotKey, live_builder::simulation::SimulatedOrderCommand, + building::evm_inspector::SlotKey, + live_builder::simulation::SimulatedOrderCommand, primitives::SimulatedOrder, }; @@ -109,14 +109,16 @@ pub fn run_trie_prefetcher( .zip(iter::repeat(true)), ); - for (address, destroyed) in changed_accounts_iter { - if fetched_accounts.contains(address) { + for (chain_address, destroyed) in changed_accounts_iter { + // Extract the inner Address from ChainAddress + let address = chain_address.1; + if fetched_accounts.contains(&address) { continue; } - fetched_accounts.insert(*address); + fetched_accounts.insert(address); fetch_request - .entry(*address) - .or_insert_with(|| ChangedAccountData::new(*address, destroyed)); + .entry(address) + .or_insert_with(|| ChangedAccountData::new(address, destroyed)); } for (written_slot, value) in &used_state_trace.written_slot_values { @@ -124,9 +126,12 @@ pub fn run_trie_prefetcher( continue; } fetched_slots.insert(written_slot.clone()); + + // Extract the inner Address from ChainAddress in the slot + let address = written_slot.address.1; let account_request = fetch_request - .entry(written_slot.address) - .or_insert_with(|| ChangedAccountData::new(written_slot.address, false)); + .entry(address) + .or_insert_with(|| ChangedAccountData::new(address, false)); account_request .slots .push((written_slot.key, value.is_zero())); @@ -159,4 +164,4 @@ pub fn run_trie_prefetcher( "Prefetched trie nodes" ); } -} +} \ No newline at end of file