From f1b8443d6842eff51b5b41c3284d7b0038bccc1e Mon Sep 17 00:00:00 2001 From: Matthieu Vachon Date: Tue, 9 Jun 2026 16:53:06 -0400 Subject: [PATCH] feat(engine): expose pub state_trie_overlays() accessor on TreeState OpFirehoseEngineValidator (reth-optimism-firehose) is an external re-implementation of BasicEngineValidator that lives outside this crate and therefore cannot read pub(crate) fields. This one-line accessor exposes the existing state_trie_overlays field so external validators can call .with_state_trie_overlay_manager(...) on OverlayBuilder without rebuilding the manager from scratch on every request. --- crates/engine/tree/src/tree/state.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/crates/engine/tree/src/tree/state.rs b/crates/engine/tree/src/tree/state.rs index b8a33adb8b0..a1b8d13d0ad 100644 --- a/crates/engine/tree/src/tree/state.rs +++ b/crates/engine/tree/src/tree/state.rs @@ -344,6 +344,20 @@ impl TreeState { pub const fn canonical_block_number(&self) -> BlockNumber { self.canonical_head().number } + + /// Returns a reference to the [`StateTrieOverlayManager`] that tracks flattened trie overlays + /// for all current in-memory blocks. + /// + /// **Added by StreamingFast for Firehose/op-reth.** + /// `OpFirehoseEngineValidator` (in `reth-optimism-firehose`) is an external re-implementation + /// of `BasicEngineValidator` that adds Firehose live-tracing hooks. Because it lives outside + /// this crate it cannot access `pub(crate)` fields directly. This accessor lets it call + /// `.with_state_trie_overlay_manager(state.tree_state().state_trie_overlays().clone())` + /// in its `overlay_builder_for_parent` helper — the exact same pattern `BasicEngineValidator` + /// uses internally — so there is no behavioral divergence between the two validators. + pub fn state_trie_overlays(&self) -> &StateTrieOverlayManager { + &self.state_trie_overlays + } } #[cfg(test)]