2019-08-23 01:00:55 +00:00
|
|
|
package blockchain
|
|
|
|
|
|
|
|
import (
|
2020-09-03 18:18:38 +00:00
|
|
|
"context"
|
2019-08-23 01:00:55 +00:00
|
|
|
"testing"
|
2020-01-10 23:51:49 +00:00
|
|
|
"time"
|
2019-08-23 01:00:55 +00:00
|
|
|
|
2019-11-27 05:08:18 +00:00
|
|
|
ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1"
|
2020-06-14 22:24:49 +00:00
|
|
|
"github.com/prysmaticlabs/prysm/beacon-chain/core/helpers"
|
2019-08-23 01:00:55 +00:00
|
|
|
testDB "github.com/prysmaticlabs/prysm/beacon-chain/db/testing"
|
2020-09-03 18:18:38 +00:00
|
|
|
"github.com/prysmaticlabs/prysm/shared/params"
|
|
|
|
"github.com/prysmaticlabs/prysm/shared/testutil/require"
|
2019-08-23 01:00:55 +00:00
|
|
|
)
|
|
|
|
|
2020-10-26 19:09:19 +00:00
|
|
|
func TestAttestationCheckPtState_FarFutureSlot(t *testing.T) {
|
2020-09-03 18:18:38 +00:00
|
|
|
helpers.ClearCache()
|
2020-12-16 16:56:21 +00:00
|
|
|
db := testDB.SetupDB(t)
|
2020-09-03 18:18:38 +00:00
|
|
|
|
2020-12-16 16:56:21 +00:00
|
|
|
chainService := setupBeaconChain(t, db)
|
2020-09-03 18:18:38 +00:00
|
|
|
chainService.genesisTime = time.Now()
|
|
|
|
|
|
|
|
e := helpers.MaxSlotBuffer/params.BeaconConfig().SlotsPerEpoch + 1
|
|
|
|
_, err := chainService.AttestationPreState(context.Background(), ðpb.Attestation{Data: ðpb.AttestationData{Target: ðpb.Checkpoint{Epoch: e}}})
|
|
|
|
require.ErrorContains(t, "exceeds max allowed value relative to the local clock", err)
|
|
|
|
}
|