Skip to content

Commit

Permalink
refactor: update verifiers
Browse files Browse the repository at this point in the history
  • Loading branch information
cedoor committed Jan 12, 2024
1 parent cc32fee commit 26195e3
Show file tree
Hide file tree
Showing 21 changed files with 269 additions and 434 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@
"@types/jest": "^27.4.0",
"@types/node": "^17.0.9",
"@types/rimraf": "^3.0.2",
"@types/snarkjs": "^0.7.5",
"@typescript-eslint/eslint-plugin": "^5.9.1",
"@typescript-eslint/parser": "^5.9.1",
"babel-jest": "^27.4.6",
Expand All @@ -83,6 +82,7 @@
"prettier": "^2.5.1",
"rimraf": "^3.0.2",
"rollup": "^2.64.0",
"snarkjs": "^0.7.2",
"ts-node": "^10.4.0",
"tslib": "^2.3.1",
"typedoc": "^0.25.1",
Expand Down
15 changes: 12 additions & 3 deletions packages/contracts/contracts/Semaphore.sol
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,8 @@ contract Semaphore is ISemaphore, SemaphoreGroups {
function verifyProof(
uint256 groupId,
uint256 merkleTreeRoot,
uint256 message,
uint256 nullifier,
uint256 message,
uint256 scope,
uint256[8] calldata proof
) external override onlyExistingGroup(groupId) {
Expand Down Expand Up @@ -184,10 +184,19 @@ contract Semaphore is ISemaphore, SemaphoreGroups {
revert Semaphore__YouAreUsingTheSameNillifierTwice();
}

verifier.verifyProof(merkleTreeRoot, nullifier, message, scope, proof);
if (
!verifier.verifyProof(
[proof[0], proof[1]],
[[proof[3], proof[2]], [proof[5], proof[4]]],
[proof[6], proof[7]],
[merkleTreeRoot, nullifier, message, scope]
)
) {
revert Semaphore__InvalidProof();
}

groups[groupId].nullifiers[nullifier] = true;

emit ProofVerified(groupId, merkleTreeRoot, nullifier, scope, message, proof);
emit ProofVerified(groupId, merkleTreeRoot, nullifier, message, scope, proof);
}
}
151 changes: 0 additions & 151 deletions packages/contracts/contracts/base/Pairing.sol

This file was deleted.

Loading

0 comments on commit 26195e3

Please sign in to comment.