Repository navigation
fix(proofs-history): answer near-head blocks and run proofs off async workers - #187
Closed
ivanwang-coder wants to merge 1 commit into
Closed
ivanwang-coder wants to merge 1 commit into
ivanwang-coder wants to merge 1 commit into
Conversation
… workers The proofs engine writes to the sidecar in batches, so the newest blocks failed with `no state found`. Answer a canonical block above the window and within 64 blocks of the head from reth's own state; the lower bound stays strict. - Run the sidecar eth_getProof on a blocking IO task and debug_executionWitness on a blocking task, instead of async runtime workers. - Seed the test sidecar with the real genesis anchor so tests can mine blocks. - Check that block 0 is served once it is no longer the tip, which only the sidecar override can do, and that blocks not yet in the sidecar are served.
Author
|
Closing: Mantle's proof consumers (op-succinct, the bridge) only query explicit deep blocks, so none of these changes is needed for v1.7.0; the off-worker |
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.
Summary
Fixes three proofs-history problems on
dev/mantle-v1.7.0, all found while reviewing #181:no state found.eth_getProofis the one serving requests.eth_getProofanddebug_executionWitnesswalked the trie, and re-executed the block, directly on tokio worker threads.Production proof nodes run
mantle-v1.6.2, which has no proofs engine, so none of this triggers today. It triggers once proof nodes move to v1.6.3 / v1.7.x and serve clients that ask for recent state. For example, if publiceth_getProofis routed to proof reths, wallets and bridges querylatestand blocks that have just arrived.Changes
Near-head fallback (
op-reth/crates/rpc/src/state.rs)OpStateProviderFactory::state_providernow answers a block from reth's own state when all of these hold:NEAR_HEAD_FALLBACK_BLOCKS(64) of the head.eth_getProof,debug_executePayloadanddebug_executionWitness.Off-worker proofs (
eth/proofs.rs,debug.rs)eth_getProofnow runs onspawn_blocking_io_fut, the same pattern as stock reth and the Mantlerpc-extoverride. The tracing permit is still held for the whole call.debug_executionWitnessnow runs its re-execution and witness on a blocking task, asdebug_executePayloadalready did.Test harness and tests (
integration-tests)seed_proofs_sidecaranchors the sidecar at the real genesis number and hash.proofs_history_wiring_serves_sidecar_rpc:if earliest > 0, which never held, so the step never ran.eth_getProofrefuse it with-32602.proofs_history_answers_blocks_not_yet_in_the_sidecar:latest = 0.eth_getProofatlatestand0x1succeed, and so doesdebug_executionWitnessfor0x1.Verification
Each new test fails when the fix it covers is reverted:
no state found for block number 1, the production symptomParent hash mismatch at block 1; both block-mining tests fail-32602 distance to target block exceeds maximum proof windowLocal devnet: the PR's release binary was run in the proofs-history slot, with the same flags as production proof nodes (window 100000, storage v2). 300 random
latestqueries were sent, plus 30 queries of each new block as soon as it appeared:latestfailuresno state found.eth_getProofdifferences remain. Before this PR there were 15–18. The only real differences left are the 4eth_getBlockRangecases, because the comparison node runs v1.6.3 and fix(rpc): enable Mantle mainnet historical forwarding #144 retired the method.Checks:
cargo test -p reth-optimism-rpc --lib: 63 passed.cargo nextest run -p mantle-reth-integration-tests --tests proofs_history historical_rpc get_proof: 6 passed.cargo clippy --workspace --lib --examples --tests --benches --all-features -- -D warnings: clean.cargo +nightly fmt --all: clean.Relation to upstream op-reth
ethereum-optimism/optimismdevelop)[MANTLE]. It only covers blocks above the window and within 64 of the head, so it never reaches the deep historical path behind the OOMs that ethereum-optimism/optimism#19855 removed. Re-apply on the next bump, which rewritesstate.rseth_getProofon async workersspawn_blocking_io_fut, with the window checked before taking the permitdebug_executionWitnesson async workerseth_getProofoverride to order against)