@@ -36,6 +36,7 @@ func main() {
36
36
zkRoot = flag .String ("zk-root" , "" , "root hash of the ZK node" )
37
37
paranoid = flag .Bool ("paranoid" , false , "verifies all node contents against their expected hash" )
38
38
parallelismMultipler = flag .Int ("parallelism-multiplier" , 4 , "multiplier for the number of parallel workers" )
39
+ startFrom = flag .Int ("start-form" , 0 , "start checking from account at the given index" )
39
40
)
40
41
flag .Parse ()
41
42
@@ -70,7 +71,7 @@ func main() {
70
71
checkTrieEquality (& dbs {
71
72
zkDb : zkDb ,
72
73
mptDb : mptDb ,
73
- }, zkRootHash , mptRootHash , "" , checkAccountEquality , true , * paranoid )
74
+ }, zkRootHash , mptRootHash , "" , checkAccountEquality , true , * paranoid , * startFrom )
74
75
75
76
for i := 0 ; i < numTrieCheckers ; i ++ {
76
77
<- trieCheckers
@@ -86,7 +87,7 @@ func panicOnError(err error, label, msg string) {
86
87
func dup (s []byte ) []byte {
87
88
return append ([]byte {}, s ... )
88
89
}
89
- func checkTrieEquality (dbs * dbs , zkRoot , mptRoot common.Hash , label string , leafChecker func (string , * dbs , []byte , []byte , bool ), top , paranoid bool ) {
90
+ func checkTrieEquality (dbs * dbs , zkRoot , mptRoot common.Hash , label string , leafChecker func (string , * dbs , []byte , []byte , bool ), top , paranoid bool , startFrom int ) {
90
91
done := make (chan struct {})
91
92
start := time .Now ()
92
93
if ! top {
@@ -120,8 +121,9 @@ func checkTrieEquality(dbs *dbs, zkRoot, mptRoot common.Hash, label string, leaf
120
121
totalAccounts = len (mptLeafs )
121
122
}
122
123
123
- for index , zkKv := range zkLeafs {
124
- mptKv := mptLeafs [index ]
124
+ for i := startFrom ; i < len (zkLeafs ); i ++ {
125
+ zkKv := zkLeafs [i ]
126
+ mptKv := mptLeafs [i ]
125
127
leafChecker (fmt .Sprintf ("%s key: %s" , label , hex .EncodeToString ([]byte (zkKv .key ))), dbs , zkKv .value , mptKv .value , paranoid )
126
128
}
127
129
}
@@ -158,7 +160,7 @@ func checkAccountEquality(label string, dbs *dbs, zkAccountBytes, mptAccountByte
158
160
}
159
161
}()
160
162
161
- checkTrieEquality (dbs , zkRoot , mptRoot , label , checkStorageEquality , false , paranoid )
163
+ checkTrieEquality (dbs , zkRoot , mptRoot , label , checkStorageEquality , false , paranoid , 0 )
162
164
accountsDone .Add (1 )
163
165
fmt .Println ("Accounts done:" , accountsDone .Load (), "/" , totalAccounts )
164
166
trieCheckers <- struct {}{}
0 commit comments