mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-07 22:54:17 -05:00
Guard against no attesters within committee in VerifyAttestationNoVerifySignature (#15169)
* Guard against no attesters within committee in `VerifyAttestationNoVerifySignature` * changelog fragment
This commit is contained in:
@@ -111,7 +111,7 @@ func AttestingIndices(att ethpb.Att, committees ...[]primitives.ValidatorIndex)
|
||||
|
||||
attesters := make([]uint64, 0, aggBits.Count())
|
||||
committeeOffset := 0
|
||||
for _, c := range committees {
|
||||
for ci, c := range committees {
|
||||
committeeAttesters := make([]uint64, 0, len(c))
|
||||
for i, vi := range c {
|
||||
if aggBits.BitAt(uint64(committeeOffset + i)) {
|
||||
@@ -119,7 +119,7 @@ func AttestingIndices(att ethpb.Att, committees ...[]primitives.ValidatorIndex)
|
||||
}
|
||||
}
|
||||
if len(committeeAttesters) == 0 {
|
||||
return nil, fmt.Errorf("no attesting indices found in committee %v", c)
|
||||
return nil, fmt.Errorf("no attesting indices found for committee index %d", ci)
|
||||
}
|
||||
attesters = append(attesters, committeeAttesters...)
|
||||
committeeOffset += len(c)
|
||||
|
||||
@@ -81,6 +81,14 @@ func TestAttestingIndices(t *testing.T) {
|
||||
},
|
||||
want: []uint64{0, 1},
|
||||
},
|
||||
{
|
||||
name: "Electra - No attester in committee",
|
||||
args: args{
|
||||
att: ð.AttestationElectra{AggregationBits: bitfield.Bitlist{0b11100}},
|
||||
committees: [][]primitives.ValidatorIndex{{0, 1}, {0, 1}},
|
||||
},
|
||||
err: "no attesting indices found for committee index 0",
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user