Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Nico Flaig <nflaig@protonmail.com>
  • Loading branch information
ensi321 and nflaig committed Dec 2, 2024
1 parent fc36c2f commit c0908a6
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,14 @@ export function validateAttestation(fork: ForkSeq, state: CachedBeaconStateAllFo
const validatorsByCommittee = epochCtx.getBeaconCommittees(data.slot, committeeIndices);
const aggregationBitsArray = attestationElectra.aggregationBits.toBoolArray();

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

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

committeeOffset += committee.length;
Expand All @@ -120,7 +120,7 @@ export function validateAttestation(fork: ForkSeq, state: CachedBeaconStateAllFo
assert.equal(
attestationElectra.aggregationBits.bitLen,
committeeOffset,
`Attestation aggregation bits length does not match total number of committee participant aggregationBitsLength=${attestation.aggregationBits.bitLen} participantCount=${committeeOffset}`
`Attestation aggregation bits length does not match total number of committee participants aggregationBitsLength=${attestation.aggregationBits.bitLen} participantCount=${committeeOffset}`
);
} else {
if (!(data.index < committeeCount)) {
Expand Down

0 comments on commit c0908a6

Please sign in to comment.