Repository navigation
Conversation
The RPC helpers that replay a block's own transactions (debug_trace*, trace_*, eth_callMany/debug_traceCall at an index/debug_traceCallMany, debug_intermediateRoots, ots) ran them on a bare EVM. Per-transaction logic that lives in the block executor was skipped, so on OP Stack SDM blocks traces reported pre-refund gas and unsettled balances, and the intermediate roots never reached the header's state root. Prefix replays now go through `executor_for_block`, and traced transactions run on an executor built over the inspected EVM via `execute_transaction_without_commit`. alloy-evm's `TxTracer` is replaced by an executor loop with a local `TracingCtx` of the same public shape. `trace_chain_block` is ported the same way and still reports a failing transaction as a per-transaction error. `replay_block_until` keeps the cached-BAL shortcut, since computed BALs are built by the executor and hold settled state. `inspect_transaction_in_block` and `spawn_replay_transaction` no longer use it: attaching the BAL ran the target on a bare EVM, and `--rpc-cache.prewarm-bals` caches a BAL for every canonical block on any chain. Ref: ethereum-optimism/protocol-team#485 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Collaborator
Author
|
Upstream: paradigmxyz#28047 (draft, ported onto upstream main). |
Collaborator
Author
|
Superseded by #24, which routes the same replays through the executor but keeps the cached-BAL paths and raw/bad-block tracing as upstream has them. |
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.
Superseded by #24, which keeps the cached-BAL paths and raw/bad-block tracing as upstream has them.
Supersedes #18, which targeted
optimism; this is the same change ported ontoop-v2.6.0.The RPC helpers that replay a block's own transactions (
replay_block_until,inspect_transaction_in_block,trace_block_until_with_inspector,spawn_replay_transaction, and thetrace_block,trace_chain_blockanddebug_intermediateRootsloops indebug.rs) ran them on a bare EVM, so anything the block executor does per transaction outside the EVM was skipped. On OP Stack that is the SDM refund settlement for blocks carrying a post-exec (0x7D) transaction:debug_trace*,trace_*,eth_callMany/debug_traceCall/debug_traceCallManyat a transaction index,debug_intermediateRootsandots_*reported pre-refund gas and unsettled balances, and the last intermediate root didn't match the header's state root. Ref ethereum-optimism/protocol-team#485.These paths now go through the executor. Prefix replays use
executor_for_blockandexecute_transaction, and traced transactions run on an executor built over the inspected EVM (Trace::inspected_block_executor) withexecute_transaction_without_commit, so tracers see the executor's settledResultAndState. One executor replays from transaction 0 because the OP executor derives a transaction's position, and with it the refund, from the number of transactions it has committed. alloy-evm'sTxTracercan't drive an executor (TracingCtxhas private fields), sotrace_block_until_with_inspectorhas its own loop and a localTracingCtxwith the same public surface; callers are unchanged.trace_chain_blockkeeps reporting a failing transaction as aTraceResult::Errorinstead of failing the range.replay_block_untilkeeps the cached-BAL shortcut.inspect_transaction_in_blockandspawn_replay_transactiondrop it, because attaching the BAL runs the target transaction on a bare EVM. That drop isn't needed for OP: op-reth rejects the BAL cache options and serves none of the BAL RPCs, so no BAL is ever cached on an OP node. (An earlier version of this description said--rpc-cache.prewarm-balswould bring the bug back on OP; it can't, since op-reth refuses that flag.)Behavior changes:
inspect_transaction_in_blockdrops itstarget_tx_envandbalarguments and always traces the block's transaction at the index; nothing in optimism or optimism-premium calls it. A transaction error intrace_block_until_with_inspectornow fails the call instead of silently truncating the results.debug_traceRawBlockanddebug_traceBadBlockrun the executor's per-transaction checks (cumulative gas, DA footprint, SDM entry validation), so a block failing one of them errors instead of tracing. Replay errors map throughBlockExecutionErrorinstead offrom_evm_err, which changes their RPC error codes.On Ethereum the executor only adds the block gas checks, receipt building and gas accounting on top of
transact, so traces and intermediate roots of valid blocks are unchanged there. This continues paradigmxyz#26614, which moved the same endpoints onto one EVM for downstream EVMs with block-scoped state; here the per-transaction state lives in the executor instead.ethereum-optimism/optimism#23465 (
rust/op-reth/crates/node/tests/it/debug_trace_post_exec.rs) sequences a real SDM block and checks every path against the receipt, the committed balances and the header; it fails on0fbe4285and passes on the pre-rebase version of this change (ca905873, #18); it hasn't been re-run against theop-v2.6.0port yet. On the port,reth-rpc,reth-rpc-eth-api,reth-node-ethereum(including its 72 e2e tests) andreth-rpc-e2e-teststests pass, and nightly fmt, clippy and rustdoc with-D warningsare clean forreth-rpcandreth-rpc-eth-api.🤖 Generated with Claude Code