mirror of
https://github.com/status-im/nimbus-eth1.git
synced 2025-02-05 08:45:27 +00:00
add some remarks on interesting findings during experiment
This commit is contained in:
parent
9589f9cd90
commit
a1a6b7b9c4
@ -109,6 +109,11 @@ proc writeShortNode(wb: var WitnessBuilder, node: openArray[byte], depth: int) =
|
|||||||
if isLeaf:
|
if isLeaf:
|
||||||
writeAccountNode(wb, node, depth)
|
writeAccountNode(wb, node, depth)
|
||||||
else:
|
else:
|
||||||
|
# why this short extension node have no
|
||||||
|
# child and still valid when we reconstruct
|
||||||
|
# the trie on the other side?
|
||||||
|
# a bug in hexary trie algo?
|
||||||
|
# or a bug in nim hexary trie implementation?
|
||||||
writeExtensionNode(wb, k, depth, node)
|
writeExtensionNode(wb, k, depth, node)
|
||||||
of 17:
|
of 17:
|
||||||
let branchMask = rlpListToBitmask(nodeRlp)
|
let branchMask = rlpListToBitmask(nodeRlp)
|
||||||
@ -120,6 +125,10 @@ proc writeShortNode(wb: var WitnessBuilder, node: openArray[byte], depth: int) =
|
|||||||
let nextLookup = branch.getNode
|
let nextLookup = branch.getNode
|
||||||
writeShortNode(wb, nextLookup, depth + 1)
|
writeShortNode(wb, nextLookup, depth + 1)
|
||||||
|
|
||||||
|
# contrary to yellow paper spec,
|
||||||
|
# the 17th elem never exist in reality.
|
||||||
|
# block witness spec also omit it.
|
||||||
|
# probably a flaw in hexary trie design
|
||||||
# 17th elem should always empty
|
# 17th elem should always empty
|
||||||
doAssert branchMask.branchMaskBitIsSet(16) == false
|
doAssert branchMask.branchMaskBitIsSet(16) == false
|
||||||
else:
|
else:
|
||||||
@ -144,6 +153,7 @@ proc getBranchRecurseAux(wb: var WitnessBuilder, node: openArray[byte], path: Ni
|
|||||||
# AccountNodeType
|
# AccountNodeType
|
||||||
writeAccountNode(wb, node, depth)
|
writeAccountNode(wb, node, depth)
|
||||||
else:
|
else:
|
||||||
|
# this is a potential branch for multiproof
|
||||||
writeHashNode(wb, keccak(node).data)
|
writeHashNode(wb, keccak(node).data)
|
||||||
of 17:
|
of 17:
|
||||||
let branchMask = rlpListToBitmask(nodeRlp)
|
let branchMask = rlpListToBitmask(nodeRlp)
|
||||||
@ -161,6 +171,7 @@ proc getBranchRecurseAux(wb: var WitnessBuilder, node: openArray[byte], path: Ni
|
|||||||
let nextLookup = branch.getNode
|
let nextLookup = branch.getNode
|
||||||
writeShortNode(wb, nextLookup, depth + 1)
|
writeShortNode(wb, nextLookup, depth + 1)
|
||||||
else:
|
else:
|
||||||
|
# this is a potential branch for multiproof
|
||||||
writeHashNode(wb, branch.expectHash)
|
writeHashNode(wb, branch.expectHash)
|
||||||
|
|
||||||
# 17th elem should always empty
|
# 17th elem should always empty
|
||||||
|
Loading…
x
Reference in New Issue
Block a user