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

refactor(rln): Update Merkle tree initialization method #30

Merged
merged 2 commits into from
Aug 5, 2022

Conversation

s1fr0
Copy link
Contributor

@s1fr0 s1fr0 commented Aug 5, 2022

This PR addresses #28, by updating zerokit RLN Merkle tree implementation so that trees are initialized by passing the tree_height = N in order to be able to accumulate at most 2^N hash leaves.

Previously, Merkle tree implementation followed semaphore-rs one, and trees were initialized by passing the total number of node levels (including the pre-images of the hash leaves), i.e. tree_height+1.

As a consequence, previous circuits embedded in zerokit RLN, correspond to height equal to 15 and 19. Since nwaku requires a tree of height 20 for implementing RLN-RELAY, the corresponding circuit was added in the library and tests were updated to cover this case as well.

This PR affects #27, and one between waku-org/nwaku#1030 and waku-org/nwaku#1060, mainly due to tests' hardcoded values that need to be updated.

@s1fr0 s1fr0 requested a review from oskarth August 5, 2022 01:05
@s1fr0 s1fr0 self-assigned this Aug 5, 2022
@s1fr0 s1fr0 added track:zerokit Zerokit track (Applied ZK/Explorations) track:rln RLN Track - (Secure Messaging/Applied ZK), relay and applications labels Aug 5, 2022
@s1fr0 s1fr0 linked an issue Aug 5, 2022 that may be closed by this pull request
2 tasks
rln/src/ffi.rs Show resolved Hide resolved
@oskarth
Copy link
Contributor

oskarth commented Aug 5, 2022

Lint failing otherwise lgtm

@s1fr0
Copy link
Contributor Author

s1fr0 commented Aug 5, 2022

@oskarth Thanks! Forgot a cargo fmt. Just pushed and will merge after success!

@s1fr0 s1fr0 merged commit 3378aed into master Aug 5, 2022
s1fr0 added a commit that referenced this pull request Aug 7, 2022
s1fr0 added a commit that referenced this pull request Aug 7, 2022
* refactor(rln): update readme

* fix(rln): update README in light of #30
@s1fr0 s1fr0 deleted the merkle-tree-definition branch October 17, 2022 10:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
track:rln RLN Track - (Secure Messaging/Applied ZK), relay and applications track:zerokit Zerokit track (Applied ZK/Explorations)
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

RLN: initialize Merkle-tree passing height or number of leaves
2 participants