Skip to content

rpc!: replay block transactions through the block executor - #33

Closed
einar-oplabs wants to merge 4 commits into
op-v2.6.0from
einar/rpc-executor-replay-485
Closed

einar-oplabs wants to merge 4 commits into
op-v2.6.0from
einar/rpc-executor-replay-485

Conversation

@einar-oplabs

@einar-oplabs einar-oplabs commented Nov 4, 2026 •

Copy link
Copy Markdown

Alternative to #26 for ethereum-optimism/protocol-team#485, finishing George’s #24 in the shape upstream is converging on in paradigmxyz#28266.

Every replay of a block’s own transactions runs through the chain’s block executor instead of a bare EVM: debug_traceTransaction, debug_traceBlockByHash/ByNumber, debug_traceChain, debug_intermediateRoots, the trace_* block loops, ots_*, and the prefix replay behind eth_callMany, debug_traceCall at an index and debug_accountAt. Executors that settle state per transaction, such as op-reth’s SDM gas refunds, therefore produce traces, replays and intermediate roots that agree with their receipts, and op-reth needs no RPC override of its own. The API mirrors paradigmxyz#28266 on revm types: Call::block_executor and replay_transactions_until_with_executor back the prefix replays, inspect_transaction_in_block takes the transaction index and executes the block’s own transaction, and TracingCtx carries a borrowed ResultAndState, the database and an owned per-transaction inspector that take_inspector consumes.

Two deliberate differences from paradigmxyz#28266: the cached-BAL path still executes only the target transaction on a bare EVM, because alloy-evm 0.39 has no set_block_access_index, and raw debug_traceBlock and debug_traceBadBlock stay on the bare EVM so blocks the executor would reject still trace, as geth does. Unlike #26 this changes replay behavior on every chain, so it lands only as a backport of paradigmxyz#28266 once that merges upstream; the consumer side is ethereum-optimism/optimism#23942, paradigmxyz#23670’s tests without its override, pinned to this head. #37 is the faithful backport of paradigmxyz#28266, which also routes raw and bad blocks through the executor.

BREAKING CHANGE: inspect_transaction_in_block no longer takes a transaction environment, block-trace callbacks import TracingCtx from reth_rpc_eth_api::helpers::trace and read ctx.result.result and ctx.result.state, take_inspector takes the context by value, and replay_transactions_until_with_evm is replaced by replay_transactions_until_with_executor.

Locally: cargo check -p reth-rpc --tests, clippy with all features on both crates, the pinned-nightly formatter and the new out-of-bounds unit test pass.

geoknee and others added 4 commits October 22, 2026 21:55
The RPC helpers that replay a block's own transactions without a cached
BAL ran them on a bare EVM, so per-transaction changes the block
executor applies, such as OP Stack's post-execution gas refunds, were
missing from traces, replayed state and intermediate roots. Those
replays, canonical block tracing and traceChain now go through the
executor.

The cached-BAL paths are unchanged, and raw and bad block tracing keeps
the bare EVM so blocks the executor rejects still trace. alloy-evm's
`TxTracer` can't drive an executor, so `trace_block_until_with_inspector`
has its own loop and a local `TracingCtx` that borrows the result.
`replay_transactions_until_with_evm` has no callers left and is removed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Finishes #24: every replay of a block's own transactions runs through the
chain's block executor instead of a bare EVM, so executors that settle
state per transaction, such as op-reth's SDM gas refunds, produce traces,
replays and intermediate roots that agree with their receipts. The API
mirrors upstream paradigmxyz#28266 on revm types: `Call::block_executor`
and `replay_transactions_until_with_executor` back `replay_block_until`,
`spawn_replay_transaction`, the `debug_*` block loops and intermediate
roots; `inspect_transaction_in_block` takes the transaction index and
executes the block's own transaction; and `TracingCtx` carries a borrowed
`ResultAndState`, the database and an owned per-transaction inspector that
`take_inspector` consumes.

The cached-BAL path still executes only the target transaction on a bare
EVM. Raw `debug_traceBlock` and `debug_traceBadBlock` stay on the bare EVM
so blocks the executor would reject still trace; upstream routes them
through the executor.

BREAKING CHANGE: `inspect_transaction_in_block` no longer takes a
transaction environment, block-trace callbacks import `TracingCtx` from
`reth_rpc_eth_api::helpers::trace` and read `ctx.result.result` and
`ctx.result.state`, `take_inspector` takes the context by value, and
`replay_transactions_until_with_evm` is replaced by
`replay_transactions_until_with_executor`.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@einar-oplabs

Copy link
Copy Markdown
Author

Superseded by the faithful backport of paradigmxyz#28266 in #37

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.

2 participants