Repository navigation
rpc!: replay block transactions through the block executor - #33
Closed
einar-oplabs wants to merge 4 commits into
Closed
einar-oplabs wants to merge 4 commits into
einar-oplabs wants to merge 4 commits into
Conversation
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>
Author
|
Superseded by the faithful backport of paradigmxyz#28266 in #37 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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, thetrace_*block loops,ots_*, and the prefix replay behindeth_callMany,debug_traceCallat an index anddebug_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_executorandreplay_transactions_until_with_executorback the prefix replays,inspect_transaction_in_blocktakes the transaction index and executes the block’s own transaction, andTracingCtxcarries a borrowedResultAndState, the database and an owned per-transaction inspector thattake_inspectorconsumes.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 rawdebug_traceBlockanddebug_traceBadBlockstay 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_blockno longer takes a transaction environment, block-trace callbacks importTracingCtxfromreth_rpc_eth_api::helpers::traceand readctx.result.resultandctx.result.state,take_inspectortakes the context by value, andreplay_transactions_until_with_evmis replaced byreplay_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.