diff --git a/tests/bor/bor_api_test.go b/tests/bor/bor_api_test.go index 63d2c8f3d5..50992d72d9 100644 --- a/tests/bor/bor_api_test.go +++ b/tests/bor/bor_api_test.go @@ -138,7 +138,7 @@ func TestAPIs(t *testing.T) { }() genesis := core.GenesisBlockForTesting(db, addrr, big.NewInt(1000000)) - sprint := params.TestChainConfig.Bor.Sprint + testBorConfig := params.TestChainConfig.Bor chain, receipts := core.GenerateChain(params.TestChainConfig, genesis, ethash.NewFaker(), db, 6, func(i int, gen *core.BlockGen) { switch i { @@ -208,7 +208,7 @@ func TestAPIs(t *testing.T) { blockBatch := db.NewBatch() - if i%int(sprint-1) != 0 { + if i%int(testBorConfig.CalculateSprint(block.NumberU64())-1) != 0 { // if it is not sprint start write all the transactions as normal transactions. rawdb.WriteReceipts(db, block.Hash(), block.NumberU64(), receipts[i]) } else { diff --git a/tests/bor/bor_filter_test.go b/tests/bor/bor_filter_test.go index 25cfa078a1..8b7213a50b 100644 --- a/tests/bor/bor_filter_test.go +++ b/tests/bor/bor_filter_test.go @@ -36,7 +36,7 @@ func TestBorFilters(t *testing.T) { defer db.Close() genesis := core.GenesisBlockForTesting(db, addr, big.NewInt(1000000)) - sprint := params.TestChainConfig.Bor.Sprint + testBorConfig := params.TestChainConfig.Bor chain, receipts := core.GenerateChain(params.TestChainConfig, genesis, ethash.NewFaker(), db, 1000, func(i int, gen *core.BlockGen) { switch i { @@ -122,14 +122,14 @@ func TestBorFilters(t *testing.T) { } } - filter := filters.NewBorBlockLogsRangeFilter(backend, sprint, 0, -1, []common.Address{addr}, [][]common.Hash{{hash1, hash2, hash3, hash4}}) + filter := filters.NewBorBlockLogsRangeFilter(backend, testBorConfig, 0, -1, []common.Address{addr}, [][]common.Hash{{hash1, hash2, hash3, hash4}}) logs, _ := filter.Logs(context.Background()) if len(logs) != 4 { t.Error("expected 4 log, got", len(logs)) } - filter = filters.NewBorBlockLogsRangeFilter(backend, sprint, 900, 999, []common.Address{addr}, [][]common.Hash{{hash3}}) + filter = filters.NewBorBlockLogsRangeFilter(backend, testBorConfig, 900, 999, []common.Address{addr}, [][]common.Hash{{hash3}}) logs, _ = filter.Logs(context.Background()) if len(logs) != 1 { @@ -140,7 +140,7 @@ func TestBorFilters(t *testing.T) { t.Errorf("expected log[0].Topics[0] to be %x, got %x", hash3, logs[0].Topics[0]) } - filter = filters.NewBorBlockLogsRangeFilter(backend, sprint, 992, -1, []common.Address{addr}, [][]common.Hash{{hash3}}) + filter = filters.NewBorBlockLogsRangeFilter(backend, testBorConfig, 992, -1, []common.Address{addr}, [][]common.Hash{{hash3}}) logs, _ = filter.Logs(context.Background()) if len(logs) != 1 { @@ -151,7 +151,7 @@ func TestBorFilters(t *testing.T) { t.Errorf("expected log[0].Topics[0] to be %x, got %x", hash3, logs[0].Topics[0]) } - filter = filters.NewBorBlockLogsRangeFilter(backend, sprint, 1, -1, []common.Address{addr}, [][]common.Hash{{hash1, hash2}}) + filter = filters.NewBorBlockLogsRangeFilter(backend, testBorConfig, 1, -1, []common.Address{addr}, [][]common.Hash{{hash1, hash2}}) logs, _ = filter.Logs(context.Background()) if len(logs) != 2 { @@ -159,7 +159,7 @@ func TestBorFilters(t *testing.T) { } failHash := common.BytesToHash([]byte("fail")) - filter = filters.NewBorBlockLogsRangeFilter(backend, sprint, 0, -1, nil, [][]common.Hash{{failHash}}) + filter = filters.NewBorBlockLogsRangeFilter(backend, testBorConfig, 0, -1, nil, [][]common.Hash{{failHash}}) logs, _ = filter.Logs(context.Background()) if len(logs) != 0 { @@ -167,14 +167,14 @@ func TestBorFilters(t *testing.T) { } failAddr := common.BytesToAddress([]byte("failmenow")) - filter = filters.NewBorBlockLogsRangeFilter(backend, sprint, 0, -1, []common.Address{failAddr}, nil) + filter = filters.NewBorBlockLogsRangeFilter(backend, testBorConfig, 0, -1, []common.Address{failAddr}, nil) logs, _ = filter.Logs(context.Background()) if len(logs) != 0 { t.Error("expected 0 log, got", len(logs)) } - filter = filters.NewBorBlockLogsRangeFilter(backend, sprint, 0, -1, nil, [][]common.Hash{{failHash}, {hash1}}) + filter = filters.NewBorBlockLogsRangeFilter(backend, testBorConfig, 0, -1, nil, [][]common.Hash{{failHash}, {hash1}}) logs, _ = filter.Logs(context.Background()) if len(logs) != 0 { diff --git a/tests/bor/testdata/genesis_2val.json b/tests/bor/testdata/genesis_2val.json index 498424aa81..e4d14d07ab 100644 --- a/tests/bor/testdata/genesis_2val.json +++ b/tests/bor/testdata/genesis_2val.json @@ -19,7 +19,9 @@ "0": 1 }, "producerDelay": 4, - "sprint": 8, + "sprint": { + "0": 8 + }, "backupMultiplier": { "0": 1 }, @@ -61,4 +63,3 @@ "gasUsed": "0x0", "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000" } - \ No newline at end of file