From 3065a328f9ee9d4b6e90db8f224ee112c565fee3 Mon Sep 17 00:00:00 2001 From: Arsenii Kulikov Date: Wed, 21 Jan 2026 16:08:24 +0400 Subject: [PATCH] fix: clear `overlay_cache` in `with_extended_hashed_state_overlay` (#21233) --- crates/storage/provider/src/providers/state/overlay.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/crates/storage/provider/src/providers/state/overlay.rs b/crates/storage/provider/src/providers/state/overlay.rs index b233d621b7..97baab150e 100644 --- a/crates/storage/provider/src/providers/state/overlay.rs +++ b/crates/storage/provider/src/providers/state/overlay.rs @@ -129,6 +129,8 @@ impl OverlayStateProviderFactory { /// This overlay will be applied on top of any reverts applied via `with_block_hash`. pub fn with_overlay_source(mut self, source: Option) -> Self { self.overlay_source = source; + // Clear the overlay cache since we've updated the source. + self.overlay_cache = Default::default(); self } @@ -137,6 +139,8 @@ impl OverlayStateProviderFactory { /// Convenience method that wraps the lazy overlay in `OverlaySource::Lazy`. pub fn with_lazy_overlay(mut self, lazy_overlay: Option) -> Self { self.overlay_source = lazy_overlay.map(OverlaySource::Lazy); + // Clear the overlay cache since we've updated the source. + self.overlay_cache = Default::default(); self } @@ -152,6 +156,8 @@ impl OverlayStateProviderFactory { trie: Arc::new(TrieUpdatesSorted::default()), state, }); + // Clear the overlay cache since we've updated the source. + self.overlay_cache = Default::default(); } self } @@ -178,6 +184,8 @@ impl OverlayStateProviderFactory { }); } } + // Clear the overlay cache since we've updated the source. + self.overlay_cache = Default::default(); self } }