From a60501a0cf1dad3dc60fb1bee93bb7267a27fbf2 Mon Sep 17 00:00:00 2001 From: NC Date: Thu, 16 May 2024 12:53:29 +0300 Subject: [PATCH] fix: publish attestations with non-zero committee index (#6790) Fix publishing att with non-zero comm index --- packages/validator/src/services/attestation.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/validator/src/services/attestation.ts b/packages/validator/src/services/attestation.ts index 8f5228e3a10e..7be2c74cd21d 100644 --- a/packages/validator/src/services/attestation.ts +++ b/packages/validator/src/services/attestation.ts @@ -148,12 +148,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); }) ); @@ -184,10 +185,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};