From debb38853d898bb78d2a0e28619d494e896a40b6 Mon Sep 17 00:00:00 2001 From: Arpit Temani Date: Mon, 5 Sep 2022 11:11:56 +0400 Subject: [PATCH] fix ci, lint --- core/tx_pool.go | 1 + core/tx_pool_test.go | 6 ++++++ eth/filters/bor_filter_test.go | 16 ++++++++-------- miner/fake_miner.go | 3 +++ 4 files changed, 18 insertions(+), 8 deletions(-) diff --git a/core/tx_pool.go b/core/tx_pool.go index 474d3b68e2..b8a1e680fe 100644 --- a/core/tx_pool.go +++ b/core/tx_pool.go @@ -1108,6 +1108,7 @@ func (pool *TxPool) scheduleReorgLoop() { if curDone == nil && launchNextRun { fmt.Println("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", n, time.Since(now)) n++ + now = time.Now() // Run the background reorg and announcements go pool.runReorg(nextDone, reset, dirtyAccounts, queuedEvents) diff --git a/core/tx_pool_test.go b/core/tx_pool_test.go index 4ffbd7f780..afb3d75705 100644 --- a/core/tx_pool_test.go +++ b/core/tx_pool_test.go @@ -2713,6 +2713,8 @@ func defaultTxPoolRapidConfig() txPoolRapidConfig { } func TestSmallTxPool(t *testing.T) { + t.Parallel() + t.Skip("a red test to be fixed") cfg := defaultTxPoolRapidConfig() @@ -2730,6 +2732,8 @@ func TestSmallTxPool(t *testing.T) { } func TestBigTxPool(t *testing.T) { + t.Parallel() + t.Skip("a red test to be fixed") cfg := defaultTxPoolRapidConfig() @@ -2739,6 +2743,8 @@ func TestBigTxPool(t *testing.T) { //nolint:gocognit func testPoolBatchInsert(t *testing.T, cfg txPoolRapidConfig) { + t.Helper() + t.Parallel() const debug = false diff --git a/eth/filters/bor_filter_test.go b/eth/filters/bor_filter_test.go index a176ce6f5b..1848648beb 100644 --- a/eth/filters/bor_filter_test.go +++ b/eth/filters/bor_filter_test.go @@ -62,7 +62,7 @@ func TestBorFilters(t *testing.T) { hash4 = common.BytesToHash([]byte("topic4")) db = NewMockDatabase(ctrl) - sprint = params.TestChainConfig.Bor.Sprint + testBorConfig = params.TestChainConfig.Bor ) backend := NewMockBackend(ctrl) @@ -74,7 +74,7 @@ func TestBorFilters(t *testing.T) { // Block 1 backend.expectBorReceiptsFromMock([]*common.Hash{nil, &hash1, &hash2, &hash3, &hash4}) - filter := NewBorBlockLogsRangeFilter(backend, sprint, 0, 18, []common.Address{addr}, [][]common.Hash{{hash1, hash2, hash3, hash4}}) + filter := NewBorBlockLogsRangeFilter(backend, testBorConfig, 0, 18, []common.Address{addr}, [][]common.Hash{{hash1, hash2, hash3, hash4}}) logs, err := filter.Logs(context.Background()) if err != nil { @@ -88,7 +88,7 @@ func TestBorFilters(t *testing.T) { // Block 2 backend.expectBorReceiptsFromMock([]*common.Hash{&hash1, &hash3}) - filter = NewBorBlockLogsRangeFilter(backend, sprint, 990, 999, []common.Address{addr}, [][]common.Hash{{hash3}}) + filter = NewBorBlockLogsRangeFilter(backend, testBorConfig, 990, 999, []common.Address{addr}, [][]common.Hash{{hash3}}) logs, _ = filter.Logs(context.Background()) if len(logs) != 1 { @@ -102,7 +102,7 @@ func TestBorFilters(t *testing.T) { // Block 3 backend.expectBorReceiptsFromMock([]*common.Hash{&hash1, &hash2, &hash3}) - filter = NewBorBlockLogsRangeFilter(backend, sprint, 992, 1000, []common.Address{addr}, [][]common.Hash{{hash3}}) + filter = NewBorBlockLogsRangeFilter(backend, testBorConfig, 992, 1000, []common.Address{addr}, [][]common.Hash{{hash3}}) logs, _ = filter.Logs(context.Background()) if len(logs) != 1 { @@ -116,7 +116,7 @@ func TestBorFilters(t *testing.T) { // Block 4 backend.expectBorReceiptsFromMock([]*common.Hash{&hash1, &hash2, nil, &hash3}) - filter = NewBorBlockLogsRangeFilter(backend, sprint, 1, 16, []common.Address{addr}, [][]common.Hash{{hash1, hash2}}) + filter = NewBorBlockLogsRangeFilter(backend, testBorConfig, 1, 16, []common.Address{addr}, [][]common.Hash{{hash1, hash2}}) logs, _ = filter.Logs(context.Background()) @@ -128,7 +128,7 @@ func TestBorFilters(t *testing.T) { backend.expectBorReceiptsFromMock([]*common.Hash{&hash1, &hash2, nil, &hash3, &hash4, nil}) failHash := common.BytesToHash([]byte("fail")) - filter = NewBorBlockLogsRangeFilter(backend, sprint, 0, 20, nil, [][]common.Hash{{failHash}}) + filter = NewBorBlockLogsRangeFilter(backend, testBorConfig, 0, 20, nil, [][]common.Hash{{failHash}}) logs, _ = filter.Logs(context.Background()) if len(logs) != 0 { @@ -139,7 +139,7 @@ func TestBorFilters(t *testing.T) { backend.expectBorReceiptsFromMock([]*common.Hash{&hash1, &hash2, nil, &hash3, &hash4, nil}) failAddr := common.BytesToAddress([]byte("failmenow")) - filter = NewBorBlockLogsRangeFilter(backend, sprint, 0, 20, []common.Address{failAddr}, nil) + filter = NewBorBlockLogsRangeFilter(backend, testBorConfig, 0, 20, []common.Address{failAddr}, nil) logs, _ = filter.Logs(context.Background()) if len(logs) != 0 { @@ -149,7 +149,7 @@ func TestBorFilters(t *testing.T) { // Block 7 backend.expectBorReceiptsFromMock([]*common.Hash{&hash1, &hash2, nil, &hash3, &hash4, nil}) - filter = NewBorBlockLogsRangeFilter(backend, sprint, 0, 20, nil, [][]common.Hash{{failHash}, {hash1}}) + filter = NewBorBlockLogsRangeFilter(backend, testBorConfig, 0, 20, nil, [][]common.Hash{{failHash}, {hash1}}) logs, _ = filter.Logs(context.Background()) if len(logs) != 0 { diff --git a/miner/fake_miner.go b/miner/fake_miner.go index c5c1fbd3b1..60fccbfe6c 100644 --- a/miner/fake_miner.go +++ b/miner/fake_miner.go @@ -138,6 +138,9 @@ func NewDBForFakes(t TensingObject) (ethdb.Database, *core.Genesis, *params.Chai chainConfig.Bor.Period = map[string]uint64{ "0": 1, } + chainConfig.Bor.Sprint = map[string]uint64{ + "0": 1, + } return chainDB, genesis, chainConfig }