Skip to content

fix(sdm): stabilize PostExec consensus surface (Verify 0x7D guard + opt-in TOCTOU)#21502

Merged
nonsense merged 2 commits into
developfrom
ae/sdm/prework-consensus-surface
Jun 23, 2026
Merged

fix(sdm): stabilize PostExec consensus surface (Verify 0x7D guard + opt-in TOCTOU)#21502
nonsense merged 2 commits into
developfrom
ae/sdm/prework-consensus-surface

Conversation

@nonsense

@nonsense nonsense commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Summary

Two consensus-surface pre-work fixes for the SDM PostExec (0x7D) machinery, landed ahead of the SDM → optimism-premium extraction (the §4 Pre-work (remaining) items: snapshot PostExecMode once, and enforce saw_post_exec_tx in finish()). Both are small, independently reviewable, and behavior-preserving for valid blocks.

1. fix(alloy-op-evm): reject Verify blocks missing the trailing 0x7D

Reject verifier executions that consume an out-of-band post-exec payload without seeing its 0x7D carrier tx

2. fix(op-reth): snapshot PostExecMode once per build (opt-in TOCTOU)

build() read the runtime-mutable SDM production opt-in twice — once inside block_builder() (mode selection) and again when deciding to append the 0x7D. An admin-RPC toggle between the reads could yield a block with refunded state but no 0x7D (or vice versa). post_exec_mode() is now resolved once and threaded through the new block_builder_with_mode(); the append decision derives from the same snapshot (matches!(mode, Produce)), which is exactly equivalent to the old !force_empty() && sdm_production_enabled() predicate.

Testing

  • New failing-first test test_finish_rejects_verify_block_missing_post_exec_tx (alloy-op-evm) — reproduces the hole on baseline, passes with the guard. Full suite 73/73.
  • New regression test block_builder_with_mode_honors_snapshot_over_live_opt_in (reth-optimism-payload-builder) — asserts the builder honors the passed snapshot regardless of the live opt-in. Suite 23/23.
  • just fmt-fix clean · clippy --workspace --all-features --all-targets clean.

Notes

  • The opt-in TOCTOU is a race; the fix is structural (the second read is removed), so it isn't a deterministically-reproducible failing unit test — the new test instead locks in the single-snapshot contract.
  • Per the plan, a clean baseline rev should be tagged after this lands so premium can repoint its optimism_rev.

🤖 Generated with Claude Code

Reject Verify blocks that claim refunds without the trailing post-exec tx, and snapshot PostExecMode once per payload build so EVM setup and 0x7D appending agree.
@nonsense nonsense force-pushed the ae/sdm/prework-consensus-surface branch from 72be2f3 to 85837ca Compare June 23, 2026 09:20
The reth-codec opt-in change (#21483) added reth-optimism-primitives as a
dependency of reth-optimism-post-exec-replay but only updated the main rust
workspace lockfile. The op-rbuilder and rollup-boost workspaces depend on
that crate via path, so their Cargo.lock files went stale and the Docker
builds (which run `cargo chef cook --locked`) failed with "cannot update
the lock file because --locked was passed".

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@wiz-0f98cca50a

Copy link
Copy Markdown

Wiz Scan Summary

Scanner Findings
Vulnerability Finding Vulnerabilities 4 High 2 Medium 2 Low
Data Finding Sensitive Data -
Secret Finding Secrets -
IaC Misconfiguration IaC Misconfigurations -
SAST Finding SAST Findings -
Software Management Finding Software Management Findings -
Total 4 High 2 Medium 2 Low

View scan details in Wiz

To detect these findings earlier in the dev lifecycle, try using Wiz Code VS Code Extension.

@nonsense nonsense marked this pull request as ready for review June 23, 2026 11:00
@nonsense nonsense requested a review from a team as a code owner June 23, 2026 11:00
@nonsense nonsense requested a review from einar-oplabs June 23, 2026 11:10
@einar-oplabs einar-oplabs self-assigned this Jun 23, 2026
Comment thread rust/alloy-op-evm/src/block/mod.rs
@nonsense nonsense added this pull request to the merge queue Jun 23, 2026
Merged via the queue into develop with commit a7ab3fd Jun 23, 2026
128 checks passed
@nonsense nonsense deleted the ae/sdm/prework-consensus-surface branch June 23, 2026 12:01
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