Skip to content

op-reth!: refuse a masked engine tree at launch and test the Amsterdam rejection - #23422

Closed
einar-oplabs wants to merge 1 commit into
developfrom
einar/23403-amsterdam-masking-guard-tests
Closed

einar-oplabs wants to merge 1 commit into
developfrom
einar/23403-amsterdam-masking-guard-tests

Conversation

@einar-oplabs

@einar-oplabs einar-oplabs commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Covers the two rejection paths the reth v2.6.0 bump (#23046) added without tests: the Amsterdam payload field check in ensure_well_formed_payload and the state masking guard on the launch path. Closes #23403.

Payload validator (rust/op-reth/crates/payload/src/validator.rs): a plain post-Isthmus payload round-trips through engine_newPayloadV4 and passes every check; a block carrying block_access_list_hash or slot_number is rejected with the block hash error, since no OP payload version can represent those fields; with EthereumHardfork::Amsterdam scheduled by hand on an OP chain spec, every OP payload is rejected with PostAmsterdamBlockWithoutBlockAccessList, which proves the activation flag reaches the validator and marks the footgun that no OP fork implies Amsterdam.

State masking (rust/op-reth/crates/node/src/state_masking.rs): op-reth forces masking off at the two points it owns. init_op_engine_defaults() locks the process-global engine defaults at --engine.num-state-masking-blocks 0 and returns EngineDefaultsLockedMasked when another caller locked them with a nonzero effective window first (the global is first-writer-wins; a locked persistence threshold of 0 turns masking off whatever the window says); the CLI calls it before clap reads the defaults and prints that error to stderr, since no tracing subscriber exists yet, and the test helpers utils::node_config, utils::unmasked_tree_config and utils::setup call it before any NodeConfig exists, so the it and e2e-testsuite binaries pass under single-process cargo test whichever test runs first. The guard is NoStateMaskingValidatorBuilder, which OpAddOns wraps around its engine validator builder: every EngineNodeLauncher, whether reached through .launch(), launch_with, or reth_e2e_test_utils, hands it the TreeConfig it runs the engine with, so a masked config fails there with STATE_MASKING_UNSUPPORTED, and a launched node is unmasked by construction. The guard cannot set the window to 0 itself: the tree keeps its own copy of the TreeConfig, so rejection is the only option from op-reth. The CLI post-parse check rejects a nonzero flag or RETH_ENGINE_NUM_STATE_MASKING_BLOCKS with the same constant plus the reason, and launch_node runs the same check on its NodeConfig before opening the datadir, so a masked config fails fast on the binary's path. Tests: the guard accepts 0 and rejects 30; init_op_engine_defaults turns the default off; tests/it/state_masking.rs launches a node with a masked TreeConfig and asserts the rejection anywhere in the error chain, while every other launch test routes through utils::node_config (unused ports included) / utils::unmasked_tree_config and would fail at the guard otherwise.

BREAKING CHANGE: binaries and test harnesses that build a NodeConfig or parse the CLI without Cli::parse_with_denied_args lock the engine defaults at upstream's state masking window, and launching an OpNode from them now fails with --engine.num-state-masking-blocks must be 0 on op-reth: state masking is not supported. Call reth_optimism_node::init_op_engine_defaults() before building any NodeConfig, or parse the CLI with Cli::parse_with_denied_args.

Breakdown

added removed net
implementation 147 26 +121
tests 253 77 +176
docs 0 0 0

AI Reviews

  • 2026-11-10T13:47:41Z 006dd02 Fable 5.1 xhigh
  • GPT-6.1-Sol xhigh

🤖 Generated with Claude Code

@einar-oplabs einar-oplabs self-assigned this Oct 14, 2026
@opgitgovernance

Copy link
Copy Markdown
Contributor

This pr has been automatically marked as stale and will be closed in 5 days if no updates

@opgitgovernance opgitgovernance added the S-stale Status: Will be closed unless there is activity label Oct 29, 2026
@einar-oplabs einar-oplabs reopened this Nov 6, 2026
@einar-oplabs einar-oplabs removed the S-stale Status: Will be closed unless there is activity label Nov 6, 2026
@einar-oplabs
einar-oplabs force-pushed the einar/23394-proofs-multiproof-v2 branch from 4bbcaae to 1a32f35 Compare November 9, 2026 22:30
@einar-oplabs
einar-oplabs force-pushed the einar/23403-amsterdam-masking-guard-tests branch from 53a7c79 to 7629cf4 Compare November 9, 2026 22:31
@einar-oplabs
einar-oplabs changed the base branch from einar/23394-proofs-multiproof-v2 to develop November 10, 2026 13:11
@einar-oplabs
einar-oplabs force-pushed the einar/23403-amsterdam-masking-guard-tests branch from 7629cf4 to 006dd02 Compare November 10, 2026 13:25
@einar-oplabs
einar-oplabs marked this pull request as ready for review November 10, 2026 13:25
@einar-oplabs
einar-oplabs requested a review from a team as a code owner November 10, 2026 13:25
@einar-oplabs
einar-oplabs force-pushed the einar/23403-amsterdam-masking-guard-tests branch from 34c1ee1 to 1bd753f Compare November 10, 2026 15:33
@einar-oplabs
einar-oplabs requested review from a team as code owners November 10, 2026 15:33
@einar-oplabs einar-oplabs changed the title op-reth: unit test the Amsterdam payload rejection and the state masking guard op-reth: default state masking off for every OpNode and test the Amsterdam rejection Nov 10, 2026
@wiz-0f98cca50a

wiz-0f98cca50a Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

Wiz Scan Summary

Scanner Findings
Vulnerability Finding Vulnerabilities -
Data Finding Sensitive Data -
Secret Finding Secrets -
IaC Misconfiguration IaC Misconfigurations -
SAST Finding SAST Findings -
Software Management Finding Software Management Findings -
Total -

View scan details in Wiz

To detect these findings earlier in the dev lifecycle, try the Wiz Code extension for VS Code, JetBrains, or Visual Studio.

@einar-oplabs
einar-oplabs force-pushed the einar/23403-amsterdam-masking-guard-tests branch 2 times, most recently from 3681957 to c0ea4eb Compare November 10, 2026 16:20
@einar-oplabs einar-oplabs changed the title op-reth: default state masking off for every OpNode and test the Amsterdam rejection op-reth: refuse a masked engine tree at launch and test the Amsterdam rejection Nov 10, 2026
@einar-oplabs einar-oplabs changed the title op-reth: refuse a masked engine tree at launch and test the Amsterdam rejection op-reth!: refuse a masked engine tree at launch and test the Amsterdam rejection Nov 10, 2026
@einar-oplabs
einar-oplabs force-pushed the einar/23403-amsterdam-masking-guard-tests branch 2 times, most recently from da468eb to 551db53 Compare November 10, 2026 18:48
…m rejection

op-reth does not support reth's state masking, and until now only the CLI
turned it off. init_op_engine_defaults locks reth's engine defaults at
masking 0 and reports when someone else locked them first; the CLI and the
node crate's test setup call it before any NodeConfig exists. The engine
validator builder of OpAddOns sees the TreeConfig the launcher hands the
engine tree and rejects a masked one, so NodeBuilder::launch, launch_with
and reth's e2e setups cannot start a masked node unnoticed; launch_node
runs the same check on its NodeConfig before opening the datadir, and the
CLI keeps its post-parse rejection.

The payload validator tests pin that a plain post-Isthmus payload is well
formed, that a block carrying an Amsterdam header field fails the block hash
check, and that scheduling Amsterdam on an OP chain spec rejects every OP
payload.

BREAKING CHANGE: binaries and test harnesses that build a NodeConfig or
parse the CLI without Cli::parse_with_denied_args lock the engine defaults
at upstream's state masking window, and launching an OpNode from them now
fails with "--engine.num-state-masking-blocks must be 0 on op-reth: state
masking is not supported". Call reth_optimism_node::init_op_engine_defaults()
before building any NodeConfig, or parse the CLI with
Cli::parse_with_denied_args.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@einar-oplabs
einar-oplabs force-pushed the einar/23403-amsterdam-masking-guard-tests branch from b2f86c7 to 0ce1619 Compare November 10, 2026 19:25
@einar-oplabs
einar-oplabs removed request for a team and digorithm November 11, 2026 12:29
@joshklop joshklop closed this Nov 21, 2026
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.

op-reth: unit tests for the Amsterdam payload field rejection and the state masking guard

3 participants