better proof/verification support
zmitton opened this issue · comments
The Implementation of proof verification creates its own sort of "new" version of traversing the trie. There is a better way to verify proofs: the prooving nodes or branch nodes should be put
into the key-value DB (just the ephemeral one) using the nodes given with their keccak as key. Then the the regular get
function should be called on this small tree to see if it can pull out the expected value at the end. This should be much dryer and easier to maintain. I plan to PR this myself soon
In the meantime, Im having trouble verifying proofs of the state tree. So far Im stuck trying to make sense of a function that claims to turn strings and buffers into nibbles, but as far as I can tell does nothing of the sort:
https://github.com/ethereumjs/merkle-patricia-tree/blob/master/src/trieNode.js#L207
my results:
> stringToNibbles(2)
[ 0, 0, 0, 0 ]
> stringToNibbles('2')
[ 3, 2 ]
> stringToNibbles('02')
[ 3, 0, 3, 2 ]
> stringToNibbles('0x02')
[ 3, 0, 7, 8, 3, 0, 3, 2 ]
> stringToNibbles(0x02)
[ 0, 0, 0, 0 ]
UPDATE:
Seems to work for converting from buffers. maybe this is the only current use. Either way, name might want to change
Sounds great! 😊
@alextsg can you eventually have a look?
@holgerd77 Sure
Closed by #82