Fix proposer canonical head stalling on catch-up chains#144
Merged
Conversation
After a long L2 finalized-head stall, the proposer can prune its cache down to the anchor game and rebuild the backlog as a genesis-rooted chain (parent = u32::MAX, since the contract reverts when a new game's parent is the current anchor). compute_canonical_head pinned the head to the root of that alternative chain instead of following it to the tip, so the canonical head could not advance and game creation stalled until the anchor caught up. Follow each qualifying alternative-chain root (genesis-rooted, or a lower parent index than the anchor head) to its highest-block tip. Extract the selection into ProposerState::select_canonical_head and cover it with unit tests.
Closed
3 tasks
piersy
reviewed
Jun 9, 2026
piersy
reviewed
Jun 9, 2026
Comment on lines
+235
to
+276
| fn select_canonical_head(&self) -> Option<Game> { | ||
| let Some(anchor_game) = self.anchor_game.as_ref() else { | ||
| return self.games.values().max_by_key(|g| g.l2_block).cloned(); | ||
| }; | ||
|
|
||
| let reachable = self.descendants_of(anchor_game.index); | ||
|
|
||
| // Best among the anchor's descendants. | ||
| let anchor_head = self | ||
| .games | ||
| .values() | ||
| .filter(|g| reachable.contains(&g.index)) | ||
| .max_by_key(|g| g.l2_block) | ||
| .cloned(); | ||
|
|
||
| // Override with a higher non-descendant chain that branches off earlier than the anchor | ||
| // head (genesis-rooted, or a lower parent index). Such a chain's root sits outside the | ||
| // anchor's subtree, so we follow each qualifying root to its own highest-block tip rather | ||
| // than stopping at the root — otherwise the head would pin to the root of a genesis-rooted | ||
| // catch-up chain and stall instead of tracking its tip. | ||
| let override_head = anchor_head.as_ref().and_then(|anchor| { | ||
| let roots: Vec<U256> = self | ||
| .games | ||
| .values() | ||
| .filter(|g| { | ||
| !reachable.contains(&g.index) && | ||
| g.l2_block > anchor.l2_block && | ||
| (g.parent_index == u32::MAX || g.parent_index < anchor.parent_index) | ||
| }) | ||
| .map(|g| g.index) | ||
| .collect(); | ||
|
|
||
| roots | ||
| .into_iter() | ||
| .flat_map(|root| self.descendants_of(root)) | ||
| .filter_map(|idx| self.games.get(&idx)) | ||
| .max_by_key(|g| g.l2_block) | ||
| .cloned() | ||
| }); | ||
|
|
||
| override_head.or(anchor_head) | ||
| } |
There was a problem hiding this comment.
I'd be inclined to keep this logic in it's original location because I think moving it will make upstream updates harder to merge.
Collaborator
Author
There was a problem hiding this comment.
Yeah, makes sense — so I opened the equivalent PR upstream: succinctlabs#926. If it doesn't get applied, or gets applied in a different way, I'll pull those changes into our fork to keep it consistent with upstream!
piersy
approved these changes
Jun 9, 2026
piersy
left a comment
There was a problem hiding this comment.
One suggestion on the organisation, otherwise looks good!
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
After a long L2 finalized-head stall exceeding the bond claiming window (e.g. 2h on Chaos, 7d on mainnet), the proposer can prune its cache down to just the anchor game and then rebuild the backlog as a fresh genesis-rooted chain. It uses
parent = u32::MAXfor these games because the contract reverts when a new game is initialized with the current anchor as its parent.compute_canonical_headtreated such an alternative chain's root as the head and never followed it to the tip, so the canonical head could not advance past the root and game creation stalled (~2h at a time on Chaos) until the anchor caught up — then the cycle repeated.Observed in Chaos network on 2026-06-04: after a ~12h finalized-head stall, the proposer repeatedly stalled while creating the backlog (games 10141–10146 so far), interleaved with
execution reverted(0x346119f7) on the attempts that tried to parent on the just-promoted anchor.Logs
Fix
Follow each qualifying alternative-chain root (genesis-rooted, or a lower parent index than the anchor head) to its highest-L2-block tip, instead of stopping at the root. The selection logic is extracted into
ProposerState::select_canonical_head, a pure function of the cached games and the anchor.Test plan
cargo test -p op-succinct-fp --lib— 51 passed (5 newcanonical_headunit tests: no-anchor, anchor subtree, and genesis / earlier-lineage catch-up chains followed to their tip)cargo clippy -p op-succinct-fp --lib --tests— clean