In SMTHashZero, SMTNaive and SMTSingleLeaf the leaf hash is simply computed as Hash(value), where value is directly provided on calling addLeaf. This can easily lead to leaves and subtrees to have identical hashes.
In these cases different trees branches will end up sharing common nodes.
Editing one such "repeated" leaf can corrupt the SMT as the shared nodes are deleted on replacing.
The same problem is not present in SMTSingleLeafEx whose hashes leaves as Hash(index | value | 1).
In
SMTHashZero
,SMTNaive
andSMTSingleLeaf
the leaf hash is simply computed asHash(value)
, wherevalue
is directly provided on callingaddLeaf
. This can easily lead to leaves and subtrees to have identical hashes.In these cases different trees branches will end up sharing common nodes.
Editing one such "repeated" leaf can corrupt the SMT as the shared nodes are deleted on replacing.
The same problem is not present in
SMTSingleLeafEx
whose hashes leaves asHash(index | value | 1)
.