diff --git a/beacon-chain/rpc/validator/proposer_test.go b/beacon-chain/rpc/validator/proposer_test.go index 1f59dff79..19a19d3f0 100644 --- a/beacon-chain/rpc/validator/proposer_test.go +++ b/beacon-chain/rpc/validator/proposer_test.go @@ -268,7 +268,7 @@ func TestPendingDeposits_OutsideEth1FollowWindow(t *testing.T) { readyDeposits := []*dbpb.DepositContainer{ { Index: 0, - Eth1BlockHeight: 100, + Eth1BlockHeight: 2, Deposit: ðpb.Deposit{ Data: ðpb.Deposit_Data{ PublicKey: []byte("a"), @@ -278,7 +278,7 @@ func TestPendingDeposits_OutsideEth1FollowWindow(t *testing.T) { }, { Index: 1, - Eth1BlockHeight: 1001, + Eth1BlockHeight: 8, Deposit: ðpb.Deposit{ Data: ðpb.Deposit_Data{ PublicKey: []byte("b"), @@ -291,7 +291,7 @@ func TestPendingDeposits_OutsideEth1FollowWindow(t *testing.T) { recentDeposits := []*dbpb.DepositContainer{ { Index: 2, - Eth1BlockHeight: 4000, + Eth1BlockHeight: 400, Deposit: ðpb.Deposit{ Data: ðpb.Deposit_Data{ PublicKey: []byte("c"), @@ -301,7 +301,7 @@ func TestPendingDeposits_OutsideEth1FollowWindow(t *testing.T) { }, { Index: 3, - Eth1BlockHeight: 5000, + Eth1BlockHeight: 600, Deposit: ðpb.Deposit{ Data: ðpb.Deposit_Data{ PublicKey: []byte("d"), @@ -418,7 +418,7 @@ func TestPendingDeposits_FollowsCorrectEth1Block(t *testing.T) { readyDeposits := []*dbpb.DepositContainer{ { Index: 0, - Eth1BlockHeight: 1000, + Eth1BlockHeight: 8, Deposit: ðpb.Deposit{ Data: ðpb.Deposit_Data{ PublicKey: []byte("a"), @@ -428,7 +428,7 @@ func TestPendingDeposits_FollowsCorrectEth1Block(t *testing.T) { }, { Index: 1, - Eth1BlockHeight: 1010, + Eth1BlockHeight: 14, Deposit: ðpb.Deposit{ Data: ðpb.Deposit_Data{ PublicKey: []byte("b"), @@ -692,10 +692,10 @@ func TestPendingDeposits_CantReturnMoreThanMax(t *testing.T) { } depositTrie.Insert(depositHash[:], int(dp.Index)) - depositCache.InsertDeposit(ctx, dp.Deposit, uint64(dp.Index), dp.Index, depositTrie.Root()) + depositCache.InsertDeposit(ctx, dp.Deposit, height.Uint64(), dp.Index, depositTrie.Root()) } for _, dp := range recentDeposits { - depositCache.InsertPendingDeposit(ctx, dp.Deposit, uint64(dp.Index), dp.Index, depositTrie.Root()) + depositCache.InsertPendingDeposit(ctx, dp.Deposit, height.Uint64(), dp.Index, depositTrie.Root()) } bs := &Server{ @@ -857,7 +857,7 @@ func TestDefaultEth1Data_NoBlockExists(t *testing.T) { deps := []*dbpb.DepositContainer{ { Index: 0, - Eth1BlockHeight: 1000, + Eth1BlockHeight: 8, Deposit: ðpb.Deposit{ Data: ðpb.Deposit_Data{ PublicKey: []byte("a"), @@ -867,7 +867,7 @@ func TestDefaultEth1Data_NoBlockExists(t *testing.T) { }, { Index: 1, - Eth1BlockHeight: 1200, + Eth1BlockHeight: 14, Deposit: ðpb.Deposit{ Data: ðpb.Deposit_Data{ PublicKey: []byte("b"), @@ -889,7 +889,7 @@ func TestDefaultEth1Data_NoBlockExists(t *testing.T) { LatestBlockNumber: height, HashesByHeight: map[int][]byte{ 0: []byte("hash0"), - 476: []byte("hash1024"), + 12: []byte("hash12"), }, } proposerServer := &Server{ @@ -908,7 +908,7 @@ func TestDefaultEth1Data_NoBlockExists(t *testing.T) { p.Eth1Data = defEth1Data - result, err := proposerServer.defaultEth1DataResponse(ctx, big.NewInt(1500)) + result, err := proposerServer.defaultEth1DataResponse(ctx, big.NewInt(16)) if err != nil { t.Fatal(err) } @@ -920,7 +920,6 @@ func TestDefaultEth1Data_NoBlockExists(t *testing.T) { // TODO(2312): Add more tests for edge cases and better coverage. func TestEth1Data(t *testing.T) { - slot := uint64(10000) p := &mockPOW.POWChain{ @@ -928,7 +927,7 @@ func TestEth1Data(t *testing.T) { slot * params.BeaconConfig().SecondsPerSlot: big.NewInt(4096), }, HashesByHeight: map[int][]byte{ - 3072: []byte("3072"), + 4080: []byte("4080"), }, Eth1Data: ðpb.Eth1Data{ DepositCount: 55, diff --git a/beacon-chain/rpc/validator/status_test.go b/beacon-chain/rpc/validator/status_test.go index cb2359564..254a5df4e 100644 --- a/beacon-chain/rpc/validator/status_test.go +++ b/beacon-chain/rpc/validator/status_test.go @@ -815,7 +815,7 @@ func TestDepositBlockSlotAfterGenesisTime(t *testing.T) { t.Fatalf("Could not get the deposit block slot %v", err) } - expected := uint64(2405) + expected := uint64(53) if resp != expected { t.Errorf("Wanted %v, got %v", expected, resp) diff --git a/shared/params/config.go b/shared/params/config.go index f653c1fe5..022b45575 100644 --- a/shared/params/config.go +++ b/shared/params/config.go @@ -261,6 +261,7 @@ func MinimalSpecConfig() *BeaconChainConfig { minimalConfig.MinValidatorWithdrawabilityDelay = 256 minimalConfig.PersistentCommitteePeriod = 2048 minimalConfig.MinEpochsToInactivityPenalty = 4 + minimalConfig.Eth1FollowDistance = 16 minimalConfig.SafeSlotsToUpdateJustified = 2 // State vector lengths