@@ -49,7 +49,11 @@ func New(disk db.KeyValueStore, config *Config) *Database {
4949}
5050
5151func (d * Database ) insert (
52- owner * felt.Address , path * trieutils.Path , hash * felt.Felt , isClass bool , node trienode.TrieNode ,
52+ owner * felt.Address ,
53+ path * trieutils.Path ,
54+ hash * felt.Felt ,
55+ isClass bool ,
56+ node trienode.TrieNode ,
5357) {
5458 _ , found := d .dirtyCache .getNode (owner , path , hash , isClass )
5559 if found {
@@ -59,7 +63,11 @@ func (d *Database) insert(
5963}
6064
6165func (d * Database ) readNode (
62- bucket db.Bucket , owner * felt.Address , path * trieutils.Path , hash * felt.Felt , isLeaf bool ,
66+ bucket db.Bucket ,
67+ owner * felt.Address ,
68+ path * trieutils.Path ,
69+ hash * felt.Felt ,
70+ isLeaf bool ,
6371) ([]byte , error ) {
6472 if blob := d .cleanCache .getNode (path , hash ); blob != nil {
6573 return blob , nil
@@ -86,7 +94,7 @@ func (d *Database) readNode(
8694func (d * Database ) NewIterator (id trieutils.TrieID ) (db.Iterator , error ) {
8795 key := id .Bucket ().Key ()
8896 owner := id .Owner ()
89- if ! felt .IsZero (& owner ) {
97+ if ! felt .IsZero (owner ) {
9098 oBytes := owner .Bytes ()
9199 key = append (key , oBytes [:]... )
92100 }
@@ -109,15 +117,15 @@ func (d *Database) Commit(_ *felt.Felt) error {
109117 batch ,
110118 db .ClassTrie ,
111119 & felt.Address {},
112- path ,
113- hash ,
120+ & path ,
121+ & hash ,
114122 node .IsLeaf (),
115123 node .Blob (),
116124 )
117125 if err != nil {
118126 return err
119127 }
120- d .cleanCache .putNode (path , hash , node .Blob ())
128+ d .cleanCache .putNode (& path , & hash , node .Blob ())
121129 }
122130
123131 for key , node := range d .dirtyCache .contractNodes {
@@ -129,15 +137,15 @@ func (d *Database) Commit(_ *felt.Felt) error {
129137 batch ,
130138 db .ContractTrieContract ,
131139 & felt.Address {},
132- path ,
133- hash ,
140+ & path ,
141+ & hash ,
134142 node .IsLeaf (),
135143 node .Blob (),
136144 )
137145 if err != nil {
138146 return err
139147 }
140- d .cleanCache .putNode (path , hash , node .Blob ())
148+ d .cleanCache .putNode (& path , & hash , node .Blob ())
141149 }
142150
143151 for owner , nodes := range d .dirtyCache .contractStorageNodes {
@@ -150,15 +158,15 @@ func (d *Database) Commit(_ *felt.Felt) error {
150158 batch ,
151159 db .ContractTrieStorage ,
152160 & owner ,
153- path ,
154- hash ,
161+ & path ,
162+ & hash ,
155163 node .IsLeaf (),
156164 node .Blob (),
157165 )
158166 if err != nil {
159167 return err
160168 }
161- d .cleanCache .putNode (path , hash , node .Blob ())
169+ d .cleanCache .putNode (& path , & hash , node .Blob ())
162170 }
163171 }
164172
@@ -241,7 +249,10 @@ type reader struct {
241249}
242250
243251func (r * reader ) Node (
244- owner * felt.Address , path * trieutils.Path , hash * felt.Felt , isLeaf bool ,
252+ owner * felt.Address ,
253+ path * trieutils.Path ,
254+ hash * felt.Felt ,
255+ isLeaf bool ,
245256) ([]byte , error ) {
246257 return r .d .readNode (r .id .Bucket (), owner , path , hash , isLeaf )
247258}
@@ -262,7 +273,12 @@ func (d *Database) GetTrieRootNodes(classRootHash, contractRootHash *felt.Felt)
262273 const contractClassTrieHeight = 251
263274
264275 classRootBlob , err := trieutils .GetNodeByHash (
265- d .disk , db .ClassTrie , & felt.Address {}, & trieutils.Path {}, classRootHash , false ,
276+ d .disk ,
277+ db .ClassTrie ,
278+ & felt.Address {},
279+ & trieutils.Path {},
280+ classRootHash ,
281+ false ,
266282 )
267283 if err != nil {
268284 return nil , nil , fmt .Errorf ("class root node not found: %w" , err )
0 commit comments