-
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
Fix test generator duplicate key issue #2651
Conversation
c244174
to
7a7ab81
Compare
…committee indices
|
||
yield 'pre', state | ||
|
||
block = build_empty_block_for_next_slot(spec, state) | ||
block.body.sync_aggregate = spec.SyncAggregate( | ||
sync_committee_bits=[index in participants for index in committee], |
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.
The previous sync_committee_bits
would be incorrect if there are duplicate indices in committee.
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.
Previously
if committee = [1, 2, 3, 1]
participants = [2, 1]
<— that means the the 2nd and 4th items were selected, not 1st+2nd+4th
sync_committee_bits=[index in participants for index in committee]
would be return [True, True, False, True]
The aggregate signature from compute_aggregate_sync_committee_signature
would only include the 2nd sig once + 4th sig once rather than the duplicate sigs.
This fix
The new fix generates the correct sync_committee_bits
first and then calculate the corresponding participants
.
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.
ah! great catch! left some feedback
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.
nice work! some minor feedback above
Fix #2650
Issue
We have key conflicts in the
genesis
andsanity
test generators.consensus-specs/tests/generators/genesis/main.py
Lines 6 to 15 in fea3702
consensus-specs/tests/generators/sanity/main.py
Lines 10 to 15 in fea3702
In these test generators, the handler names were conflicting. Thus it did NOT generate the test vectors of the newer file.
How did I fix it
Add
combine_mods
helper to deal with the test sources.merge_mods
, but you know, too confusing.TODO
sanity
tests:Update: fixed in 4ae8fb1