Skip to content

Commit

Permalink
fix address
Browse files Browse the repository at this point in the history
  • Loading branch information
Keszey Dániel authored and Keszey Dániel committed Nov 8, 2024
1 parent a775147 commit 68d980b
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions crates/rbuilder/src/roothash/prefetcher.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use std::{iter, time::Instant};

use ahash::{HashMap, HashSet};
use alloy_primitives::{Address, B256};
use eth_sparse_mpt::{
Expand All @@ -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,
};

Expand Down Expand Up @@ -109,24 +109,29 @@ pub fn run_trie_prefetcher<P, DB>(
.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 {
if fetched_slots.contains(written_slot) {
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()));
Expand Down Expand Up @@ -159,4 +164,4 @@ pub fn run_trie_prefetcher<P, DB>(
"Prefetched trie nodes"
);
}
}
}

0 comments on commit 68d980b

Please sign in to comment.