Skip to content

op-reth: settle SDM refunds on RPC replay paths - #23465

Closed
geoknee wants to merge 6 commits into
developfrom
geoknee/sdm-trace-settlement
Closed

geoknee wants to merge 6 commits into
developfrom
geoknee/sdm-trace-settlement

Conversation

@geoknee

@geoknee geoknee commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

On SDM blocks, the RPC paths that replay a block's transactions report the pre-refund result: debug_traceTransaction / debug_traceBlockByHash / debug_traceBlockByNumber return pre-refund gas and state diffs that charge the sender refund × price too much, trace_* state diffs and eth_callMany / debug_traceCall at an index / debug_traceCallMany start from unsettled balances, and debug_intermediateRoots never reaches the header's state root. Explorers and indexers ingest those numbers. With this PR every one of those paths agrees with the receipt, the committed balances and the header. Consensus, receipts and stored state are unaffected.

The settlement lives only in the block executor and the replay helpers live in reth, so the fix is ethereum-optimism/reth#24 (replay through the executor) and this PR pins it. debug_trace_post_exec.rs now sequences a real SDM block with the fixed test policy and checks each path; it fails on the current pin (every path off by exactly the refund × price split) and passes on this one.

debug_traceBlock (raw RLP) and debug_traceBadBlock stay on a bare EVM, so blocks the executor would reject still trace, and they keep reporting pre-refund gas for blocks with refunds, as on develop today. The raw-block test now pins that.

Part of ethereum-optimism/protocol-team#485. The issue's last item — whether production SDM opt-in waits for RPC fleets to run this — is still open.

Do not merge yet: the pin is the head of the unmerged reth#24. Once it merges into the fork's op-v2.6.0 branch, repin all rust/Cargo.toml entries to the resulting tag or commit and advance the UPSTREAM-MIRROR tags to it. optimism-premium pins the same reth rev and must move to that commit in step with its optimism_rev.

Behaviour change that comes with the fork change: replay errors on the executor paths map through BlockExecutionError, so their RPC error codes change. It isn't reachable when replaying a canonical block.

Review findings dismissed (please confirm):

  • reth-update-reviewer: eth_callMany, debug_traceCallMany, trace_block / trace_filter and ots_getTransactionError are not exercised directly. They share replay_block_until, trace_block_until_with_inspector and spawn_replay_transaction with paths the test covers.
  • rust-code-reviewer: prefer methods over free helpers. Not changed, because the sibling invalid_post_exec.rs uses free helpers.

🤖 Generated with Claude Code

geoknee and others added 3 commits October 16, 2026 12:47
Bumps the reth pin to ethereum-optimism/reth#18, which replays block
transactions through the block executor so debug_trace*, trace_*,
eth_callMany/debug_traceCall at an index/debug_traceCallMany and
debug_intermediateRoots report canonical gas and settled balances on SDM
blocks. Extends debug_trace_post_exec.rs with a sequenced SDM block that
checks each path against the receipt, committed state and header.

Ref: ethereum-optimism/protocol-team#485

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Pins the deployment's absolute canonical gas, requires the sender balance
to change in every state diff, checks replay lengths, and moves the
Lagoon chain spec and payload attributes into a module shared with
invalid_post_exec.rs. Rewords two alloy-op-evm comments that described
RPC replay as bypassing the block executor.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…settlement-v2.6.0

# Conflicts:
#	rust/Cargo.lock
#	rust/Cargo.toml
geoknee and others added 2 commits October 23, 2026 12:53
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>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@einar-oplabs

Copy link
Copy Markdown
Contributor

Superseded by #23670, which settles SDM refunds through the replay hooks in ethereum-optimism/reth#26. 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.

2 participants