Skip to content

Commit 188454b

Browse files
committed
changes regarding grader, verifier contract, etc.
1 parent 5c8a58e commit 188454b

File tree

3 files changed

+52
-41
lines changed

3 files changed

+52
-41
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// SPDX-License-Identifier: MIT
2+
pragma solidity ^0.8.27;
3+
4+
interface IVerifier {
5+
function verify(bytes calldata _proof, bytes32[] calldata _publicInputs) external view returns (bool);
6+
}

extension/packages/hardhat/contracts/mocks/VerifierMock.sol

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -2,50 +2,50 @@
22
pragma solidity >=0.8.0 <0.9.0;
33

44
/// Checkpoint 6 //////
5-
// import {IVerifier} from "../Verifier.sol";
5+
import {IVerifier} from "../Verifier.sol";
66

7-
// contract VerifierMock is IVerifier {
8-
// bool public shouldVerify = true;
7+
contract VerifierMock is IVerifier {
8+
bool public shouldVerify = true;
99

10-
// // Optional: enforce an exact public inputs set and order for tests
11-
// bool public enforceExpectedInputs;
12-
// bytes32 public expectedNullifier;
13-
// bytes32 public expectedRoot;
14-
// bytes32 public expectedVote;
15-
// bytes32 public expectedDepth;
10+
// Optional: enforce an exact public inputs set and order for tests
11+
bool public enforceExpectedInputs;
12+
bytes32 public expectedNullifier;
13+
bytes32 public expectedRoot;
14+
bytes32 public expectedVote;
15+
bytes32 public expectedDepth;
1616

17-
// function setShouldVerify(bool _shouldVerify) external {
18-
// shouldVerify = _shouldVerify;
19-
// }
17+
function setShouldVerify(bool _shouldVerify) external {
18+
shouldVerify = _shouldVerify;
19+
}
2020

21-
// function setExpectedInputs(bytes32 _nullifier, bytes32 _root, bytes32 _vote, bytes32 _depth) external {
22-
// enforceExpectedInputs = true;
23-
// expectedNullifier = _nullifier;
24-
// expectedRoot = _root;
25-
// expectedVote = _vote;
26-
// expectedDepth = _depth;
27-
// }
21+
function setExpectedInputs(bytes32 _nullifier, bytes32 _root, bytes32 _vote, bytes32 _depth) external {
22+
enforceExpectedInputs = true;
23+
expectedNullifier = _nullifier;
24+
expectedRoot = _root;
25+
expectedVote = _vote;
26+
expectedDepth = _depth;
27+
}
2828

29-
// function clearExpectedInputs() external {
30-
// enforceExpectedInputs = false;
31-
// expectedNullifier = 0x0;
32-
// expectedRoot = 0x0;
33-
// expectedVote = 0x0;
34-
// expectedDepth = 0x0;
35-
// }
29+
function clearExpectedInputs() external {
30+
enforceExpectedInputs = false;
31+
expectedNullifier = 0x0;
32+
expectedRoot = 0x0;
33+
expectedVote = 0x0;
34+
expectedDepth = 0x0;
35+
}
3636

37-
// function verify(bytes calldata, bytes32[] calldata _publicInputs) external view returns (bool) {
38-
// if (!shouldVerify) {
39-
// return false;
40-
// }
41-
// if (enforceExpectedInputs) {
42-
// if (
43-
// _publicInputs.length != 4 || _publicInputs[0] != expectedNullifier || _publicInputs[1] != expectedRoot
44-
// || _publicInputs[2] != expectedVote || _publicInputs[3] != expectedDepth
45-
// ) {
46-
// return false;
47-
// }
48-
// }
49-
// return true;
50-
// }
51-
// }
37+
function verify(bytes calldata, bytes32[] calldata _publicInputs) external view returns (bool) {
38+
if (!shouldVerify) {
39+
return false;
40+
}
41+
if (enforceExpectedInputs) {
42+
if (
43+
_publicInputs.length != 4 || _publicInputs[0] != expectedNullifier || _publicInputs[1] != expectedRoot
44+
|| _publicInputs[2] != expectedVote || _publicInputs[3] != expectedDepth
45+
) {
46+
return false;
47+
}
48+
}
49+
return true;
50+
}
51+
}

extension/packages/hardhat/hardhat.config.ts.args.mjs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,9 @@ export const configOverrides = {
1313
},
1414
],
1515
},
16+
networks: {
17+
hardhat: {
18+
allowUnlimitedContractSize: true,
19+
},
20+
},
1621
};

0 commit comments

Comments
 (0)