Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix canonical head selection #131

Merged
merged 1 commit into from
Sep 18, 2024
Merged

Conversation

pk910
Copy link
Member

@pk910 pk910 commented Sep 18, 2024

This fixes the canonical head selection.

there was a problem with the canonical head selection:
if the number of "fork heads" is less than 2, dora skips the head comparison and just uses the block with highest slot number as the canonical head.
that's great to save some cycles if everything works fine.. if there's only one fork detected, the best slot is just the one with the highest number 😉

unfortunately that breaks in some situations:
if there is a chain that forked off before the finalization checkpoint, dora doesn't recognize that chain as potentially canonical anymore. This is correct as the finalization of the canonical chain prevents the fork chain from ever finalizing in future.
This breaks the assumption I've made before that I can use the block with highest number if there is only one fork detected.

This PR fixes the canonical head selection, so dora always runs though the head comparison, even if there is only 1 fork detected.
The old code that uses the block with highest slot number is now the fallback that's used if no head block can be selected via the head comparison.

@pk910 pk910 merged commit db7786b into master Sep 18, 2024
1 check passed
@pk910 pk910 deleted the pk910/fix-canonical-head-selection branch September 18, 2024 13:53
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