You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This issue is an opinionated suggestion. Others may disagree.
MerkleProof struct contains:
2 copies of index position
leaf value
These items should not be in the merkle proof. Instead, MerkleTree::verify should take them as separate args. If the leaf value is large then the size of the merkle proof is unnecessarily large.
First copy of index position is pos field in `MerkleProof struct:
where we find a second copy of pos and the leaf value elem.
If, as I suggest, we remove these occurrences of pos then MerkleProof becomes just a wrapper for MerklePath. In that case we should eliminate the wrapper and just use MerklePath.
I suggest that MerklePath be an opaque struct. No need to expose the fact that it's a Vec<MerkleNode>.
The text was updated successfully, but these errors were encountered:
Forgot to mention: currently MerkleTree::verify takes a redundant arg pos. The current implementation merely checks pos against one of its copies inside MerkleProof:
Instead verify args should include both pos and elem or neither of these items. Seems strange to take only one but not the other. Naturally, my suggestion is to include both and then remove them from MerkleProof.
This issue is an opinionated suggestion. Others may disagree.
MerkleProof
struct contains:These items should not be in the merkle proof. Instead,
MerkleTree::verify
should take them as separate args. If the leaf value is large then the size of the merkle proof is unnecessarily large.First copy of index position is
pos
field in `MerkleProof struct:jellyfish/merkle_tree/src/internal.rs
Lines 139 to 150 in 92714a4
Digging into
MerklePath
we seejellyfish/merkle_tree/src/internal.rs
Line 84 in 92714a4
where
MerkleNode
is an enumjellyfish/merkle_tree/src/internal.rs
Line 25 in 92714a4
with
Leaf
variantjellyfish/merkle_tree/src/internal.rs
Lines 37 to 47 in 92714a4
where we find a second copy of
pos
and the leaf valueelem
.If, as I suggest, we remove these occurrences of
pos
thenMerkleProof
becomes just a wrapper forMerklePath
. In that case we should eliminate the wrapper and just useMerklePath
.I suggest that
MerklePath
be an opaque struct. No need to expose the fact that it's aVec<MerkleNode>
.The text was updated successfully, but these errors were encountered: