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

Add tree depth constants to JavaScript libraries and Solidity contracts #711

Merged
merged 4 commits into from
Mar 15, 2024

Conversation

vplasencia
Copy link
Member

@vplasencia vplasencia commented Mar 15, 2024

Description

This PR adds tree depth constants to JavaScript libraries and Solidity contracts to follow good practices and make it easier to update these important values.

  • JavaScript libraries:

There is a new export in the @semaphore-protocol/utils library called constants which has the minimum and maximum Semaphore supported tree depth.

  • Solidity contracts:

There is a new file called Constants.sol in the packages/contracts/contracts/base folder which has the minimum and maximum Semaphore supported tree depth.

With these updates, when the supported tree depths change, only these two files should be updated with the VK_POINTS variable in the SemaphoreVerifier.sol contract.

Related Issue(s)

Closes #683

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have run yarn prettier and yarn lint without getting any errors
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

there is a new package in utils called constants which has the supported semaphore tree depths

re #683
…ontracts

the semaphore contract has new constants to save the min and max supported tree depth

re #683
Copy link

openzeppelin-code bot commented Mar 15, 2024

Add tree depth constants to JavaScript libraries and Solidity contracts

Generated at commit: c3b9b98370598b78bc1d6d9d7e91546773f37631

🚨 Report Summary

Severity Level Results
Contracts Critical
High
Medium
Low
Note
Total
0
0
0
4
16
20
Dependencies Critical
High
Medium
Low
Note
Total
0
0
0
0
0
0

For more details view the full report in OpenZeppelin Code Inspector

@vplasencia vplasencia changed the title Add tree depth constants to JavaScript libraries and SOlidity contracts Add tree depth constants to JavaScript libraries and Solidity contracts Mar 15, 2024
Copy link
Member

@cedoor cedoor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍🏽 I left just a comment.

packages/proof/src/verify-proof.ts Outdated Show resolved Hide resolved
@vplasencia vplasencia requested a review from cedoor March 15, 2024 16:41
@cedoor cedoor merged commit d256905 into main Mar 15, 2024
3 checks passed
@cedoor cedoor deleted the ref/add-tree-depth-constants branch March 15, 2024 17:20
@aguzmant103
Copy link
Contributor

@gitpoap-bot @0xbok @0xDatapunk

Copy link

gitpoap-bot bot commented Mar 18, 2024

Congrats, @0xbok @0xDatapunk ! You've earned a GitPOAP for your contribution!

GitPOAP: 2024 Semaphore Contributor:

GitPOAP: 2024 Semaphore Contributor GitPOAP Badge

Head to gitpoap.io & connect your GitHub account to mint!

Learn more about GitPOAPs here.

@0xbok
Copy link
Member

0xbok commented Mar 18, 2024

wowow, thanks @aguzmant103 :)

@0xDatapunk
Copy link

0xDatapunk commented Mar 18, 2024 via email

cedoor added a commit that referenced this pull request Mar 28, 2024
…nstants

Add tree depth constants to JavaScript libraries and Solidity contracts

Former-commit-id: d256905
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.

define a const variable for max_depth
5 participants