Skip to content

Commit d305e3f

Browse files
author
Darioush Jalali
authored
move trie generation helper out of trie/ (#1053)
* remove ethdb * refactor: move AllowUnfinalizedQueries out of vm.Config * move trie generation helper out of trie/ (#359)
1 parent 955377b commit d305e3f

File tree

6 files changed

+75
-59
lines changed

6 files changed

+75
-59
lines changed

sync/client/client_test.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import (
2424
clientstats "github.com/ava-labs/subnet-evm/sync/client/stats"
2525
"github.com/ava-labs/subnet-evm/sync/handlers"
2626
handlerstats "github.com/ava-labs/subnet-evm/sync/handlers/stats"
27+
"github.com/ava-labs/subnet-evm/sync/syncutils"
2728
"github.com/ava-labs/subnet-evm/trie"
2829
"github.com/ethereum/go-ethereum/common"
2930
"github.com/ethereum/go-ethereum/crypto"
@@ -410,8 +411,8 @@ func TestGetLeafs(t *testing.T) {
410411
const leafsLimit = 1024
411412

412413
trieDB := trie.NewDatabase(rawdb.NewMemoryDatabase())
413-
largeTrieRoot, largeTrieKeys, _ := trie.GenerateTrie(t, trieDB, 100_000, common.HashLength)
414-
smallTrieRoot, _, _ := trie.GenerateTrie(t, trieDB, leafsLimit, common.HashLength)
414+
largeTrieRoot, largeTrieKeys, _ := syncutils.GenerateTrie(t, trieDB, 100_000, common.HashLength)
415+
smallTrieRoot, _, _ := syncutils.GenerateTrie(t, trieDB, leafsLimit, common.HashLength)
415416

416417
handler := handlers.NewLeafsRequestHandler(trieDB, nil, message.Codec, handlerstats.NewNoopHandlerStats())
417418
client := NewClient(&ClientConfig{
@@ -781,7 +782,7 @@ func TestGetLeafsRetries(t *testing.T) {
781782
rand.Seed(1)
782783

783784
trieDB := trie.NewDatabase(rawdb.NewMemoryDatabase())
784-
root, _, _ := trie.GenerateTrie(t, trieDB, 100_000, common.HashLength)
785+
root, _, _ := syncutils.GenerateTrie(t, trieDB, 100_000, common.HashLength)
785786

786787
handler := handlers.NewLeafsRequestHandler(trieDB, nil, message.Codec, handlerstats.NewNoopHandlerStats())
787788
mockNetClient := &mockNetwork{}

sync/handlers/leafs_request_test.go

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import (
1515
"github.com/ava-labs/subnet-evm/core/types"
1616
"github.com/ava-labs/subnet-evm/plugin/evm/message"
1717
"github.com/ava-labs/subnet-evm/sync/handlers/stats"
18+
"github.com/ava-labs/subnet-evm/sync/syncutils"
1819
"github.com/ava-labs/subnet-evm/trie"
1920
"github.com/ethereum/go-ethereum/common"
2021
"github.com/ethereum/go-ethereum/crypto"
@@ -29,13 +30,17 @@ func TestLeafsRequestHandler_OnLeafsRequest(t *testing.T) {
2930
memdb := rawdb.NewMemoryDatabase()
3031
trieDB := trie.NewDatabase(memdb)
3132

32-
corruptedTrieRoot, _, _ := trie.GenerateTrie(t, trieDB, 100, common.HashLength)
33+
corruptedTrieRoot, _, _ := syncutils.GenerateTrie(t, trieDB, 100, common.HashLength)
34+
tr, err := trie.New(trie.TrieID(corruptedTrieRoot), trieDB)
35+
if err != nil {
36+
t.Fatal(err)
37+
}
3338
// Corrupt [corruptedTrieRoot]
34-
trie.CorruptTrie(t, trieDB, corruptedTrieRoot, 5)
39+
syncutils.CorruptTrie(t, memdb, tr, 5)
3540

36-
largeTrieRoot, largeTrieKeys, _ := trie.GenerateTrie(t, trieDB, 10_000, common.HashLength)
37-
smallTrieRoot, _, _ := trie.GenerateTrie(t, trieDB, 500, common.HashLength)
38-
accountTrieRoot, accounts := trie.FillAccounts(
41+
largeTrieRoot, largeTrieKeys, _ := syncutils.GenerateTrie(t, trieDB, 10_000, common.HashLength)
42+
smallTrieRoot, _, _ := syncutils.GenerateTrie(t, trieDB, 500, common.HashLength)
43+
accountTrieRoot, accounts := syncutils.FillAccounts(
3944
t,
4045
trieDB,
4146
common.Hash{},

sync/statesync/sync_test.go

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020
statesyncclient "github.com/ava-labs/subnet-evm/sync/client"
2121
"github.com/ava-labs/subnet-evm/sync/handlers"
2222
handlerstats "github.com/ava-labs/subnet-evm/sync/handlers/stats"
23+
"github.com/ava-labs/subnet-evm/sync/syncutils"
2324
"github.com/ava-labs/subnet-evm/trie"
2425
"github.com/ethereum/go-ethereum/common"
2526
"github.com/ethereum/go-ethereum/crypto"
@@ -120,15 +121,15 @@ func TestSimpleSyncCases(t *testing.T) {
120121
prepareForTest: func(t *testing.T) (ethdb.Database, ethdb.Database, *trie.Database, common.Hash) {
121122
serverDB := rawdb.NewMemoryDatabase()
122123
serverTrieDB := trie.NewDatabase(serverDB)
123-
root, _ := trie.FillAccounts(t, serverTrieDB, common.Hash{}, numAccounts, nil)
124+
root, _ := syncutils.FillAccounts(t, serverTrieDB, common.Hash{}, numAccounts, nil)
124125
return rawdb.NewMemoryDatabase(), serverDB, serverTrieDB, root
125126
},
126127
},
127128
"accounts with code": {
128129
prepareForTest: func(t *testing.T) (ethdb.Database, ethdb.Database, *trie.Database, common.Hash) {
129130
serverDB := rawdb.NewMemoryDatabase()
130131
serverTrieDB := trie.NewDatabase(serverDB)
131-
root, _ := trie.FillAccounts(t, serverTrieDB, common.Hash{}, numAccounts, func(t *testing.T, index int, account types.StateAccount) types.StateAccount {
132+
root, _ := syncutils.FillAccounts(t, serverTrieDB, common.Hash{}, numAccounts, func(t *testing.T, index int, account types.StateAccount) types.StateAccount {
132133
if index%3 == 0 {
133134
codeBytes := make([]byte, 256)
134135
_, err := rand.Read(codeBytes)
@@ -157,9 +158,9 @@ func TestSimpleSyncCases(t *testing.T) {
157158
prepareForTest: func(t *testing.T) (ethdb.Database, ethdb.Database, *trie.Database, common.Hash) {
158159
serverDB := rawdb.NewMemoryDatabase()
159160
serverTrieDB := trie.NewDatabase(serverDB)
160-
root, _ := trie.FillAccounts(t, serverTrieDB, common.Hash{}, numAccounts, func(t *testing.T, i int, account types.StateAccount) types.StateAccount {
161+
root, _ := syncutils.FillAccounts(t, serverTrieDB, common.Hash{}, numAccounts, func(t *testing.T, i int, account types.StateAccount) types.StateAccount {
161162
if i%5 == 0 {
162-
account.Root, _, _ = trie.GenerateTrie(t, serverTrieDB, 16, common.HashLength)
163+
account.Root, _, _ = syncutils.GenerateTrie(t, serverTrieDB, 16, common.HashLength)
163164
}
164165

165166
return account
@@ -179,7 +180,7 @@ func TestSimpleSyncCases(t *testing.T) {
179180
prepareForTest: func(t *testing.T) (ethdb.Database, ethdb.Database, *trie.Database, common.Hash) {
180181
serverDB := rawdb.NewMemoryDatabase()
181182
serverTrieDB := trie.NewDatabase(serverDB)
182-
root, _ := trie.FillAccounts(t, serverTrieDB, common.Hash{}, numAccountsSmall, nil)
183+
root, _ := syncutils.FillAccounts(t, serverTrieDB, common.Hash{}, numAccountsSmall, nil)
183184
return rawdb.NewMemoryDatabase(), serverDB, serverTrieDB, root
184185
},
185186
GetLeafsIntercept: func(_ message.LeafsRequest, _ message.LeafsResponse) (message.LeafsResponse, error) {
@@ -279,8 +280,8 @@ func TestResumeSyncLargeStorageTrieInterrupted(t *testing.T) {
279280
serverDB := rawdb.NewMemoryDatabase()
280281
serverTrieDB := trie.NewDatabase(serverDB)
281282

282-
largeStorageRoot, _, _ := trie.GenerateTrie(t, serverTrieDB, 2000, common.HashLength)
283-
root, _ := trie.FillAccounts(t, serverTrieDB, common.Hash{}, 2000, func(t *testing.T, index int, account types.StateAccount) types.StateAccount {
283+
largeStorageRoot, _, _ := syncutils.GenerateTrie(t, serverTrieDB, 2000, common.HashLength)
284+
root, _ := syncutils.FillAccounts(t, serverTrieDB, common.Hash{}, 2000, func(t *testing.T, index int, account types.StateAccount) types.StateAccount {
284285
// Set the root for a single account
285286
if index == 10 {
286287
account.Root = largeStorageRoot
@@ -311,16 +312,16 @@ func TestResumeSyncToNewRootAfterLargeStorageTrieInterrupted(t *testing.T) {
311312
serverDB := rawdb.NewMemoryDatabase()
312313
serverTrieDB := trie.NewDatabase(serverDB)
313314

314-
largeStorageRoot1, _, _ := trie.GenerateTrie(t, serverTrieDB, 2000, common.HashLength)
315-
largeStorageRoot2, _, _ := trie.GenerateTrie(t, serverTrieDB, 2000, common.HashLength)
316-
root1, _ := trie.FillAccounts(t, serverTrieDB, common.Hash{}, 2000, func(t *testing.T, index int, account types.StateAccount) types.StateAccount {
315+
largeStorageRoot1, _, _ := syncutils.GenerateTrie(t, serverTrieDB, 2000, common.HashLength)
316+
largeStorageRoot2, _, _ := syncutils.GenerateTrie(t, serverTrieDB, 2000, common.HashLength)
317+
root1, _ := syncutils.FillAccounts(t, serverTrieDB, common.Hash{}, 2000, func(t *testing.T, index int, account types.StateAccount) types.StateAccount {
317318
// Set the root for a single account
318319
if index == 10 {
319320
account.Root = largeStorageRoot1
320321
}
321322
return account
322323
})
323-
root2, _ := trie.FillAccounts(t, serverTrieDB, root1, 100, func(t *testing.T, index int, account types.StateAccount) types.StateAccount {
324+
root2, _ := syncutils.FillAccounts(t, serverTrieDB, root1, 100, func(t *testing.T, index int, account types.StateAccount) types.StateAccount {
324325
if index == 20 {
325326
account.Root = largeStorageRoot2
326327
}
@@ -352,8 +353,8 @@ func TestResumeSyncLargeStorageTrieWithConsecutiveDuplicatesInterrupted(t *testi
352353
serverDB := rawdb.NewMemoryDatabase()
353354
serverTrieDB := trie.NewDatabase(serverDB)
354355

355-
largeStorageRoot, _, _ := trie.GenerateTrie(t, serverTrieDB, 2000, common.HashLength)
356-
root, _ := trie.FillAccounts(t, serverTrieDB, common.Hash{}, 100, func(t *testing.T, index int, account types.StateAccount) types.StateAccount {
356+
largeStorageRoot, _, _ := syncutils.GenerateTrie(t, serverTrieDB, 2000, common.HashLength)
357+
root, _ := syncutils.FillAccounts(t, serverTrieDB, common.Hash{}, 100, func(t *testing.T, index int, account types.StateAccount) types.StateAccount {
357358
// Set the root for 2 successive accounts
358359
if index == 10 || index == 11 {
359360
account.Root = largeStorageRoot
@@ -384,8 +385,8 @@ func TestResumeSyncLargeStorageTrieWithSpreadOutDuplicatesInterrupted(t *testing
384385
serverDB := rawdb.NewMemoryDatabase()
385386
serverTrieDB := trie.NewDatabase(serverDB)
386387

387-
largeStorageRoot, _, _ := trie.GenerateTrie(t, serverTrieDB, 2000, common.HashLength)
388-
root, _ := trie.FillAccounts(t, serverTrieDB, common.Hash{}, 100, func(t *testing.T, index int, account types.StateAccount) types.StateAccount {
388+
largeStorageRoot, _, _ := syncutils.GenerateTrie(t, serverTrieDB, 2000, common.HashLength)
389+
root, _ := syncutils.FillAccounts(t, serverTrieDB, common.Hash{}, 100, func(t *testing.T, index int, account types.StateAccount) types.StateAccount {
389390
if index == 10 || index == 90 {
390391
account.Root = largeStorageRoot
391392
}
@@ -464,7 +465,11 @@ func TestResyncNewRootAfterDeletes(t *testing.T) {
464465
continue
465466
}
466467
corruptedStorageRoots[acc.Root] = struct{}{}
467-
trie.CorruptTrie(t, clientTrieDB, acc.Root, 2)
468+
tr, err := trie.New(trie.TrieID(acc.Root), clientTrieDB)
469+
if err != nil {
470+
t.Fatal(err)
471+
}
472+
syncutils.CorruptTrie(t, clientDB, tr, 2)
468473
}
469474
if err := it.Err; err != nil {
470475
t.Fatal(err)
@@ -474,7 +479,11 @@ func TestResyncNewRootAfterDeletes(t *testing.T) {
474479
"delete intermediate account trie nodes": {
475480
deleteBetweenSyncs: func(t *testing.T, root common.Hash, clientDB ethdb.Database) {
476481
clientTrieDB := trie.NewDatabase(clientDB)
477-
trie.CorruptTrie(t, clientTrieDB, root, 5)
482+
tr, err := trie.New(trie.TrieID(root), clientTrieDB)
483+
if err != nil {
484+
t.Fatal(err)
485+
}
486+
syncutils.CorruptTrie(t, clientDB, tr, 5)
478487
},
479488
},
480489
} {

sync/statesync/test_sync.go

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212
"github.com/ava-labs/subnet-evm/core/rawdb"
1313
"github.com/ava-labs/subnet-evm/core/state/snapshot"
1414
"github.com/ava-labs/subnet-evm/core/types"
15+
"github.com/ava-labs/subnet-evm/sync/syncutils"
1516
"github.com/ava-labs/subnet-evm/trie"
1617
"github.com/ethereum/go-ethereum/common"
1718
"github.com/ethereum/go-ethereum/crypto"
@@ -38,7 +39,7 @@ func assertDBConsistency(t testing.TB, root common.Hash, clientDB ethdb.Database
3839
}
3940
trieAccountLeaves := 0
4041

41-
trie.AssertTrieConsistency(t, root, serverTrieDB, clientTrieDB, func(key, val []byte) error {
42+
syncutils.AssertTrieConsistency(t, root, serverTrieDB, clientTrieDB, func(key, val []byte) error {
4243
trieAccountLeaves++
4344
accHash := common.BytesToHash(key)
4445
var acc types.StateAccount
@@ -73,7 +74,7 @@ func assertDBConsistency(t testing.TB, root common.Hash, clientDB ethdb.Database
7374
storageTrieLeavesCount := 0
7475

7576
// check storage trie and storage snapshot consistency
76-
trie.AssertTrieConsistency(t, acc.Root, serverTrieDB, clientTrieDB, func(key, val []byte) error {
77+
syncutils.AssertTrieConsistency(t, acc.Root, serverTrieDB, clientTrieDB, func(key, val []byte) error {
7778
storageTrieLeavesCount++
7879
snapshotVal := rawdb.ReadStorageSnapshot(clientDB, accHash, common.BytesToHash(key))
7980
assert.Equal(t, val, snapshotVal)
@@ -89,7 +90,7 @@ func assertDBConsistency(t testing.TB, root common.Hash, clientDB ethdb.Database
8990
}
9091

9192
func fillAccountsWithStorage(t *testing.T, serverDB ethdb.Database, serverTrieDB *trie.Database, root common.Hash, numAccounts int) common.Hash {
92-
newRoot, _ := trie.FillAccounts(t, serverTrieDB, root, numAccounts, func(t *testing.T, index int, account types.StateAccount) types.StateAccount {
93+
newRoot, _ := syncutils.FillAccounts(t, serverTrieDB, root, numAccounts, func(t *testing.T, index int, account types.StateAccount) types.StateAccount {
9394
codeBytes := make([]byte, 256)
9495
_, err := rand.Read(codeBytes)
9596
if err != nil {
@@ -102,7 +103,7 @@ func fillAccountsWithStorage(t *testing.T, serverDB ethdb.Database, serverTrieDB
102103

103104
// now create state trie
104105
numKeys := 16
105-
account.Root, _, _ = trie.GenerateTrie(t, serverTrieDB, numKeys, common.HashLength)
106+
account.Root, _, _ = syncutils.GenerateTrie(t, serverTrieDB, numKeys, common.HashLength)
106107
return account
107108
})
108109
return newRoot
@@ -119,18 +120,18 @@ func FillAccountsWithOverlappingStorage(
119120
) (common.Hash, map[*keystore.Key]*types.StateAccount) {
120121
storageRoots := make([]common.Hash, 0, numOverlappingStorageRoots)
121122
for i := 0; i < numOverlappingStorageRoots; i++ {
122-
storageRoot, _, _ := trie.GenerateTrie(t, trieDB, 16, common.HashLength)
123+
storageRoot, _, _ := syncutils.GenerateTrie(t, trieDB, 16, common.HashLength)
123124
storageRoots = append(storageRoots, storageRoot)
124125
}
125126
storageRootIndex := 0
126-
return trie.FillAccounts(t, trieDB, root, numAccounts, func(t *testing.T, i int, account types.StateAccount) types.StateAccount {
127+
return syncutils.FillAccounts(t, trieDB, root, numAccounts, func(t *testing.T, i int, account types.StateAccount) types.StateAccount {
127128
switch i % 3 {
128129
case 0: // unmodified account
129130
case 1: // account with overlapping storage root
130131
account.Root = storageRoots[storageRootIndex%numOverlappingStorageRoots]
131132
storageRootIndex++
132133
case 2: // account with unique storage root
133-
account.Root, _, _ = trie.GenerateTrie(t, trieDB, 16, common.HashLength)
134+
account.Root, _, _ = syncutils.GenerateTrie(t, trieDB, 16, common.HashLength)
134135
}
135136

136137
return account

trie/test_trie.go renamed to sync/syncutils/test_trie.go

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// (c) 2021-2022, Ava Labs, Inc. All rights reserved.
22
// See the file LICENSE for licensing terms.
33

4-
package trie
4+
package syncutils
55

66
import (
77
cryptoRand "crypto/rand"
@@ -13,9 +13,11 @@ import (
1313
"github.com/ava-labs/avalanchego/utils/wrappers"
1414
"github.com/ava-labs/subnet-evm/accounts/keystore"
1515
"github.com/ava-labs/subnet-evm/core/types"
16+
"github.com/ava-labs/subnet-evm/trie"
1617
"github.com/ava-labs/subnet-evm/trie/trienode"
1718

1819
"github.com/ethereum/go-ethereum/common"
20+
"github.com/ethereum/go-ethereum/ethdb"
1921
"github.com/ethereum/go-ethereum/rlp"
2022
"github.com/stretchr/testify/assert"
2123
)
@@ -24,11 +26,11 @@ import (
2426
// Returns the root of the generated trie, the slice of keys inserted into the trie in lexicographical
2527
// order, and the slice of corresponding values.
2628
// GenerateTrie reads from [rand] and the caller should call rand.Seed(n) for deterministic results
27-
func GenerateTrie(t *testing.T, trieDB *Database, numKeys int, keySize int) (common.Hash, [][]byte, [][]byte) {
29+
func GenerateTrie(t *testing.T, trieDB *trie.Database, numKeys int, keySize int) (common.Hash, [][]byte, [][]byte) {
2830
if keySize < wrappers.LongLen+1 {
2931
t.Fatal("key size must be at least 9 bytes (8 bytes for uint64 and 1 random byte)")
3032
}
31-
testTrie := NewEmpty(trieDB)
33+
testTrie := trie.NewEmpty(trieDB)
3234

3335
keys, values := FillTrie(t, numKeys, keySize, testTrie)
3436

@@ -45,7 +47,7 @@ func GenerateTrie(t *testing.T, trieDB *Database, numKeys int, keySize int) (com
4547
// FillTrie fills a given trie with [numKeys] number of keys, each of size [keySize]
4648
// returns inserted keys and values
4749
// FillTrie reads from [rand] and the caller should call rand.Seed(n) for deterministic results
48-
func FillTrie(t *testing.T, numKeys int, keySize int, testTrie *Trie) ([][]byte, [][]byte) {
50+
func FillTrie(t *testing.T, numKeys int, keySize int, testTrie *trie.Trie) ([][]byte, [][]byte) {
4951
keys := make([][]byte, 0, numKeys)
5052
values := make([][]byte, 0, numKeys)
5153

@@ -70,18 +72,18 @@ func FillTrie(t *testing.T, numKeys int, keySize int, testTrie *Trie) ([][]byte,
7072

7173
// AssertTrieConsistency ensures given trieDB [a] and [b] both have the same
7274
// non-empty trie at [root]. (all key/value pairs must be equal)
73-
func AssertTrieConsistency(t testing.TB, root common.Hash, a, b *Database, onLeaf func(key, val []byte) error) {
74-
trieA, err := New(TrieID(root), a)
75+
func AssertTrieConsistency(t testing.TB, root common.Hash, a, b *trie.Database, onLeaf func(key, val []byte) error) {
76+
trieA, err := trie.New(trie.TrieID(root), a)
7577
if err != nil {
7678
t.Fatalf("error creating trieA, root=%s, err=%v", root, err)
7779
}
78-
trieB, err := New(TrieID(root), b)
80+
trieB, err := trie.New(trie.TrieID(root), b)
7981
if err != nil {
8082
t.Fatalf("error creating trieB, root=%s, err=%v", root, err)
8183
}
8284

83-
itA := NewIterator(trieA.NodeIterator(nil))
84-
itB := NewIterator(trieB.NodeIterator(nil))
85+
itA := trie.NewIterator(trieA.NodeIterator(nil))
86+
itB := trie.NewIterator(trieB.NodeIterator(nil))
8587
count := 0
8688
for itA.Next() && itB.Next() {
8789
count++
@@ -100,16 +102,11 @@ func AssertTrieConsistency(t testing.TB, root common.Hash, a, b *Database, onLea
100102
assert.Greater(t, count, 0)
101103
}
102104

103-
// CorruptTrie deletes every [n]th trie node from the trie given by [root] from the trieDB.
104-
// Assumes that the trie given by root can be iterated without issue.
105-
func CorruptTrie(t *testing.T, trieDB *Database, root common.Hash, n int) {
106-
batch := trieDB.diskdb.NewBatch()
107-
// next delete some trie nodes
108-
tr, err := New(TrieID(root), trieDB)
109-
if err != nil {
110-
t.Fatal(err)
111-
}
112-
105+
// CorruptTrie deletes every [n]th trie node from the trie given by [tr] from the underlying [db].
106+
// Assumes [tr] can be iterated without issue.
107+
func CorruptTrie(t *testing.T, diskdb ethdb.Batcher, tr *trie.Trie, n int) {
108+
// Delete some trie nodes
109+
batch := diskdb.NewBatch()
113110
nodeIt := tr.NodeIterator(nil)
114111
count := 0
115112
for nodeIt.Next(true) {
@@ -133,7 +130,7 @@ func CorruptTrie(t *testing.T, trieDB *Database, root common.Hash, n int) {
133130
// [onAccount] is called if non-nil (so the caller can modify the account before it is stored in the secure trie).
134131
// returns the new trie root and a map of funded keys to StateAccount structs.
135132
func FillAccounts(
136-
t *testing.T, trieDB *Database, root common.Hash, numAccounts int,
133+
t *testing.T, trieDB *trie.Database, root common.Hash, numAccounts int,
137134
onAccount func(*testing.T, int, types.StateAccount) types.StateAccount,
138135
) (common.Hash, map[*keystore.Key]*types.StateAccount) {
139136
var (
@@ -143,7 +140,7 @@ func FillAccounts(
143140
accounts = make(map[*keystore.Key]*types.StateAccount, numAccounts)
144141
)
145142

146-
tr, err := NewStateTrie(TrieID(root), trieDB)
143+
tr, err := trie.NewStateTrie(trie.TrieID(root), trieDB)
147144
if err != nil {
148145
t.Fatalf("error opening trie: %v", err)
149146
}

0 commit comments

Comments
 (0)