Skip to content

rpc: replay block transactions through the block executor (backport of #28266) - #41

Merged
op-will merged 2 commits into
af/carry-trie-seek-boundaryfrom
af/carry-executor-replay
Nov 11, 2026
Merged

op-will merged 2 commits into
af/carry-trie-seek-boundaryfrom
af/carry-executor-replay

Conversation

@aakoshh

@aakoshh aakoshh commented Nov 10, 2026

Copy link
Copy Markdown

Stacked on #40. Carries #37 onto op-v2.7.0, so op-v2.7.0-0 keeps the executor-routed RPC replays that develop now depends on.

What

Cherry-picks 58c6608d3 (#37, op-v2.6.0-4) with -x: the backport of paradigmxyz/reth#28266, which replays a block's own transactions through the block executor in debug_*, trace_* and ots_* RPCs.

Why

ethereum-optimism/optimism#23942 merged today. It pins op-v2.6.0-4, and its rpc_replay_settlement tests fail without this patch: op-reth's SDM refund settlement is only visible to RPC replays that go through the executor. No upstream release up to v2.9.0 contains paradigmxyz#28266, so the monorepo's v2.7.0 bump has to carry the backport. The monorepo's rust/UPDATING-RETH.md ("Carried patches") says the same for v2.7.0 through v2.8.1.

How

Two conflicts, both from v2.7.0 changing code the backport touches:

  • crates/rpc/rpc-eth-api/src/helpers/call.rs: imports only. v2.7.0 adds StateProvider and reth_tasks::CancelOnDrop, and the backport adds StateProviderBox. Kept both.
  • crates/rpc/rpc/src/trace.rs: the trace_replay_block_transactions callback. Took the backport's side, which uses the TracingCtx the backport itself defines (the inspector owned, the result and database borrowed). v2.7.0's side used take_inspector() and into_trace_results_with_state_parts from alloy-evm's TracingCtx, which the backport replaces.

One compile fix on top: the backport's new Call::block_executor named its database StateProviderDatabase<StateProviderBox>. In v2.7.0, StateProviderDatabase takes an EvmStateProvider (paradigmxyz/reth#27109) and StateCacheDb wraps the box in EvmStateProviderAdapter, so the return type now says StateProviderDatabase<EvmStateProviderAdapter<StateProviderBox>>.

The backport's end-to-end test, executor_replay.rs, was written for v2.6.0's e2e harness, which v2.7.0 replaced (paradigmxyz/reth#27432). It now launches its node with SettlingNode::test_setup_for(EthereumHardfork::Prague).build_single(), as upstream's version of the test does, instead of setup with a hand-built Prague chain spec and eth_payload_attributes_for_fork. The two are equivalent: test_chain_spec(Prague) is mainnet's chain ID with the test genesis and every fork through Prague, and the builder's default payload attributes are eth_payload_attributes for that spec. Upstream's version also enables cache_computed_bals, for the BAL path this backport doesn't carry, so that is left out.

cargo test -p reth-node-ethereum --test e2e executor_replay passes, and so do the unit tests of reth-rpc and reth-rpc-eth-api. Formatted with the nightly-2026-07-14 rustfmt that lint.yml pins.

@aakoshh
aakoshh requested a review from a team as a code owner November 10, 2026 20:01
@aakoshh
aakoshh added this pull request to stack #36 November 10, 2026 20:04
@aakoshh
aakoshh requested a review from sebastianst November 10, 2026 20:06
aakoshh added a commit to ethereum-optimism/optimism that referenced this pull request Nov 10, 2026
develop now pins op-v2.6.0-4 (#23942), which
carries ethereum-optimism/reth#37: RPC block replays through the block
executor, which op-reth's SDM refund settlement depends on. Carry it
onto op-v2.7.0 as ethereum-optimism/reth#41, stacked on
ethereum-optimism/reth#40, and pin its head.

Resolve the conflicts with #23942:

- Cargo.toml and Cargo.lock: keep the op-v2.7.0 rev, now
  ethereum-optimism/reth#41's head.
- UPDATING-RETH.md: keep both sides, and update "Carried patches" for
  op-v2.7.0: where ethereum-optimism/reth#37's carry conflicted on
  v2.7.0, and the trie seek boundary fix carried as
  ethereum-optimism/reth#40.
- invalid_post_exec.rs: develop's crate::lagoon helpers in the
  E2ETestSetupBuilder call reth v2.7.0 needs.

Adapt #23942's new tests to reth v2.7.0: trace_replayTransaction returns
an optional TraceResultsWithTransactionHash, and StateProviderDatabase
takes an EvmStateProvider. Advance the reth mirror tags;
ethereum-optimism/reth#41 touches no mirrored symbol.
@geoknee
geoknee removed this pull request from stack #36 November 11, 2026 17:39
@geoknee
geoknee added this pull request to stack #43 November 11, 2026 17:40

@op-will op-will left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review focused on what differs from upstream paradigmxyz#28266 and the risk of those differences. Upstream is built on evm2; this backport targets alloy-evm 0.39 and rebuilds the fix with a different design (one toggled inspector per block, a reth-owned TracingCtx, from_eth_err mapping). Most findings come from that redesign.

Suggestions only touch code where this backport departs from upstream; behavior copied verbatim from upstream is left alone.

Highest priority: error-code mapping (changes client-visible behavior today) and the BAL branch still using a bare EVM. The toggled-inspector comment is non-blocking. Not verified: nothing was compiled or run.

einar-oplabs and others added 2 commits November 11, 2026 12:49
…paradigmxyz#28266) (#37)

Backports paradigmxyz#28266 to op-v2.6.0. Every replay of a block's own
transactions, canonical, raw or bad, runs through the chain's block executor
instead of a bare EVM, so traces, replayed state diffs, `debug_accountAt` and
`debug_intermediateRoots` include the per-transaction changes the executor
applies on top of the EVM result. `Call` gains `block_executor` and
`replay_transactions_until_with_executor`; `Trace::inspect_transaction_in_block`
takes the target transaction's index instead of a transaction environment and
rejects an out-of-range index; `TracingCtx` borrows the result and owns the
inspector, as upstream. Raw and bad blocks the executor rejects error instead
of returning pre-refund traces.

Differences from upstream, both forced by alloy-evm 0.39: the inspector is a
type parameter of the EVM, so tracing paths build an inspected executor and
enable the inspector only for the target transaction instead of calling
`inspect_transaction_without_commit`; and there is no `set_block_access_index`,
so the cached-BAL path still executes the target transaction on a bare EVM.

Ports upstream's end-to-end test: a node whose block executor credits a
settlement to every sender shows that prestate diffs, block traces and
intermediate roots agree with committed state.

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
(cherry picked from commit 58c6608)
clippy's type_complexity rejects the return type of Call::block_executor
since v2.7.0 wraps the provider in EvmStateProviderAdapter. Name the
database StateCacheDb reads through instead.
@op-will
op-will force-pushed the af/carry-executor-replay branch from 0447ceb to 87070b5 Compare November 11, 2026 18:58
@op-will
op-will enabled stacked auto-merge (rebase) November 11, 2026 19:30
@op-will
op-will disabled stacked auto-merge November 11, 2026 19:31
@op-will
op-will merged commit df85687 into op-v2.7.0 Nov 11, 2026
30 checks passed
@op-will
op-will deleted the af/carry-executor-replay branch November 11, 2026 19:35
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.

3 participants