diff --git a/beacon-chain/core/helpers/attestation.go b/beacon-chain/core/helpers/attestation.go index e896404956..af153f8faf 100644 --- a/beacon-chain/core/helpers/attestation.go +++ b/beacon-chain/core/helpers/attestation.go @@ -12,7 +12,6 @@ import ( ethpb "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1" prysmTime "github.com/prysmaticlabs/prysm/v5/time" "github.com/prysmaticlabs/prysm/v5/time/slots" - log "github.com/sirupsen/logrus" ) var ( @@ -133,9 +132,6 @@ func ComputeSubnetFromCommitteeAndSlot(activeValCount uint64, comIdx primitives. // // In the attestation must be within the range of 95 to 102 in the example above. func ValidateAttestationTime(attSlot primitives.Slot, genesisTime time.Time, clockDisparity time.Duration) error { - if err := slots.ValidateClock(attSlot, uint64(genesisTime.Unix())); err != nil { - return err - } attTime, err := slots.ToTime(uint64(genesisTime.Unix()), attSlot) if err != nil { return err @@ -182,24 +178,15 @@ func ValidateAttestationTime(attSlot primitives.Slot, genesisTime time.Time, clo } // EIP-7045: Starting in Deneb, allow any attestations from the current or previous epoch. - currentEpoch := slots.ToEpoch(currentSlot) - prevEpoch, err := currentEpoch.SafeSub(1) - if err != nil { - log.WithError(err).Debug("Ignoring underflow for a deneb attestation inclusion check in epoch 0") - prevEpoch = 0 - } - attSlotEpoch := slots.ToEpoch(attSlot) - if attSlotEpoch != currentEpoch && attSlotEpoch != prevEpoch { + if attEpoch+1 < currentEpoch { attError = fmt.Errorf( - "attestation epoch %d not within current epoch %d or previous epoch %d", - attSlot/params.BeaconConfig().SlotsPerEpoch, + "attestation epoch %d not within current epoch %d or previous epoch", + attEpoch, currentEpoch, - prevEpoch, ) return errors.Join(ErrTooLate, attError) } - return nil } diff --git a/beacon-chain/core/helpers/attestation_test.go b/beacon-chain/core/helpers/attestation_test.go index 66104e988e..5c3a34a508 100644 --- a/beacon-chain/core/helpers/attestation_test.go +++ b/beacon-chain/core/helpers/attestation_test.go @@ -197,7 +197,7 @@ func Test_ValidateAttestationTime(t *testing.T) { -500 * time.Duration(params.BeaconConfig().SecondsPerSlot) * time.Second, ).Add(200 * time.Millisecond), }, - wantedErr: "attestation epoch 8 not within current epoch 15 or previous epoch 14", + wantedErr: "attestation epoch 8 not within current epoch 15 or previous epoch", }, { name: "attestation.slot is well beyond current slot", @@ -205,7 +205,7 @@ func Test_ValidateAttestationTime(t *testing.T) { attSlot: 1 << 32, genesisTime: prysmTime.Now().Add(-15 * time.Duration(params.BeaconConfig().SecondsPerSlot) * time.Second), }, - wantedErr: "which exceeds max allowed value relative to the local clock", + wantedErr: "attestation slot 4294967296 not within attestation propagation range of 0 to 15 (current slot)", }, } for _, tt := range tests {