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

Remove std::merkle::check_membership #1356

Closed
1 task
TomAFrench opened this issue May 16, 2023 · 1 comment
Closed
1 task

Remove std::merkle::check_membership #1356

TomAFrench opened this issue May 16, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@TomAFrench
Copy link
Member

Problem

The stdlib function check_membership is pretty trivial and is less readable than performing the equality check in user code imo.

// Returns one if the leaf is in the tree
// and it is at the given index
// and the hashpath proves this
// Currently we assume that it is a binary tree, so depth k implies a width of 2^k
// XXX: In the future we can add an arity parameter
fn check_membership(_root : Field, _leaf : Field, _index : Field, _hash_path: [Field]) -> Field {
(compute_merkle_root(_leaf, _index, _hash_path) == _root) as Field
}

Proposed solution

We should remove std::merkle::check_membership and push people towards using compute_merkle_root.

Alternatives considered

Alternatively we can retain this function but update the return type to bool

Additional context

Related to #1258

Submission Checklist

  • Once I hit submit, I will assign this issue to the Project Board with the appropriate tags.
@TomAFrench TomAFrench added the enhancement New feature or request label May 16, 2023
@github-project-automation github-project-automation bot moved this to 📋 Backlog in Noir May 16, 2023
@TomAFrench
Copy link
Member Author

Closed in #1424

@github-project-automation github-project-automation bot moved this from 📋 Backlog to ✅ Done in Noir Jun 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Archived in project
Development

No branches or pull requests

1 participant