polytope-labs / solidity-merkle-trees

The most advanced solidity library for merkle (multi) proof verification of different kinds of merkle trees
Apache License 2.0
183 stars 33 forks source link

Patricia trie extension node decoding #40

Closed jstinhw closed 7 months ago

jstinhw commented 7 months ago

Two issues found when dealing with extension node

  1. In the process of decoding extension nodes within the Patricia tree, an issue arises where the leading shared nibble 0 is mistakenly discarded. The problem manifests when decoding the following RLP data: decoded_rlp=["0x10”, ”0xb798089c35eabfa9992866d0ff2d19040e85326547b79dad85be810b5482bfb2"]

  2. In the second issue, the concern is with the handling of keyNibbles slicing. The current implementation fails to slice the keyNibbles starting from its original offset, effectively ignoring this offset. This oversight leads to incorrect slicing of keyNibbles. https://github.com/polytope-labs/solidity-merkle-trees/blob/5836535046cfaeb6edb2fadb34c9b793c1b51184/src/MerklePatricia.sol#L169-L171

seunlanlege commented 7 months ago

closed by #41