diff --git a/core/core_test.go b/core/core_test.go index bbee042d4..d123da20c 100644 --- a/core/core_test.go +++ b/core/core_test.go @@ -11,7 +11,7 @@ import ( func TestIsEpochBlock(t *testing.T) { block1 := types.NewBlock(&types.Header{Number: big.NewInt(10)}, nil, nil) block2 := types.NewBlock(&types.Header{Number: big.NewInt(0)}, nil, nil) - block3 := types.NewBlock(&types.Header{Number: big.NewInt(327680)}, nil, nil) + block3 := types.NewBlock(&types.Header{Number: big.NewInt(344064)}, nil, nil) block4 := types.NewBlock(&types.Header{Number: big.NewInt(77)}, nil, nil) block5 := types.NewBlock(&types.Header{Number: big.NewInt(78)}, nil, nil) block6 := types.NewBlock(&types.Header{Number: big.NewInt(188)}, nil, nil) @@ -57,11 +57,11 @@ func TestIsEpochBlock(t *testing.T) { true, }, } - for _, test := range tests { + for i, test := range tests { ShardingSchedule = test.schedule r := IsEpochBlock(test.block) if r != test.expected { - t.Errorf("expected: %v, got: %v\n", test.expected, r) + t.Errorf("index: %v, expected: %v, got: %v\n", i, test.expected, r) } } } diff --git a/internal/configs/sharding/shardingconfig_test.go b/internal/configs/sharding/shardingconfig_test.go index f1b05ed11..89abd8f45 100644 --- a/internal/configs/sharding/shardingconfig_test.go +++ b/internal/configs/sharding/shardingconfig_test.go @@ -51,22 +51,30 @@ func TestCalcEpochNumber(t *testing.T) { }, { 327680, - big.NewInt(1), + big.NewInt(0), }, { 344064, - big.NewInt(2), + big.NewInt(1), }, { 344063, + big.NewInt(0), + }, + { + 344065, big.NewInt(1), }, + { + 360448, + big.NewInt(2), + }, } - for _, test := range tests { + for i, test := range tests { ep := MainnetSchedule.CalcEpochNumber(test.block) if ep.Cmp(test.epoch) != 0 { - t.Errorf("CalcEpochNumber error: got %v, expect %v\n", ep, test.epoch) + t.Errorf("CalcEpochNumber error: index %v, got %v, expect %v\n", i, ep, test.epoch) } } }