Skip to content

Commit

Permalink
Fix aggregation bit check
Browse files Browse the repository at this point in the history
  • Loading branch information
ensi321 committed Dec 2, 2024
1 parent eb95bf3 commit efbc515
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,15 +105,15 @@ export function validateAttestation(fork: ForkSeq, state: CachedBeaconStateAllFo

// Total number of attestation participants of every committee specified
let committeeOffset = 0;
for (const committee of validatorsByCommittee) {
const committeeAggregationBits = aggregationBitsArray.slice(committeeOffset, committee.length);
for (const committeeValidators of validatorsByCommittee) {
const committeeAggregationBits = aggregationBitsArray.slice(committeeOffset, committeeOffset + committeeValidators.length);

// Assert aggregation bits in this committee have at least one true bit
if (committeeAggregationBits.every((bit) => !bit)) {
throw new Error("Every committee in aggregation bits must have at least one attester");
}

committeeOffset += committee.length;
committeeOffset += committeeValidators.length;
}

// Bitfield length matches total number of participants
Expand Down

0 comments on commit efbc515

Please sign in to comment.