Repository navigation
Clamp LibNum to Number to stop forkable stalling permanently - #81
Merged
sduchesneau merged 1 commit intoOct 9, 2026
Merged
Conversation
A reader bug can announce a block's LIB num higher than its own num (sol-devnet incident: block 774 with LibNum 775). BlockInCurrentChain resolves LIB by walking parent links by number only, so a too-high LibNum makes it return a ref pairing an unrelated block ID with that num; MoveLIB stores it, and every later ReversibleSegment walk then bails out before ever reaching the stored ID, silently freezing the forkable's head forever while it keeps linking incoming blocks. Clamp the block's LibNum down to its own Number on entry and log an error, mirroring utils.ClampLibNum in firehose-core (streamingfast/firehose-core#284) for symmetry across both defenses.
sduchesneau
approved these changes
Oct 9, 2026
sduchesneau
left a comment
Contributor
There was a problem hiding this comment.
I 100% agree with this fix
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
BlockInCurrentChainresolves a LIB purely by walking parent links by number, so a too-high LIB num makes it return a ref pairing an unrelated block ID with that num.MoveLIBstores that mismatched ref, and every laterReversibleSegmentwalk then bails out as soon as it sees a real block num below that fake LIB num — without ever reaching the stored ID — silently freezing the forkable's head forever while it keeps linking incoming blocks (healthz stays green, nothing is ever emitted again).Forkable.ProcessBlocknow clamps a block'sLibNumdown to its ownNumberon entry (logs an error), instead of trying to special-case every LIB consumer downstream.block_num/block_id/original_lib_num) and test shape matchutils.ClampLibNumin firehose-core (Clamp invalid lib_num in the console reader path, always on firehose-core#284), the reader-side guard for the same invariant, for symmetry across both defenses.