Repository navigation
op-reth,op-reth-test-engine: Fail pending and test engine state when opened, not on first read - #24069
Open
aakoshh wants to merge 11 commits into
Open
op-reth,op-reth-test-engine: Fail pending and test engine state when opened, not on first read#24069aakoshh wants to merge 11 commits into
aakoshh wants to merge 11 commits into
Conversation
Callers of local_pending_state treat an error as "no pending block" and serve latest, so a pending state source has to fail before it returns. The speculative branch did, in history_by_block_hash. The canonical branch didn't: reth's overlay resolves the anchor on its first read, so a reorged-out or evicted anchor surfaced later as an RPC error instead. Check the anchor before opening the overlay, so both branches fall back the same way. Log at debug when the pending state can't be opened, since the fallback otherwise leaves no trace that a pending block existed.
Both branches of pending_flashblock_state must fail before any state is read when the provider doesn't know the anchor, so that the caller falls back to latest instead of failing the RPC on its first read. Without the anchor check, the canonical case returns an overlay that only fails later, when it is read.
The destroyed account in the pending state test came from the mainnet genesis, whose first account has no storage, so a regression that read a destroyed account's slots from the anchor would have passed. Use a genesis account with a storage slot and check that it reads zero. Also split out the speculative check and assert it per case, so the test fails if a case is served by the other overlay.
… resolve The provider resolves a recorded block's ancestors lazily, so a recorded ancestor missing from the shared overlay manager only fails the first state read. During import that read is a system call, whose errors alloy-evm reports as validation failures, so the payload comes back INVALID instead of as an error.
…g on it block_state now reads the state once after opening it, so an ancestor the provider can't resolve fails there as a provider error. Before, the failure surfaced in the first system call of the import, which alloy-evm reports as a validation error, so the payload came back INVALID.
aakoshh
force-pushed
the
af/23404-review-followups
branch
from
November 12, 2026 16:41
a4cbee9 to
6e9132a
Compare
This branch has not been deployed
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.
Addresses the optional review comments left open on #24024 when it was enqueued, and fixes a test engine bug that the review of these changes found.
What
pendingstate query on a flashblocks node now falls back to latest state when the flashblock's anchor is no longer canonical, for example after a reorg. Before, a tip built on the anchor returned an overlay that only failed on its first read, soeth_call pendingand similar queries returned an error. A speculative tip already fell back. Both cases now log the fallback at debug.op-reth-test-engine, a recorded block whose ancestors the provider can't resolve now fails an import as an error. Before, it came back as an INVALID payload, which points whoever debugs the test at the payload instead of the engine.local_pending_state, andget_proof's pending safety note, which relied on reth never setting a canonical pending block. The engine tree sets one whenever a payload extends the head.Why
reth's
state_with_block_appendedresolves the chain it appends to lazily, on the first read, so it returnsOkfor an anchor or ancestor it can't resolve. Since #24024 both callers depend on it failing when opened:How
Both now fail when the state is opened. The pending state code checks the anchor with the guard
history_by_block_hashruns in the speculative branch. The test engine'sblock_statereads the state once, which makes reth resolve and cache the chain for the later reads.Caveats
get_proofstill resolves the state inside its blocking task, so it relies on the proofs window rejectingpending. After a reorg to a shorter chain, until the proofs ExEx reverts,window.latestcan be past the head, and a pending block could pass that check.Alternatives
LoadPendingBlock::local_pending_block_or_stateto returnPendingStateSource::Blockfor a tip on the anchor, as suggested on rust!: Update reth to v2.7.0 #24024, would save one blocking-task hop per pending query. We kept the single override:Blocksource with the same lazystate_with_block_appended, so itsor_elsefallback doesn't fire for an anchor that is gone. Checking the anchor first would need a synchronous read on the async runtime, or a second blocking task again.state_at_block_idcallslocal_pending_statedirectly, so both methods would need overriding, and the speculative branch stays either way.Potential follow-ups
local_pending_block_or_stateoverride once op-reth: Fold the speculative flashblock chain through reth's overlay manager #24062 lets reth fold the whole speculative chain.get_proof's state before taking the blocking thread, as upstream does, so it no longer depends on the window check.🤖 Generated with Claude Code