One Verifier to rule them all #166
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Semaphore allows groups of different sizes to be created by setting a certain depth of the associated Merkle tree. To verify zero-knowledge proofs of a user in a certain group, it was necessary to use a Verifier contract corresponding to the depth of the group tree. There were therefore 17 different contracts, one for each supported tree depth. However, the Verifier contracts contained a lot of duplicate code/functions, as the only differences were a set of G1/G2 points (integer pairs) used in the verification.
This PR removes that duplicate code and creates a single Semaphore verifier that can be used to verify all proofs.
Main advantages:
Semaphore.sol
,SemaphoreVoting.sol
andSemaphoreWhistleblowing.sol
only need 1 verifier address.SemaphoreVerifier.sol
(i.e. the formerSemaphoreCore.sol
) replaces the previous verifiers and reduces the number of lines of code by ~3800.SemaphoreVerifier.sol
can be deployed only once for each network, until the Semaphore circuits are updated.Related Issue
Closes #156
Does this introduce a breaking change?