-
Notifications
You must be signed in to change notification settings - Fork 11.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extend MerkleProof with notion of index for unsorted trees or leaf identifiers #3057
Comments
One thing to note is that our library currently supports trees of depth > 256, while an Another concern is that it may be ambiguous if an index refers to an inner node or a leaf. |
About tooling,
|
In the docs for merkletreejs I see that some functions accept an |
These indices are for identifying leaves (from 0 to n-1). This is used, in particular, to distinguish two identical leaves and produce different proofs. |
Worth noting that for a balanced tree I think that index is identical to the one that was originally proposed in the linked PRs. |
See Generalized Merkle Tree Index in the Ethereum consensus specs. I said above that uint256 indices wouldn't support trees with depth > 256 but no one should ever need a tree of that size. Merkle trees should be balanced in order to have nice properties. We can still support unbalanced trees but balanced trees should be prioritized. |
@k06a proposed an implementation for this feature in #2815. A related feature was proposed in #2851 to compute a leaf identifier when a proof is validated, that could be used as a to index a bitmap.
We feel that this subject requires further thinking/discussion before we commit to providing (and supporting) an implementation.
As a quick summary, this should include two elements:
Both of these (path and leaf identifier) were called "index" in the linked PRs.
Next steps include:
The text was updated successfully, but these errors were encountered: