Skip to content

feat(engine): expose state_trie_overlays() accessor on TreeState#12

Merged
maoueh merged 1 commit into
firehose/op-reth-2.xfrom
feature/open-state-overlays
Jun 9, 2026
Merged

feat(engine): expose state_trie_overlays() accessor on TreeState#12
maoueh merged 1 commit into
firehose/op-reth-2.xfrom
feature/open-state-overlays

Conversation

@maoueh

@maoueh maoueh commented Jun 9, 2026

Copy link
Copy Markdown

Summary

  • Adds StateTrieOverlayManager<N> from upstream paradigmxyz/reth to the StreamingFast fork, introducing state_trie_overlay.rs in reth-chain-state with full insert/remove lifecycle management.
  • Wires the manager into TreeState: maintained in insert_executed, reset, and remove_until to stay in sync with the live in-memory block set.
  • Adds a pub fn state_trie_overlays(&self) -> &StateTrieOverlayManager<N> accessor so external crates (reth-optimism-firehose) can read the overlay without re-building it from blocks_by_hash() on every request.

Why

OpFirehoseEngineValidator (in the ethereum-optimism/optimism monorepo) is an external re-implementation of BasicEngineValidator with Firehose live-tracing hooks. It needs to call .with_state_trie_overlay_manager(state.tree_state().state_trie_overlays().clone()) to build OverlayBuilder objects for in-memory-only blocks — exactly what BasicEngineValidator does internally. Without this accessor the field is pub(crate) and unreachable from outside the crate, forcing workarounds that diverge from upstream behaviour on every future upgrade.

Test plan

  • cargo check -p reth-chain-state — clean
  • cargo check -p reth-engine-tree — clean
  • cargo test -p reth-chain-state — 55 pass, 1 pre-existing failure (lazy_overlay::tests::misordered_blocks_panic)
  • cargo test -p reth-engine-tree — 14 unit + 1 integration pass, 0 failures

@maoueh maoueh force-pushed the feature/open-state-overlays branch from 038dd26 to 0bcc9da Compare June 9, 2026 20:25
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.
@maoueh maoueh force-pushed the feature/open-state-overlays branch from 0bcc9da to f1b8443 Compare June 9, 2026 20:53
@maoueh maoueh changed the base branch from firehose/2.x to firehose/op-reth-2.x June 9, 2026 20:53
@maoueh maoueh merged commit bbb2cd1 into firehose/op-reth-2.x Jun 9, 2026
2 checks passed
@maoueh maoueh deleted the feature/open-state-overlays branch June 9, 2026 20:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant