-
Notifications
You must be signed in to change notification settings - Fork 1k
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
test: Cover signature_slot tiebreaker in is_better_update #4124
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks reasonable to me, but I'm not super familiar with light client stuff either. I would appreciate @etan-status' opinion on this change before merging.
The relevant tiebreaker (the final return statement). I might suggest adding a "Tiebreaker 3: ..." comment too.
consensus-specs/specs/altair/light-client/sync-protocol.md
Lines 272 to 275 in 007e2c9
# Tiebreaker 2: Prefer older data (fewer changes to best) | |
if new_update.attested_header.beacon.slot != old_update.attested_header.beacon.slot: | |
return new_update.attested_header.beacon.slot < old_update.attested_header.beacon.slot | |
return new_update.signature_slot < old_update.signature_slot |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for catching this, having the additional test coverage is useful. 🔥
This comment has been minimized.
This comment has been minimized.
6d8c689
to
ea74634
Compare
Done! Pushed an update that may need a reapproval. Thank you 🙏 |
Thank you for your reviews @jtraglia and @etan-status I have addressed your review comments |
Add `signature_slot` comparison to `is_better_update` LC data comparator for robustness in edge cases, and sync style with latest specs. - ethereum/consensus-specs#4124
Add `signature_slot` comparison to `is_better_update` LC data comparator for robustness in edge cases, and sync style with latest specs. - ethereum/consensus-specs#4124
The is_better_update function has a final tiebreaker that compares signature_slots when all other fields (participation, finality, etc.) are equal. This branch was previously uncovered because test updates always had equal slots.
This change adds a test case with a higher signature_slot to an otherwise identical update, ensuring we test the final return statement where earlier signature_slots are preferred.
The change is minimal and leverages existing test infrastructure by adding one additional update to create_test_update quality-ordered list.