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.
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.