Skip to content

Commit

Permalink
fix: publish attestations with non-zero committee index (#6790)
Browse files Browse the repository at this point in the history
Fix publishing att with non-zero comm index
  • Loading branch information
ensi321 authored and philknows committed Sep 3, 2024
1 parent 4da471a commit c150d87
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/validator/src/services/attestation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,12 +159,13 @@ export class AttestationService {
this.metrics?.attesterStepCallProduceAggregate.observe(this.clock.secFromSlot(slot + 2 / 3));

const dutiesByCommitteeIndex = groupAttDutiesByCommitteeIndex(dutiesAll);
const isAfterElectra = computeEpochAtSlot(slot) >= this.config.ELECTRA_FORK_EPOCH;

// Then download, sign and publish a `SignedAggregateAndProof` for each
// validator that is elected to aggregate for this `slot` and `committeeIndex`.
await Promise.all(
Array.from(dutiesByCommitteeIndex.entries()).map(([index, dutiesSameCommittee]) => {
const attestationData: phase0.AttestationData = {...attestationNoCommittee, index};
const attestationData: phase0.AttestationData = {...attestationNoCommittee, index: isAfterElectra ? 0 : index};
return this.produceAndPublishAggregates(attestationData, index, dutiesSameCommittee);
})
);
Expand Down Expand Up @@ -195,10 +196,11 @@ export class AttestationService {
const signedAttestations: phase0.Attestation[] = [];
const headRootHex = toHexString(attestationNoCommittee.beaconBlockRoot);
const currentEpoch = computeEpochAtSlot(slot);
const isAfterElectra = currentEpoch >= this.config.ELECTRA_FORK_EPOCH;

await Promise.all(
duties.map(async ({duty}) => {
const index = duty.committeeIndex;
const index = isAfterElectra ? 0 : duty.committeeIndex;
const attestationData: phase0.AttestationData = {...attestationNoCommittee, index};
const logCtxValidator = {slot, index, head: headRootHex, validatorIndex: duty.validatorIndex};

Expand Down

0 comments on commit c150d87

Please sign in to comment.