Skip to content

Commit

Permalink
fix: attestation duty validation (ChainSafe#6792)
Browse files Browse the repository at this point in the history
* fix attestation duty validation

* Update packages/validator/src/services/validatorStore.ts

Co-authored-by: twoeths <tuyen@chainsafe.io>

* Update packages/validator/src/services/validatorStore.ts

---------

Co-authored-by: twoeths <tuyen@chainsafe.io>
Co-authored-by: Cayman <caymannava@gmail.com>
  • Loading branch information
3 people authored and g11tech committed Jun 19, 2024
1 parent cb6b706 commit 81b993a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion packages/validator/src/services/validatorStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -795,11 +795,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}`);
}
Expand Down

0 comments on commit 81b993a

Please sign in to comment.