Skip to content

Commit 26195e3

Browse files
committed
refactor: update verifiers
1 parent cc32fee commit 26195e3

21 files changed

+269
-434
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@
5959
"@types/jest": "^27.4.0",
6060
"@types/node": "^17.0.9",
6161
"@types/rimraf": "^3.0.2",
62-
"@types/snarkjs": "^0.7.5",
6362
"@typescript-eslint/eslint-plugin": "^5.9.1",
6463
"@typescript-eslint/parser": "^5.9.1",
6564
"babel-jest": "^27.4.6",
@@ -83,6 +82,7 @@
8382
"prettier": "^2.5.1",
8483
"rimraf": "^3.0.2",
8584
"rollup": "^2.64.0",
85+
"snarkjs": "^0.7.2",
8686
"ts-node": "^10.4.0",
8787
"tslib": "^2.3.1",
8888
"typedoc": "^0.25.1",

packages/contracts/contracts/Semaphore.sol

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,8 @@ contract Semaphore is ISemaphore, SemaphoreGroups {
152152
function verifyProof(
153153
uint256 groupId,
154154
uint256 merkleTreeRoot,
155-
uint256 message,
156155
uint256 nullifier,
156+
uint256 message,
157157
uint256 scope,
158158
uint256[8] calldata proof
159159
) external override onlyExistingGroup(groupId) {
@@ -184,10 +184,19 @@ contract Semaphore is ISemaphore, SemaphoreGroups {
184184
revert Semaphore__YouAreUsingTheSameNillifierTwice();
185185
}
186186

187-
verifier.verifyProof(merkleTreeRoot, nullifier, message, scope, proof);
187+
if (
188+
!verifier.verifyProof(
189+
[proof[0], proof[1]],
190+
[[proof[3], proof[2]], [proof[5], proof[4]]],
191+
[proof[6], proof[7]],
192+
[merkleTreeRoot, nullifier, message, scope]
193+
)
194+
) {
195+
revert Semaphore__InvalidProof();
196+
}
188197

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

191-
emit ProofVerified(groupId, merkleTreeRoot, nullifier, scope, message, proof);
200+
emit ProofVerified(groupId, merkleTreeRoot, nullifier, message, scope, proof);
192201
}
193202
}

packages/contracts/contracts/base/Pairing.sol

Lines changed: 0 additions & 151 deletions
This file was deleted.

0 commit comments

Comments
 (0)