From 24f6b1f4e72fbd22a0685cd8aeb02cf3ee768359 Mon Sep 17 00:00:00 2001 From: Gary Rong Date: Fri, 20 Jun 2025 14:20:41 +0800 Subject: [PATCH] core: fix broken tests --- core/genesis_test.go | 13 +++++++++++-- core/state/sync_test.go | 4 +++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/core/genesis_test.go b/core/genesis_test.go index 9dc4bfb3df..a41dfce578 100644 --- a/core/genesis_test.go +++ b/core/genesis_test.go @@ -256,7 +256,9 @@ func newDbConfig(scheme string) *triedb.Config { if scheme == rawdb.HashScheme { return triedb.HashDefaults } - return &triedb.Config{PathDB: pathdb.Defaults} + config := *pathdb.Defaults + config.NoAsyncFlush = true + return &triedb.Config{PathDB: &config} } func TestVerkleGenesisCommit(t *testing.T) { @@ -313,7 +315,14 @@ func TestVerkleGenesisCommit(t *testing.T) { } db := rawdb.NewMemoryDatabase() - triedb := triedb.NewDatabase(db, triedb.VerkleDefaults) + + config := *pathdb.Defaults + config.NoAsyncFlush = true + + triedb := triedb.NewDatabase(db, &triedb.Config{ + IsVerkle: true, + PathDB: &config, + }) block := genesis.MustCommit(db, triedb) if !bytes.Equal(block.Root().Bytes(), expected) { t.Fatalf("invalid genesis state root, expected %x, got %x", expected, block.Root()) diff --git a/core/state/sync_test.go b/core/state/sync_test.go index 5c8b5a90f7..cae0e0a936 100644 --- a/core/state/sync_test.go +++ b/core/state/sync_test.go @@ -46,7 +46,9 @@ func makeTestState(scheme string) (ethdb.Database, Database, *triedb.Database, c // Create an empty state config := &triedb.Config{Preimages: true} if scheme == rawdb.PathScheme { - config.PathDB = pathdb.Defaults + pconfig := *pathdb.Defaults + pconfig.NoAsyncFlush = true + config.PathDB = &pconfig } else { config.HashDB = hashdb.Defaults }