Guard against no attesters within committee in VerifyAttestationNoVerifySignature (#15169)

* Guard against no attesters within committee in `VerifyAttestationNoVerifySignature`

* changelog fragment
This commit is contained in:
Radosław Kapka
2025-04-14 16:46:38 +02:00
committed by GitHub
parent cd87082f25
commit 6180b5a560
5 changed files with 52 additions and 8 deletions

View File

@@ -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)

View File

@@ -81,6 +81,14 @@ func TestAttestingIndices(t *testing.T) {
},
want: []uint64{0, 1},
},
{
name: "Electra - No attester in committee",
args: args{
att: &eth.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) {