Skip to content

hub: count blocks, not partials, toward the unlinkable limit - #64

Merged
sduchesneau merged 1 commit into
developfrom
fix/unlinkable-count-skips-non-final-flash-blocks
Aug 17, 2026
Merged

hub: count blocks, not partials, toward the unlinkable limit#64
sduchesneau merged 1 commit into
developfrom
fix/unlinkable-count-skips-non-final-flash-blocks

Conversation

@sduchesneau

Copy link
Copy Markdown
Contributor

hub.WithMaxConsecutiveUnlinkableBlocks names a number of blocks, but the counter was advanced by every message reaching ForkableHub.ProcessBlock.

A flash-block chain delivers one block as several partials, and each of them fails the same forkable.Linkable check for the same reason. So a hub configured for 5 gave up after 2 blocks on a chain sending 4 partials per block — the limit's meaning depended on how the chain chose to slice its blocks.

Intermediate partials (PartialIndex != 0 without LastPartial) no longer count. A plain block counts, a block's final partial counts, and any linkable block still resets the count, so the gap this exists to catch — one the one-block store can no longer bridge — is still reported, just per block.

The predicate is the one already guarding readiness a few lines above, extracted as isNonFinalPartial.

Covered by TestForkableHub_ProcessBlock_UnlinkableCountSkipsNonFinalFlashBlocks: 30 intermediate partials never trip it, final partials trip it after exactly the configured number of blocks with partials interleaved, plain blocks trip it, and a linkable block resets it. The first two subtests fail without the change.

Verified end to end against substreams tier1 (hub.WithMaxConsecutiveUnlinkableBlocks(5)) with a workspace replace: the tests_e2e partial-block suite and the full suite both pass.

🤖 Generated with Claude Code

WithMaxConsecutiveUnlinkableBlocks names a number of blocks, but the counter was
advanced by every message. A flash-block chain delivers one block as several
partials that all fail the same link check, so a hub configured for 5 gave up
after 2 blocks. Intermediate partials no longer count; a plain block and a
block's final partial do.

@UlysseCorbeil UlysseCorbeil left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

lgtm

@sduchesneau
sduchesneau merged commit bc44597 into develop Aug 17, 2026
1 of 3 checks passed
@sduchesneau
sduchesneau deleted the fix/unlinkable-count-skips-non-final-flash-blocks branch August 17, 2026 16:00
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