diff --git a/beacon-chain/blockchain/service.go b/beacon-chain/blockchain/service.go index f07739be4..b3e5314dd 100644 --- a/beacon-chain/blockchain/service.go +++ b/beacon-chain/blockchain/service.go @@ -8,8 +8,6 @@ import ( "fmt" "time" - "github.com/prysmaticlabs/prysm/shared/hashutil" - "github.com/ethereum/go-ethereum/common" gethTypes "github.com/ethereum/go-ethereum/core/types" b "github.com/prysmaticlabs/prysm/beacon-chain/core/blocks" @@ -18,6 +16,7 @@ import ( "github.com/prysmaticlabs/prysm/beacon-chain/powchain" pb "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1" "github.com/prysmaticlabs/prysm/shared/event" + "github.com/prysmaticlabs/prysm/shared/hashutil" "github.com/prysmaticlabs/prysm/shared/params" "github.com/sirupsen/logrus" ) diff --git a/beacon-chain/core/blocks/block_operations.go b/beacon-chain/core/blocks/block_operations.go index bdb3bef59..324dc600d 100644 --- a/beacon-chain/core/blocks/block_operations.go +++ b/beacon-chain/core/blocks/block_operations.go @@ -373,8 +373,8 @@ func isSurroundVote(data1 *pb.AttestationData, data2 *pb.AttestationData) bool { // Verify that len(block.body.attestations) <= MAX_ATTESTATIONS. // // For each attestation in block.body.attestations: -// Verify that attestation.data.slot <= state.slot - MIN_ATTESTATION_INCLUSION_DELAY < -// attestation.data.slot + SLOTS_PER_EPOCH. +// Verify that `attestation.data.slot + MIN_ATTESTATION_INCLUSION_DELAY <= state.slot`. +// Verify that `state.slot < attestation.data.slot + SLOTS_PER_EPOCH. // Verify that attestation.data.justified_epoch is equal to state.justified_epoch // if attestation.data.slot >= get_epoch_start_slot(get_current_epoch(state)) else state.previous_justified_epoch. // Verify that attestation.data.justified_block_root is equal to @@ -424,7 +424,7 @@ func verifyAttestation(beaconState *pb.BeaconState, att *pb.Attestation, verifyS beaconState.Slot-params.BeaconConfig().GenesisSlot, ) } - if att.Data.Slot+params.BeaconConfig().SlotsPerEpoch < beaconState.Slot { + if att.Data.Slot+params.BeaconConfig().SlotsPerEpoch <= beaconState.Slot { return fmt.Errorf( "attestation slot (slot %d) + epoch length (%d) less than current beacon state slot (%d)", att.Data.Slot-params.BeaconConfig().GenesisSlot, diff --git a/beacon-chain/core/blocks/block_operations_test.go b/beacon-chain/core/blocks/block_operations_test.go index 19b89fadd..ee69a6987 100644 --- a/beacon-chain/core/blocks/block_operations_test.go +++ b/beacon-chain/core/blocks/block_operations_test.go @@ -790,7 +790,7 @@ func TestProcessBlockAttestations_PreviousJustifiedEpochVerificationFailure(t *t attestations := []*pb.Attestation{ { Data: &pb.AttestationData{ - Slot: params.BeaconConfig().SlotsPerEpoch, + Slot: params.BeaconConfig().SlotsPerEpoch + 1, JustifiedEpoch: 3, }, }, @@ -801,7 +801,7 @@ func TestProcessBlockAttestations_PreviousJustifiedEpochVerificationFailure(t *t }, } state := &pb.BeaconState{ - Slot: params.BeaconConfig().SlotsPerEpoch * 2, + Slot: 2 * params.BeaconConfig().SlotsPerEpoch, PreviousJustifiedEpoch: 2, }