Skip to content

Clamp LibNum to Number to stop forkable stalling permanently - #81

Merged
sduchesneau merged 1 commit into
developfrom
feature/forkable--guard-libnum---number-stall
Oct 9, 2026
Merged

sduchesneau merged 1 commit into
developfrom
feature/forkable--guard-libnum---number-stall

Conversation

@maoueh

@maoueh maoueh commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

Summary

  • A reader bug can announce a block's LIB num higher than its own num (seen on sol-devnet: block 774 with LibNum 775). BlockInCurrentChain resolves 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. MoveLIB stores that mismatched ref, and every later ReversibleSegment walk 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.ProcessBlock now clamps a block's LibNum down to its own Number on entry (logs an error), instead of trying to special-case every LIB consumer downstream.
  • Wording, log fields (block_num/block_id/original_lib_num) and test shape match utils.ClampLibNum in 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.

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.
@dfuse-bot
dfuse-bot requested a review from sduchesneau October 8, 2026 22:10

@sduchesneau sduchesneau left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I 100% agree with this fix

@sduchesneau
sduchesneau merged commit f9cf38c into develop Oct 9, 2026
3 checks passed
@sduchesneau
sduchesneau deleted the feature/forkable--guard-libnum---number-stall branch October 9, 2026 02:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants