Update Eth1FollowDistance to 16 for minimal config (#4566)

* Update Eth1FollowDistance to 16 for minimal config
* Merge branch 'master' into fix-minimal-config
* Merge branch 'master' into fix-minimal-config
* Merge branch 'master' into fix-minimal-config
* Merge branch 'master' into fix-minimal-config
* Merge branch 'master' into fix-minimal-config
* Fix tests after minimal config changes
This commit is contained in:
Dmitri Tsumak 2020-01-29 18:56:21 +01:00 committed by GitHub
parent 3e9bf58d81
commit f6b4637a91
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 15 deletions

View File

@ -268,7 +268,7 @@ func TestPendingDeposits_OutsideEth1FollowWindow(t *testing.T) {
readyDeposits := []*dbpb.DepositContainer{
{
Index: 0,
Eth1BlockHeight: 100,
Eth1BlockHeight: 2,
Deposit: &ethpb.Deposit{
Data: &ethpb.Deposit_Data{
PublicKey: []byte("a"),
@ -278,7 +278,7 @@ func TestPendingDeposits_OutsideEth1FollowWindow(t *testing.T) {
},
{
Index: 1,
Eth1BlockHeight: 1001,
Eth1BlockHeight: 8,
Deposit: &ethpb.Deposit{
Data: &ethpb.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: &ethpb.Deposit{
Data: &ethpb.Deposit_Data{
PublicKey: []byte("c"),
@ -301,7 +301,7 @@ func TestPendingDeposits_OutsideEth1FollowWindow(t *testing.T) {
},
{
Index: 3,
Eth1BlockHeight: 5000,
Eth1BlockHeight: 600,
Deposit: &ethpb.Deposit{
Data: &ethpb.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: &ethpb.Deposit{
Data: &ethpb.Deposit_Data{
PublicKey: []byte("a"),
@ -428,7 +428,7 @@ func TestPendingDeposits_FollowsCorrectEth1Block(t *testing.T) {
},
{
Index: 1,
Eth1BlockHeight: 1010,
Eth1BlockHeight: 14,
Deposit: &ethpb.Deposit{
Data: &ethpb.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: &ethpb.Deposit{
Data: &ethpb.Deposit_Data{
PublicKey: []byte("a"),
@ -867,7 +867,7 @@ func TestDefaultEth1Data_NoBlockExists(t *testing.T) {
},
{
Index: 1,
Eth1BlockHeight: 1200,
Eth1BlockHeight: 14,
Deposit: &ethpb.Deposit{
Data: &ethpb.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: &ethpb.Eth1Data{
DepositCount: 55,

View File

@ -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)

View File

@ -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