From cd164dc9023879b755df1f9afe5248aebc0d14ac Mon Sep 17 00:00:00 2001 From: Alexey Shekhirin <5773434+shekhirin@users.noreply.github.com> Date: Tue, 23 Dec 2025 17:32:04 +0000 Subject: [PATCH] nits --- crates/engine/tree/src/tree/cached_state.rs | 31 ++++----------------- 1 file changed, 6 insertions(+), 25 deletions(-) diff --git a/crates/engine/tree/src/tree/cached_state.rs b/crates/engine/tree/src/tree/cached_state.rs index 55bdd2f44e..ba2b881e8f 100644 --- a/crates/engine/tree/src/tree/cached_state.rs +++ b/crates/engine/tree/src/tree/cached_state.rs @@ -425,21 +425,14 @@ impl HashedPostStateProvider for CachedStateProvider /// /// ## Storage Invalidation /// -/// When an account is destroyed (SELFDESTRUCT), all its storage must be invalidated. -/// This is handled using timestamps: -/// - Each storage entry stores the timestamp when it was inserted -/// - Each account tracks when it was last wiped (destroyed) -/// - On lookup, if the entry's timestamp <= wipe timestamp, the entry is stale -/// /// Since EIP-6780, SELFDESTRUCT only works within the same transaction where the -/// contract was created, so we only need to track wiped accounts for the current block. -/// The wipe map is cleared after each block execution via [`Self::clear_wiped_accounts`]. +/// contract was created, so we don't need to handle clearing the storage. #[derive(Debug, Clone)] pub(crate) struct ExecutionCache { /// Cache for contract bytecode, keyed by code hash. code_cache: Arc, FbBuildHasher<32>>>, - /// Flat storage cache: maps `(Address, StorageKey)` to timestamped storage value. + /// Flat storage cache: maps `(Address, StorageKey)` to storage value. storage_cache: Arc>, /// Cache for basic account information (nonce, balance, code hash). @@ -502,7 +495,7 @@ impl ExecutionCache { Ok(if miss { CachedStatus::NotCached(result) } else { CachedStatus::Cached(result) }) } - /// Insert storage value into cache with current timestamp. + /// Insert storage value into cache. pub(crate) fn insert_storage( &self, address: Address, @@ -512,16 +505,6 @@ impl ExecutionCache { self.storage_cache.insert((address, key), value.unwrap_or_default()); } - /// Insert multiple storage values into cache for a single account. - pub(crate) fn insert_storage_bulk(&self, address: Address, storage_entries: I) - where - I: IntoIterator)>, - { - for (key, value) in storage_entries { - self.insert_storage(address, key, value) - } - } - /// Inserts the post-execution state changes into the cache. /// /// This method is called after transaction execution to update the cache with @@ -582,11 +565,9 @@ impl ExecutionCache { }; // Now we iterate over all storage and make updates to the cached storage values - let storage_entries = account - .storage - .iter() - .map(|(storage_key, slot)| ((*storage_key).into(), Some(slot.present_value))); - self.insert_storage_bulk(*addr, storage_entries); + for (key, slot) in &account.storage { + self.insert_storage(*addr, (*key).into(), Some(slot.present_value)); + } // Insert will update if present, so we just use the new account info as the new value // for the account cache