Repository navigation
op-reth: live test of index-versus-execute proofs store parity - #23442
Closed
einar-oplabs wants to merge 3 commits into
Closed
einar-oplabs wants to merge 3 commits into
einar-oplabs wants to merge 3 commits into
Conversation
This was referenced Oct 15, 2026
einar-oplabs
force-pushed
the
einar/23388-proofs-index-execute-parity
branch
from
October 15, 2026 16:07
3df6ccb to
dfd4d72
Compare
einar-oplabs
force-pushed
the
einar/23388-proofs-index-execute-parity
branch
from
October 15, 2026 16:36
dfd4d72 to
1026bcd
Compare
einar-oplabs
force-pushed
the
einar/23388-proofs-index-execute-parity
branch
from
October 16, 2026 04:23
1026bcd to
b561b8e
Compare
Contributor
|
This pr has been automatically marked as stale and will be closed in 5 days if no updates |
Builds one Cancun chain into three proofs stores, one indexed from reth's trie data, one re-executed by the engine and one initialized at the tip and backfilled, and compares the proof window, the hashed account and storage cursors, the account and storage trie cursors and an account proof per touched address at every block. Block content covers deploy then call, SSTORE to zero, CREATE plus SELFDESTRUCT in one transaction, SELFDESTRUCT of a pre-existing contract, an EIP-161 touch and a BLOCKHASH read, over both engine flush cadences and both store backends. Lifts SimulatedReth and the contract bytecode helpers out of the parent-state test into shared modules of the live test crate. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> (cherry picked from commit 9503b72) (cherry picked from commit 25e71cef99b5d49ad92de9bf5421b29faedc9c12)
Adds a snapshot-backfilled store so both backfill modes are compared, backfills in batches of three so a backfill commits more than once, and checks the chain length against the flush cadence instead of stating it. Reads each store's own account set instead of a union across stores, verifies proofs only on the reference store, and moves the store view and its comparison into a module of their own. Reuses RecoveredBlock::block_with_parent and TrieCursorIter, lets SimulatedReth spawn the engine and report state roots, and flattens the search for colliding keys. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> (cherry picked from commit b561b8e) (cherry picked from commit d78fb4ece0f34a998b976a47f39316dad6e678d2)
einar-oplabs
force-pushed
the
einar/23388-proofs-index-execute-parity
branch
from
November 9, 2026 22:30
b561b8e to
37687f1
Compare
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
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.
Builds one chain into four proofs stores, one indexed from reth's trie data, one re-executed by the engine and two initialized at the tip and backfilled, and asserts that they serve the same state at every block. The index and execute paths cross-check each other in the ExEx and nothing verified that they still agree on a self-destruct, a zeroed slot or an emptied account; this is the regression net for the storage-wipe removal (reth#26811) in the reth 2.6 bump (#23046).
What the test does
index_execute_and_backfill_stores_agreeinrust/op-reth/crates/trie/tests/live/index_execute_parity.rs:SimulatedReth(lifted out of the parent-state test intotests/live/simulated_reth.rs), so every block has theExecutedBlocktrie data reth's engine tree holds.EngineHandle::index_blockwith that block'strie_updatesandhashed_state, and the executed store throughEngineHandle::execute_block.proofs initdoes:InitializationJobat the tip, thenBackfillJob::run(history) andBackfillJob::run_with_snapshotback to genesis, in batches of three blocks so each backfill commits more than once.tests/live/store_view.rs): the proof window; the account hashed cursor over the whole key space; the storage hashed cursor and the storage trie cursor of every account the store holds and of every address the chain can touch; the account trie cursor; andProof::overlay_account_prooffor every address the chain can touch with the slots its contracts write. A mismatch fails naming the store, block, table and key. The indexed store's proofs are also verified against the header's state root, so four stores agreeing on the wrong state still fail.Matrix
rstestcases)BLOCKHASHread;CREATEplusSELFDESTRUCTin one transaction; deploy then call; EIP-161 touch;SELFDESTRUCTof a pre-existing contract;SSTOREto zeroInMemoryProofsStorage,MdbxProofsStorage24 cells, all run. The backfilled stores are always MDBX, the only backend that implements
OpProofsBackfillStore.Every chain is ten blocks: three empty blocks, the content, empty blocks to the end. The test asserts that ten is a multiple of the cadence's persistence threshold, so the final flush leaves nothing in the engine buffer, and multi-block content straddles the flush at block 5 under the slower cadence. The engine's buffer is not readable from outside the engine, so the cadence decides whether the execute path reads a block's parent from the buffer or from disk; the comparison runs over the persisted history once everything is flushed.
The chain is Cancun (the self-destruct cases need EIP-6780), with the EIP-4788 contract in genesis so every block also writes two slots of a pre-existing contract.
create_block_from_specnow fills the Shanghai and Cancun header fields when the chain spec has those forks active, and gives every block a timestamp; the existing Paris tests only see the timestamps.Trie depth
reth stores no branch node for a trie whose keys all differ in their first nibble, so the first draft of this test compared empty trie tables and had no removed node to corrupt. The slot writer's eight slots and the three EIP-161 genesis accounts are therefore chosen at runtime (
colliding_keys) so that three keys share their first hashed nibble and two of those also the second: filling them stores a branch node, and zeroing the first of the pair (or EIP-161 removing the empty account) removes it.Local verification
The 24 new cases take about 10 s of that.
just fmt-fixapplied;cargo clippy -p reth-optimism-trie --all-targetsreports only the three pre-existing warnings outside this diff. Therust-code-revieweragent's findings are addressed in the second commit.Corruption check (run locally with a temporary patch, not committed): dropping one removed trie node from the index side's
TrieUpdatesSortedfails the run withfor the
SSTOREto zero case (MDBX, every-block cadence) and withfor the EIP-161 case (in-memory, every-fifth-block cadence).
Notes on the issue text
SimulatedRethhashes the bundle state, like reth's engine does below five cores, so this test does not reach that code path; it covers the store's own handling of what reth hands it.Seams for later PRs
tests/live/simulated_reth.rs:SimulatedReth(now withspawn_engine,state_rootandpersist_all, andcommitreturning theExecutedBlock),RethPersistence,Location,fixed_signer.tests/live/store_view.rs:BlockView::readreads everything a store serves at one block;assert_same_viewnames the first differing table and key.tests/live/contracts.rs:initcode_returning, the block-hash recorder, the slot writer (parameterized slots, self-destruct on empty calldata) and the create-and-self-destruct initcode.live.rs:TxSpec::with_value,BlockSpec::empty,chain_spec_builderandfundedfor custom genesis allocations and forks,block_timestamp,PRUNE_INTERVAL_BLOCKS.Stacked on #23441, #23437, #23434, #23429, #23428, #23421 and #23418.
Closes #23388
🤖 Generated with Claude Code