From 064613628b866331cd7142013dacdb421739ae01 Mon Sep 17 00:00:00 2001 From: NC Date: Thu, 16 May 2024 15:11:37 +0300 Subject: [PATCH] fix: attestation duty validation (#6792) * fix attestation duty validation * Update packages/validator/src/services/validatorStore.ts Co-authored-by: twoeths * Update packages/validator/src/services/validatorStore.ts --------- Co-authored-by: twoeths Co-authored-by: Cayman --- packages/validator/src/services/validatorStore.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/validator/src/services/validatorStore.ts b/packages/validator/src/services/validatorStore.ts index 6c6870acfe4e..d0ed2d8efdbf 100644 --- a/packages/validator/src/services/validatorStore.ts +++ b/packages/validator/src/services/validatorStore.ts @@ -798,11 +798,18 @@ export class ValidatorStore { if (duty.slot !== data.slot) { throw Error(`Inconsistent duties during signing: duty.slot ${duty.slot} != att.slot ${data.slot}`); } - if (duty.committeeIndex != data.index) { + + const isAfterElectra = computeEpochAtSlot(duty.slot) >= this.config.ELECTRA_FORK_EPOCH; + if (!isAfterElectra && duty.committeeIndex != data.index) { throw Error( `Inconsistent duties during signing: duty.committeeIndex ${duty.committeeIndex} != att.committeeIndex ${data.index}` ); } + if (isAfterElectra && data.index !== 0) { + throw Error( + `Non-zero committee index post-electra during signing: att.committeeIndex ${data.index}` + ); + } if (this.config.getForkSeq(duty.slot) >= ForkSeq.electra && data.index !== 0) { throw Error(`Attestataion data index must be 0 post electra: index ${data.index}`); }