fix(ecfinality): account for null rounds in chain walk#13565
Merged
Conversation
Include null round epochs as 0-block entries in the chain data fed to the FRC-0089 calculator, rather than silently skipping them. This aligns the implementation with the theoretical model where null rounds are epochs where the adversary gains ground while the honest chain doesn't grow. Also fixes a depth-to-height conversion problem which previously could return a shallower tipset than intended when null rounds were present between head and the finalized epoch. Increase BisectHigh from 200 to 450 to accommodate degraded chains where null round inclusion pushes the threshold deeper (notably current calibnet which is near 200).
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the EC finality chain-walk logic to include null rounds as explicit 0-block epochs so the FRC-0089 calculator operates over a true epoch timeline (and depth maps cleanly to height), and expands the bisect search range to handle more degraded chains.
Changes:
- Include null-round epochs as
0entries when walking back the chain (both inlotus-shed finality-calculatorand in the in-nodeECFinalityCache). - Increase
ecfinality.BisectHighfrom200to450and update related documentation/comments. - Update changelog and adjust test comments accordingly.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| cmd/lotus-shed/finality.go | Inserts 0-block epochs for null rounds during API chain walk; trims to fixed window and preserves epoch-to-depth correctness for output. |
| chain/ecfinality/cache.go | Updates cache chain walk to include null rounds as 0 entries so returned depth aligns with epoch height differences. |
| chain/ecfinality/calculator.go | Expands bisect search upper bound from 200 to 450. |
| chain/ecfinality/calculator_test.go | Updates test comment to reflect new BisectHigh. |
| CHANGELOG.md | Adds an UNRELEASED entry documenting the null-round handling fix and associated depth/height correction. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
hanabi1224
approved these changes
Mar 31, 2026
rjan90
approved these changes
Mar 31, 2026
rjan90
pushed a commit
that referenced
this pull request
Mar 31, 2026
Include null round epochs as 0-block entries in the chain data fed to the FRC-0089 calculator, rather than silently skipping them. This aligns the implementation with the theoretical model where null rounds are epochs where the adversary gains ground while the honest chain doesn't grow. Also fixes a depth-to-height conversion problem which previously could return a shallower tipset than intended when null rounds were present between head and the finalized epoch. Increase BisectHigh from 200 to 450 to accommodate degraded chains where null round inclusion pushes the threshold deeper (notably current calibnet which is near 200).
8 tasks
rjan90
pushed a commit
that referenced
this pull request
Mar 31, 2026
Include null round epochs as 0-block entries in the chain data fed to the FRC-0089 calculator, rather than silently skipping them. This aligns the implementation with the theoretical model where null rounds are epochs where the adversary gains ground while the honest chain doesn't grow. Also fixes a depth-to-height conversion problem which previously could return a shallower tipset than intended when null rounds were present between head and the finalized epoch. Increase BisectHigh from 200 to 450 to accommodate degraded chains where null round inclusion pushes the threshold deeper (notably current calibnet which is near 200).
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.
Include null round epochs as 0-block entries in the chain data fed to the FRC-0089 calculator, rather than silently skipping them. This aligns the implementation with the theoretical model where null rounds are epochs where the adversary gains ground while the honest chain doesn't grow. Also fixes a depth-to-height conversion problem which previously could return a shallower tipset than intended when null rounds were present between head and the finalized epoch.
Increase BisectHigh from 200 to 450 to accommodate degraded chains where null round inclusion pushes the threshold deeper (notably current calibnet which is near 200).
Thanks to @hanabi1224 for questioning the implementation on this point while doing ChainSafe/forest#6811, and @guy-goren for confirming that null's are statistically important to include.
Current mainnet shows no difference in the calculation because nulls are so rare, but the difference is ~5 epochs on calibnet where we're averaging 2.2 blocks per tipset and have a lot more null rounds.