Skip to content
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

Reorder arguments for multiProof functions #3447

Merged
merged 9 commits into from
Jun 3, 2022

Conversation

frangio
Copy link
Contributor

@frangio frangio commented Jun 1, 2022

Resolves part of #3441.

Reorders arguments for consistency with simple proofs.

@frangio frangio added this to the 4.7 milestone Jun 1, 2022
@frangio frangio requested a review from Amxx June 1, 2022 21:28
@Amxx
Copy link
Collaborator

Amxx commented Jun 2, 2022

While I understand the logic here, I must say I'm not a fan of this new format.

In particular because it separates the proof and the proofFlag arguments. The thing is, in multiProofVerify, the proof array should possibly be called "proofSiblings", and it is useless without the "proofFlags" array.

Afaik, the idea for having the proof being the first argument of the single version was to be able to do:

using Merkle for bytes32[];
...
proof.verify(root, leaf)

IMO this was a bad design from the start. Rater then proving a property on the proof, using the root, I would rather prove a property on the tree itself (namely that it contains a leaf) using the proof as an argument.

So I would personally have preferred

  • root.verifyInclusion(leaf, proof)
  • leaf.rebuildRoot(proof)
  • root.verifyIncusion(leaves, proofSiblings, proofFlags) (overloaded)
  • leaves.rebuildRoot(proofSiblings, proofFlags) (overloaded)

@frangio
Copy link
Contributor Author

frangio commented Jun 2, 2022

Reordered to proof, proofFlags, root, leaves. I also edited the documentation.

…ppelin-contracts into merkle-multiproof-reorder
@Amxx Amxx merged commit 1134434 into OpenZeppelin:master Jun 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants