Skip to content

Commit 324fc7a

Browse files
committed
disable caches
1 parent 0eb1fb4 commit 324fc7a

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

cmd/migration-checker/main.go

+18-3
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import (
2121
"github.com/scroll-tech/go-ethereum/ethdb/leveldb"
2222
"github.com/scroll-tech/go-ethereum/rlp"
2323
"github.com/scroll-tech/go-ethereum/trie"
24+
"github.com/syndtr/goleveldb/leveldb/opt"
2425
)
2526

2627
var accountsDone atomic.Uint64
@@ -46,9 +47,23 @@ func main() {
4647
log.Println(http.ListenAndServe("0.0.0.0:6060", nil))
4748
}()
4849

49-
zkDb, err := leveldb.New(*zkDbPath, 1024, 128, "", true)
50+
zkDb, err := leveldb.NewCustom(*zkDbPath, "zkDb", func(options *opt.Options) {
51+
// Set default options
52+
options.ReadOnly = true
53+
options.BlockCacher = opt.NoCacher
54+
options.BlockCacheCapacity = 0
55+
options.OpenFilesCacher = opt.NoCacher
56+
options.OpenFilesCacheCapacity = 0
57+
})
5058
panicOnError(err, "", "failed to open zk db")
51-
mptDb, err := leveldb.New(*mptDbPath, 1024, 128, "", true)
59+
mptDb, err := leveldb.NewCustom(*mptDbPath, "mptDb", func(options *opt.Options) {
60+
// Set default options
61+
options.ReadOnly = true
62+
options.BlockCacher = opt.NoCacher
63+
options.BlockCacheCapacity = 0
64+
options.OpenFilesCacher = opt.NoCacher
65+
options.OpenFilesCacheCapacity = 0
66+
})
5267
panicOnError(err, "", "failed to open mpt db")
5368

5469
zkRootHash := common.HexToHash(*zkRoot)
@@ -209,7 +224,7 @@ func checkStorageEquality(label string, _ *dbs, zkStorageBytes, mptStorageBytes
209224

210225
func loadMPT(mptTrie *trie.SecureTrie, parallel bool) chan map[string][]byte {
211226
startKey := make([]byte, 32)
212-
workers := 1 << 5
227+
workers := 1 << 6
213228
if !parallel {
214229
workers = 1
215230
}

trie/zk_trie.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ func (t *ZkTrie) countLeaves(root *zkt.Hash, cb func(key, value []byte), depth i
271271
cb(append([]byte{}, rootNode.NodeKey.Bytes()...), append([]byte{}, rootNode.Data()...))
272272
return 1
273273
} else {
274-
if parallel && depth < 5 {
274+
if parallel && depth < 6 {
275275
count := make(chan uint64)
276276
leftT := t.Copy()
277277
rightT := t.Copy()

0 commit comments

Comments
 (0)