From 9f5842e0ecaf6494c5ba30f7e7f1b8cf4ecffee1 Mon Sep 17 00:00:00 2001 From: joeycli Date: Mon, 16 Oct 2023 11:48:59 +0800 Subject: [PATCH] fix: recover TestStateChanges --- .golangci.yml | 3 --- core/blockchain.go | 7 +++---- core/state/statedb_fuzz_test.go | 3 +-- 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 2b746fe31..e7d4e36d7 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -51,9 +51,6 @@ issues: - path: core/state/metrics.go linters: - unused - - path: core/state/statedb_fuzz_test.go - linters: - - unused - path: core/txpool/legacypool/list.go linters: - staticcheck diff --git a/core/blockchain.go b/core/blockchain.go index 94c54fc99..a9de1aabd 100644 --- a/core/blockchain.go +++ b/core/blockchain.go @@ -1180,8 +1180,7 @@ func (bc *BlockChain) Stop() { // - HEAD-127: So we have a hard limit on the number of blocks reexecuted if !bc.cacheConfig.TrieDirtyDisabled { triedb := bc.triedb - var once sync.Once - + var once sync.Once for _, offset := range []uint64{0, 1, TriesInMemory - 1} { if number := bc.CurrentBlock().Number.Uint64(); number > offset { recent := bc.GetBlockByNumber(number - offset) @@ -1191,9 +1190,9 @@ func (bc *BlockChain) Stop() { } else { rawdb.WriteSafePointBlockNumber(bc.db, recent.NumberU64()) once.Do(func() { - rawdb.WriteHeadBlockHash(bc.db, recent.Hash()) + rawdb.WriteHeadBlockHash(bc.db, recent.Hash()) }) - } + } } } if snapBase != (common.Hash{}) { diff --git a/core/state/statedb_fuzz_test.go b/core/state/statedb_fuzz_test.go index 8c7efd8a0..26ca9b5e7 100644 --- a/core/state/statedb_fuzz_test.go +++ b/core/state/statedb_fuzz_test.go @@ -379,8 +379,7 @@ func (test *stateTest) verify(root common.Hash, next common.Hash, db *trie.Datab return nil } -// TODO(Nathan): enable this case after enabling pbss -func testStateChanges(t *testing.T) { +func TestStateChanges(t *testing.T) { config := &quick.Config{MaxCount: 1000} err := quick.Check((*stateTest).run, config) if cerr, ok := err.(*quick.CheckError); ok {