Skip to content

op-reth: test the proofs multiproof V2 path - #23420

Closed
einar-oplabs wants to merge 1 commit into
developfrom
einar/23394-proofs-multiproof-v2
Closed

einar-oplabs wants to merge 1 commit into
developfrom
einar/23394-proofs-multiproof-v2

Conversation

@einar-oplabs

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

Copy link
Copy Markdown
Contributor

Covers the V2 multiproof path the reth 2.6 bump (#23046) made the default on both proofs state providers (DatabaseProof::overlay_multiproof_v2, multiproof_v2), which reth's engine and RPC take through the proofs provider and which had no test. Closes #23394.

rust/op-reth/crates/trie/src/proof/tests.rs, an rstest table on a three-block fixture computed once per process: block 1 creates a contract, accounts, EOAs and 256 filler accounts and slots per storage trie so that stored branch nodes exist; block 2 writes the EOA and the zeroed slot with values the tip overwrites, so the tip's values show only when it is applied over block 2; block 3, the tip, destroys an account, zeroes the slot and updates the EOA.

  • fixture_tip_rewrites_stored_branch_nodes pins the property the fillers exist for: block 1 stores a branch node below the root on the EOA's path in the account trie and on the changed slots' paths in both contracts' storage tries, and the tip rewrites or removes it, so the proofs read stored and overlaid branch nodes, not leaves alone. fixture_tip_root_matches_plain_state pins the expected root to one computed from the plain state, independently of the store. fixture_tip_rewrites_second_block_branch_nodes pins that block 2 and the tip both write a branch node below the root on the EOA's path and on the zeroed slot's path, which the ordering cells rely on.
  • multiproof_v2_matches_multiproof requests V1 and V2 proofs for the same targets (live slot, zeroed slot, unwritten slot, destroyed account, updated and untouched EOA, missing account, and all at once) and verifies each against the tip's state root and checks that the two show the same accounts, storage roots and proof nodes, over target shape {account and storage, account only, storage only, every target below the already revealed root branch} as cases, and tip placement {flushed, buffered over flushed block 2, buffered together with block 2, passed as the caller's TrieInput with nodes and state over flushed block 2, passed as the caller's TrieInput over buffered block 2, passed as state and prefix sets only} and store {in-memory, MDBX} as #[values] dimensions. The V2 payload is checked directly too: its account proof nodes recompute the state root, each targeted account's storage proof nodes its storage root, every branch node on a proof path carries the masks of the branch node the blocks store at its path, and the proof below the known root is the proof from the root less the root nodes. 108 cells in a few seconds.

Mutation checks: dropping the node overlay from overlay_multiproof_v2 failed the buffered and trie-input cells on V2 only; dropping prepend_self from the overlay provider failed the buffered cells; dropping .with_prefix_sets_mut(input.prefix_sets) from overlay_multiproof_v2 fails exactly the state-and-prefix-sets cells; merging the caller's input under the buffer in the overlay provider's multiproof_v2 fails exactly the 18 trie-input-over-buffered cells; dropping the oldest-to-newest reversal in TrieBufferState::state_provider fails exactly the 18 buffered-with-parent cells; zeroing the tree masks of the branch nodes the proofs trie cursor returns to overlay_multiproof_v2, or of the overlay provider's aggregated trie input, fails only the masks assertions (24 cells each, in the placements that read the mutated nodes). Seams: test_utils::proofs_store::buffered_state_provider buffers blocks into a fresh TrieBufferState and reads them at its tip (TrieBufferState::insert and tip widen to pub(crate) and the engine's buffer modules become pub(crate); the overlay provider gains nothing); the general proofs-store helpers (INITIAL_ANCHOR, plain_slot, hashed_slot, hashed_storage, storage_diff, seed_initial_storage, store_block, state_provider) live in test_utils::proofs_store beside it, with destroyed_accounts keeping the destroyed-account fixtures; rstest and alloy-rlp become dev-dependencies.

Breakdown

added removed net
implementation 7 5 +2
tests 845 43 +802
docs 0 0 0

AI Reviews

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

🤖 Generated with Claude Code

@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/23387-proofs-reconcile-tests branch 2 times, most recently from 2135d12 to c9231e5 Compare November 9, 2026 22:30
@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 changed the base branch from einar/23387-proofs-reconcile-tests to develop November 10, 2026 13:11
@einar-oplabs
einar-oplabs force-pushed the einar/23394-proofs-multiproof-v2 branch from 1a32f35 to 1b2e317 Compare November 10, 2026 13:19
@einar-oplabs
einar-oplabs marked this pull request as ready for review November 10, 2026 13:19
@einar-oplabs
einar-oplabs requested a review from a team as a code owner November 10, 2026 13:19
@einar-oplabs
einar-oplabs requested a review from aakoshh November 10, 2026 13:19
@einar-oplabs
einar-oplabs force-pushed the einar/23394-proofs-multiproof-v2 branch from 300c323 to d6c5057 Compare November 10, 2026 15:33
@einar-oplabs
einar-oplabs requested review from a team as code owners November 10, 2026 15:33
@mintlify

mintlify Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated
Optimism-Docs 🟢 Ready View Preview Nov 10, 2026, 7:35 PM

@einar-oplabs
einar-oplabs requested a review from wwared November 10, 2026 15:33
@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.

Checks the V2 multiproofs of both proofs state providers against the V1
multiproofs and the tip's roots on a three-block fixture whose fillers store
branch nodes the tip rewrites and whose middle block writes values the tip
overwrites: V1 and V2 verify and agree for live, zeroed and unwritten slots,
a destroyed account, updated and untouched EOAs and a missing account, over
both store backends and six tip placements (flushed; buffered alone or with
its parent; passed as trie input blocks, as trie input state with prefix
sets, or as caller input over a buffered parent); the V2 payload recomputes
the state root and every targeted account's storage root, its branch nodes
carry the masks the fixture's blocks stored, account-only, storage-only and
below-known-root target shapes are covered, and V1 and V2 agree on account
info, storage roots and proof nodes. Mutations that drop the prefix-set leg,
reverse the overlay merge or the buffer order, or zero the masks the cursor
or the overlay return, each fail exactly the cells built to catch them.

The buffered placements build their provider through a test_utils helper
over the engine's buffer, whose insert and tip become pub(crate), and the
store helpers the provider, overlay and proof tests share move to
test_utils::proofs_store.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

This branch was successfully deployed

1 active deployment
staging - docs/public-docs — 971c3ba8 Deployed Nov 10, 2026 by mintlify[bot]
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: tests for the proofs multiproof v2 path

3 participants