Skip to content

fix(rpc): replay block txs through the executor - #24

Closed
geoknee wants to merge 2 commits into
op-v2.6.0from
geoknee/rpc-replay-executor-keep-bal
Closed

geoknee wants to merge 2 commits into
op-v2.6.0from
geoknee/rpc-replay-executor-keep-bal

Conversation

@geoknee

@geoknee geoknee commented Oct 22, 2026

Copy link
Copy Markdown
Collaborator

Supersedes #23 with a narrower change that leaves Ethereum behavior and the cached-BAL fast path alone.

The RPC helpers that replay a block's own transactions without a cached BAL now run them through the block executor instead of a bare EVM, so debug_traceTransaction, debug_traceBlockByHash / ByNumber, traceChain, trace_*, ots_*, debug_traceCall / eth_callMany at a transaction index and debug_intermediateRoots include the per-transaction changes the executor applies, such as OP Stack's post-execution gas refunds. When a cached BAL is available the target transaction still runs on its own, as upstream does since paradigmxyz#24097; op-reth never caches one, because it rejects the BAL options and serves none of the BAL RPCs. debug_traceBlock (raw RLP) and debug_traceBadBlock keep the bare EVM so blocks the executor would reject still trace, which means they report pre-refund gas for OP blocks with refunds. Method signatures are unchanged except that trace_block_until* callbacks get a local TracingCtx with the same fields and a borrowed result, since alloy-evm's can't be built from an executor; replay_transactions_until_with_evm, which has no callers left, is removed.

On Ethereum the executor only adds the block gas checks, receipt building and gas totals on top of the EVM, so results for valid blocks are unchanged.

reth-rpc, reth-rpc-eth-api, reth-node-ethereum (including test_bal_prewarming_for_transaction_replay, which reaches the BAL path again) and reth-rpc-e2e-tests tests pass, and fmt, clippy and rustdoc with -D warnings are clean. With op-reth pinned to this commit, the ethereum-optimism/optimism#23465 suite passes once its raw-block test expects pre-refund gas instead of canonical gas.

🤖 Generated with Claude Code

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>
@geoknee

geoknee commented Oct 22, 2026

Copy link
Copy Markdown
Collaborator Author

Upstream: paradigmxyz#28047 (draft, same change on upstream main).

@geoknee
geoknee requested a review from sebastianst October 23, 2026 11:52
@geoknee
geoknee marked this pull request as ready for review October 23, 2026 11:53
geoknee added a commit to ethereum-optimism/optimism that referenced this pull request Oct 23, 2026
ethereum-optimism/reth#24 keeps debug_traceBlock on a bare EVM so blocks the executor rejects still trace.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
geoknee added a commit to ethereum-optimism/optimism that referenced this pull request Oct 23, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@einar-oplabs einar-oplabs self-assigned this Oct 29, 2026
@einar-oplabs

Copy link
Copy Markdown

Superseded by #26, which exposes replay hooks without changing replay behavior for other chains; the OP settlement lives in ethereum-optimism/optimism#23670. Tracked in ethereum-optimism/protocol-team#485. Closing as superseded; branch kept.

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