-
Notifications
You must be signed in to change notification settings - Fork 144
Description
Issue summary
-
Looking at the comments and code, trie.Hash() and trie.root.EncodeAndHash() should produce the same hash, but they don't. condition of
len(key) < 32
is not checked intrie.Hash
and it hashes everything, because in case of root nodes we are supposed to return hash of encoding as hash regardless of length of encoding. This creates mismatching hashes from both functions. -
Right now the logic used in
node.EncodeAndHash()
is repeating intrie.Hash
. -
trie.Hash
should get hash fromtrie.RootNode.EncodeAndHash()
and return it -
In
node.EncodeAndHash
we should check if this node is root or not. If the node is root we should return blake2b hash of its encoding regardless of length of its encoding. -
And then, trie.Hash should get hash from trie.RootNode.EncodeAndHash() and return it.
Other information and links
Metadata
Metadata
Assignees
Labels
Type
Projects
Status