Repository navigation
Conversation
The cold-start reset kept an unsafe head whenever its L1 origin could be fetched by hash. An L1 node serves a block by hash after a reorg replaces it at the same height, so an unsafe head built on a replaced L1 block survived a cold start. find_starting_forkchoice and the L1-reorg reset now share one walk: it checks each origin by number, checks a replaced origin once, and never walks past a floor, the finalized head on a cold start and the kept safe head on an L1 reorg. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Author
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.
Stacked on #23634; review that first. This PR targets its branch, and GitHub retargets it to
developwhen #23634 merges. It is independent of #23652.kona-node's cold-start reset no longer keeps an unsafe head built on a reorged-out L1 block.
find_starting_forkchoicekept the unsafe head wheneverget_l1_block(origin.hash)returned a block. That proves only that the block exists. L1 nodes keep serving a block by hash after a reorg replaces it at the same height. So an unsafe head built on a replaced L1 block survived a cold start, even though it could never become safe. It stayed until derivation replaced it, and on a sequencer it was built on further.The cold start and #23634's L1-reorg reset now share one walk,
find_canonical_unsafe_head. It checks each L1 origin by number, so an origin counts as canonical only if the L1 node has that block at that height. It checks a replaced origin once, and fetches only the blocks built on replaced origins. It also never walks past a floor:The chain just above the floor must link to it by parent hash. If it doesn't, the walk fails with the new
SyncStartError::UnsafeChainMismatch. An unsafe head below the floor fails with the newUnsafeHeadBelowFloor, which names both heights. On a cold start both are fatal, like the existingBlockNotFound. On the reorg path all three fall back to the full reset, as before.Behaviour change on cold start
FindL2HeadsReorgFinalizedErrThe middle row is unchanged in kona, and still differs from op-node. Walking back costs only unsafe blocks, which are fetched again. Keeping them would mean a sequencer could build on an L1 block its L1 node has not seen. Whether to match op-node is a separate decision.
Effect on operators
UnsafeChainMismatch, as op-node's does withReorgFinalizedErr. Before, kona sent a forkchoice update the execution client rejected, and retried it forever.FinalizedAheadOfUnsafe). It now fails before any L1 lookup, withUnsafeHeadBelowFloor.Tests. The cold-start tests cover:
Under the old by-hash rule, the replaced-at-the-same-height case fails. The real-chain fixture moves to
kona_engine::test_utilsasTestChain. That lets the engine-actor recovery test give the cold start an unsafe head above finalized, so its L1-outage case still reaches L1. With the new floor, an unsafe head equal to finalized makes no L1 call.Review.
rust-code-reviewerran on the change. It found the finalized floor matches op-node and breaks no cold start that worked before. Its findings are applied: a dedicated error for an unsafe head below finalized, tests for the failure modes, aTestChainfixture, named error fields, and a wider sequencing window in the recovery test, so it no longer depends on kona promoting unsafe blocks to safe. Dismissed: the genesis-fallback floor is not tested separately, because that code is unchanged and only picks the floor. The unusedMismatchedFinalizedBlockvariant stays, since removing it changes the crate's public API.🤖 Generated with Claude Code