@@ -107,13 +107,13 @@ func clear(self: var AristoTrieWriter) =
107
107
self.twoPassWriter.clear()
108
108
self.hashWriter.clear()
109
109
110
- template appendLeaf(w: var RlpWriter, pfx: NibblesBuf, leafData: untyped ) =
110
+ template appendLeaf(w: var RlpWriter, pfx: NibblesBuf, leafData: auto ) =
111
111
w.startList(2 )
112
112
w.append(pfx.toHexPrefix(isLeaf = true ).data())
113
113
w.wrapEncoding(1 )
114
114
w.append(leafData)
115
115
116
- template encodeLeaf(w: var AristoTrieWriter, pfx: NibblesBuf, leafData: untyped ): HashKey =
116
+ template encodeLeaf(w: var AristoTrieWriter, pfx: NibblesBuf, leafData: auto ): HashKey =
117
117
w.clear()
118
118
w.tracker.appendLeaf(pfx, leafData)
119
119
@@ -154,7 +154,7 @@ template appendExt(w: var RlpWriter, pfx: NibblesBuf, branchKey: HashKey) =
154
154
w.append(pfx.toHexPrefix(isLeaf = false ).data())
155
155
w.append(branchKey)
156
156
157
- template encodeExt(w: var AristoTrieWriter, pfx: NibblesBuf, branchKey: untyped ): HashKey =
157
+ func encodeExt(w: var AristoTrieWriter, pfx: NibblesBuf, branchKey: HashKey ): HashKey =
158
158
w.clear()
159
159
w.tracker.appendExt(pfx, branchKey)
160
160
@@ -205,9 +205,9 @@ proc computeKeyImpl(
205
205
# empty state
206
206
207
207
# Top-most level of all the verticies this hash computation depends on
208
- var level = level
209
-
210
- var writer = AristoTrieWriter.init()
208
+ var
209
+ level = level
210
+ writer = AristoTrieWriter.init()
211
211
212
212
let key =
213
213
case vtx.vType
@@ -235,17 +235,17 @@ proc computeKeyImpl(
235
235
else :
236
236
VOID_HASH_KEY
237
237
238
- writer.encodeLeaf(vtx.pfx):
238
+ writer.encodeLeaf(vtx.pfx,
239
239
Account(
240
240
nonce: vtx.account.nonce,
241
241
balance: vtx.account.balance,
242
242
storageRoot: skey.to(Hash32),
243
243
codeHash: vtx.account.codeHash,
244
244
)
245
+ )
245
246
of StoLeaf:
246
247
let vtx = StoLeafRef(vtx)
247
- writer.encodeLeaf(vtx.pfx):
248
- vtx.stoData
248
+ writer.encodeLeaf(vtx.pfx, vtx.stoData)
249
249
of Branches:
250
250
# For branches, we need to load the vertices before recursing into them
251
251
# to exploit their on-disk order
@@ -314,9 +314,8 @@ proc computeKeyImpl(
314
314
315
315
if vtx.vType == ExtBranch:
316
316
let vtx = ExtBranchRef(vtx)
317
- writer.encodeExt(vtx.pfx):
318
- var bwriter = AristoTrieWriter.init()
319
- bwriter.writeBranch(vtx)
317
+ var bwriter = AristoTrieWriter.init()
318
+ writer.encodeExt(vtx.pfx, bwriter.writeBranch(vtx))
320
319
else :
321
320
writer.writeBranch(vtx)
322
321
0 commit comments