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
Return error on AttestingIndices
bitfield length check
#8285
Conversation
@@ -65,14 +68,17 @@ func ConvertToIndexed(ctx context.Context, attestation *ethpb.Attestation, commi | |||
// """ | |||
// committee = get_beacon_committee(state, data.slot, data.index) | |||
// return set(index for i, index in enumerate(committee) if bits[i]) | |||
func AttestingIndices(bf bitfield.Bitfield, committee []uint64) []uint64 { | |||
func AttestingIndices(bf bitfield.Bitfield, committee []uint64) ([]uint64, error) { | |||
if bf.Len() > uint64(len(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.
This should return an error if they are not equal.
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.
True
…rysm into return-err-committee-len
|
Codecov Report
@@ Coverage Diff @@
## develop #8285 +/- ##
==========================================
Coverage ? 57.09%
==========================================
Files ? 449
Lines ? 31419
Branches ? 0
==========================================
Hits ? 17940
Misses ? 10689
Partials ? 2790 |
What type of PR is this?
What does this PR do? Why is it needed?
Return error if attestation's bitfield length is greater than the committee length. This hardens and brings the defensive against invalid bitflied into the helper level
Which issues(s) does this PR fix?
N/A
Other notes for review
N/A