@crisp-e3/contracts 0.9.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -28
- package/contracts/CRISPProgram.sol +14 -14
- package/contracts/CRISPVerifier.sol +45 -45
- package/contracts/Mocks/{MockEnclave.sol → MockInterfold.sol} +12 -12
- package/package.json +7 -14
package/README.md
CHANGED
|
@@ -22,47 +22,36 @@ pnpm test
|
|
|
22
22
|
|
|
23
23
|
## Deployment
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
Local deploy is driven by **`../../crisp.dev.env`** (see
|
|
26
|
+
**[../../docs/PROOF_AGGREGATION_AND_ZK.md](../../docs/PROOF_AGGREGATION_AND_ZK.md)**):
|
|
26
27
|
|
|
27
|
-
|
|
28
|
-
|
|
28
|
+
- `pnpm dev:setup` — applies profile, builds DKG circuits when
|
|
29
|
+
`CRISP_PROOF_AGGREGATION_ENABLED=true`
|
|
30
|
+
- `pnpm dev:up` → `scripts/crisp_deploy.sh` — sets `ENABLE_ZK_VERIFICATION` from the same file
|
|
29
31
|
|
|
30
|
-
|
|
31
|
-
pnpm deploy:contracts:full:mock
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
This will also print out the environment variables needed for the CRISP server to work with your
|
|
35
|
-
newly deployed contracts.
|
|
36
|
-
|
|
37
|
-
### Full deployment with Risc0Verifier
|
|
38
|
-
|
|
39
|
-
You can deploy CRISP contracts only using:
|
|
40
|
-
|
|
41
|
-
```bash
|
|
42
|
-
pnpm deploy:contracts
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
Or the following to deploy Enclave contracts too (useful for testing scenarios):
|
|
32
|
+
### CRISP-only deploy (Interfold already deployed)
|
|
46
33
|
|
|
47
34
|
```bash
|
|
48
|
-
pnpm deploy:contracts
|
|
35
|
+
pnpm deploy:contracts # production RISC0 verifier
|
|
36
|
+
pnpm deploy:contracts:full # also deploy Interfold stack (no ZK unless ENABLE_ZK_VERIFICATION=true)
|
|
49
37
|
```
|
|
50
38
|
|
|
51
39
|
## CRISP Program
|
|
52
40
|
|
|
53
|
-
This is the main logic of CRISP - an
|
|
41
|
+
This is the main logic of CRISP - an interfold program for secure voting.
|
|
54
42
|
|
|
55
43
|
It exposes two main functions:
|
|
56
44
|
|
|
57
|
-
- `validate` - that is called when a new E3 instance is requested on
|
|
58
|
-
|
|
59
|
-
|
|
45
|
+
- `validate` - that is called when a new E3 instance is requested on Interfold
|
|
46
|
+
(`Interfold.request`).
|
|
47
|
+
- `verify` - that is called when the ciphertext output is published on Interfold
|
|
48
|
+
(`Interfold.publishCiphertextOutput`). This function ensures that the ciphertext output is valid.
|
|
60
49
|
CRISP uses Risc0 as the compute provider for running the FHE program, thus the proof will be a
|
|
61
50
|
Risc0 proof.
|
|
62
51
|
- `validateInput` - validate the input data that is submitted to the E3 instance. It is called by
|
|
63
|
-
the
|
|
64
|
-
providers (the ones submitting the inputs) are the voters, and the input submitted is the
|
|
65
|
-
itself. The logic checks that gating conditions are satisfied and that the ciphertext is
|
|
52
|
+
the Interfold contract when a new input is published (`Interfold.publishInput`). In CRISP, the
|
|
53
|
+
data providers (the ones submitting the inputs) are the voters, and the input submitted is the
|
|
54
|
+
vote itself. The logic checks that gating conditions are satisfied and that the ciphertext is
|
|
66
55
|
constructed correctly using
|
|
67
|
-
[Greco](https://github.com/gnosisguild/
|
|
56
|
+
[Greco](https://github.com/gnosisguild/interfold/tree/main/circuits/crates/libs/greco). See the
|
|
68
57
|
Greco [paper](https://eprint.iacr.org/2024/594).
|
|
@@ -7,9 +7,9 @@ pragma solidity >=0.8.27;
|
|
|
7
7
|
|
|
8
8
|
import { IRiscZeroVerifier } from "risc0/IRiscZeroVerifier.sol";
|
|
9
9
|
import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";
|
|
10
|
-
import { IE3Program } from "@
|
|
11
|
-
import {
|
|
12
|
-
import { E3 } from "@
|
|
10
|
+
import { IE3Program } from "@interfold/contracts/contracts/interfaces/IE3Program.sol";
|
|
11
|
+
import { IInterfold } from "@interfold/contracts/contracts/interfaces/IInterfold.sol";
|
|
12
|
+
import { E3 } from "@interfold/contracts/contracts/interfaces/IE3.sol";
|
|
13
13
|
import { LazyIMTData, InternalLazyIMT } from "@zk-kit/lazy-imt.sol/InternalLazyIMT.sol";
|
|
14
14
|
import { HonkVerifier } from "./CRISPVerifier.sol";
|
|
15
15
|
|
|
@@ -42,7 +42,7 @@ contract CRISPProgram is IE3Program, Ownable {
|
|
|
42
42
|
/// @notice Maximum number of bits allocated for vote counts in the plaintext output per option.
|
|
43
43
|
uint256 constant MAX_VOTE_BITS = 50;
|
|
44
44
|
// State variables
|
|
45
|
-
|
|
45
|
+
IInterfold public interfold;
|
|
46
46
|
IRiscZeroVerifier public risc0Verifier;
|
|
47
47
|
bytes32 public imageId;
|
|
48
48
|
HonkVerifier private immutable honkVerifier;
|
|
@@ -53,7 +53,7 @@ contract CRISPProgram is IE3Program, Ownable {
|
|
|
53
53
|
// Errors
|
|
54
54
|
error CallerNotAuthorized();
|
|
55
55
|
error E3AlreadyInitialized();
|
|
56
|
-
error
|
|
56
|
+
error InterfoldAddressZero();
|
|
57
57
|
error Risc0VerifierAddressZero();
|
|
58
58
|
error InvalidHonkVerifier();
|
|
59
59
|
error EmptyInputData();
|
|
@@ -72,16 +72,16 @@ contract CRISPProgram is IE3Program, Ownable {
|
|
|
72
72
|
event InputPublished(uint256 indexed e3Id, bytes encryptedVote, uint256 index);
|
|
73
73
|
|
|
74
74
|
/// @notice Initialize the contract, binding it to a specified RISC Zero verifier.
|
|
75
|
-
/// @param
|
|
75
|
+
/// @param _interfold The interfold address
|
|
76
76
|
/// @param _risc0Verifier The RISC Zero verifier address
|
|
77
77
|
/// @param _honkVerifier The honk verifier address
|
|
78
78
|
/// @param _imageId The image ID for the guest program
|
|
79
|
-
constructor(
|
|
80
|
-
if (address(
|
|
79
|
+
constructor(IInterfold _interfold, IRiscZeroVerifier _risc0Verifier, HonkVerifier _honkVerifier, bytes32 _imageId) Ownable(msg.sender) {
|
|
80
|
+
if (address(_interfold) == address(0)) revert InterfoldAddressZero();
|
|
81
81
|
if (address(_risc0Verifier) == address(0)) revert Risc0VerifierAddressZero();
|
|
82
82
|
if (address(_honkVerifier) == address(0)) revert InvalidHonkVerifier();
|
|
83
83
|
|
|
84
|
-
|
|
84
|
+
interfold = _interfold;
|
|
85
85
|
risc0Verifier = _risc0Verifier;
|
|
86
86
|
honkVerifier = _honkVerifier;
|
|
87
87
|
imageId = _imageId;
|
|
@@ -125,7 +125,7 @@ contract CRISPProgram is IE3Program, Ownable {
|
|
|
125
125
|
bytes calldata,
|
|
126
126
|
bytes calldata customParams
|
|
127
127
|
) external returns (bytes32) {
|
|
128
|
-
if (msg.sender != address(
|
|
128
|
+
if (msg.sender != address(interfold) && msg.sender != owner()) revert CallerNotAuthorized();
|
|
129
129
|
if (e3Data[e3Id].paramsHash != bytes32(0)) revert E3AlreadyInitialized();
|
|
130
130
|
|
|
131
131
|
// decode custom params to get the number of options
|
|
@@ -147,11 +147,11 @@ contract CRISPProgram is IE3Program, Ownable {
|
|
|
147
147
|
|
|
148
148
|
/// @inheritdoc IE3Program
|
|
149
149
|
function publishInput(uint256 e3Id, bytes memory data) external {
|
|
150
|
-
E3 memory e3 =
|
|
150
|
+
E3 memory e3 = interfold.getE3(e3Id);
|
|
151
151
|
|
|
152
152
|
// check that we are in the correct stage
|
|
153
|
-
|
|
154
|
-
if (stage !=
|
|
153
|
+
IInterfold.E3Stage stage = interfold.getE3Stage(e3Id);
|
|
154
|
+
if (stage != IInterfold.E3Stage.KeyPublished) {
|
|
155
155
|
revert KeyNotPublished(e3Id);
|
|
156
156
|
}
|
|
157
157
|
|
|
@@ -199,7 +199,7 @@ contract CRISPProgram is IE3Program, Ownable {
|
|
|
199
199
|
/// @param e3Id The E3 program ID
|
|
200
200
|
/// @return votes - an array of vote counts for each option
|
|
201
201
|
function decodeTally(uint256 e3Id) public view returns (uint256[] memory votes) {
|
|
202
|
-
E3 memory e3 =
|
|
202
|
+
E3 memory e3 = interfold.getE3(e3Id);
|
|
203
203
|
|
|
204
204
|
uint256 numOptions = e3Data[e3Id].numOptions;
|
|
205
205
|
|
|
@@ -8,7 +8,7 @@ pragma solidity >=0.8.21;
|
|
|
8
8
|
uint256 constant N = 2097152;
|
|
9
9
|
uint256 constant LOG_N = 21;
|
|
10
10
|
uint256 constant NUMBER_OF_PUBLIC_INPUTS = 23;
|
|
11
|
-
uint256 constant VK_HASH =
|
|
11
|
+
uint256 constant VK_HASH = 0x1363994dff01411729a9198cf1b2539577e31a836b6175370de2ebc9e5fe43cc;
|
|
12
12
|
library HonkVerificationKey {
|
|
13
13
|
function loadVerificationKey() internal pure returns (Honk.VerificationKey memory) {
|
|
14
14
|
Honk.VerificationKey memory vk = Honk.VerificationKey({
|
|
@@ -16,76 +16,76 @@ library HonkVerificationKey {
|
|
|
16
16
|
logCircuitSize: uint256(21),
|
|
17
17
|
publicInputsSize: uint256(23),
|
|
18
18
|
ql: Honk.G1Point({
|
|
19
|
-
x: uint256(
|
|
20
|
-
y: uint256(
|
|
19
|
+
x: uint256(0x188b8bd77632a8af920326bfc2d2281a3cf604913221391edf1ac9fe02120ed1),
|
|
20
|
+
y: uint256(0x147f80c895be168b9689d122f5bdedb2296de44d941e5378c591d23574445cc4)
|
|
21
21
|
}),
|
|
22
22
|
qr: Honk.G1Point({
|
|
23
|
-
x: uint256(
|
|
24
|
-
y: uint256(
|
|
23
|
+
x: uint256(0x1a02c9f1ae6e0b1037b0881654328eec39501f97ae51aaffeb05eb3a2b2de119),
|
|
24
|
+
y: uint256(0x29eb45831f58c59b72bf876b4a67f63a98a3bbf96487afec9f7a2c2210972b5b)
|
|
25
25
|
}),
|
|
26
26
|
qo: Honk.G1Point({
|
|
27
|
-
x: uint256(
|
|
28
|
-
y: uint256(
|
|
27
|
+
x: uint256(0x26f8a24a0977ba8288b255e99a4529da51a051e128c629c3a748f5de3c5bb0ef),
|
|
28
|
+
y: uint256(0x258179ad2b2e943faeae74eed595dd5f8a3849b28af17e01546cccd47619746c)
|
|
29
29
|
}),
|
|
30
30
|
q4: Honk.G1Point({
|
|
31
|
-
x: uint256(
|
|
32
|
-
y: uint256(
|
|
31
|
+
x: uint256(0x29c3b196a166824a0dad36a68b62c2ab74baa3acf00d43599e24149cabd77b3c),
|
|
32
|
+
y: uint256(0x08866f6cafd256c09ccdf564dad394dc082ca16221bb3a8b4957437ac54e4d5b)
|
|
33
33
|
}),
|
|
34
34
|
qm: Honk.G1Point({
|
|
35
|
-
x: uint256(
|
|
36
|
-
y: uint256(
|
|
35
|
+
x: uint256(0x0b70643590be080324d22dd1d1044b39f979d1b8c4a9994bad2c12fe031fdbd8),
|
|
36
|
+
y: uint256(0x094b2f9ef76de679e3696371ad08d24c549f710efc6d635f114e9eff35e2a4cf)
|
|
37
37
|
}),
|
|
38
38
|
qc: Honk.G1Point({
|
|
39
|
-
x: uint256(
|
|
40
|
-
y: uint256(
|
|
39
|
+
x: uint256(0x0934c5e9b8cffadce0e26c2a8b48ee06072f046e003950fb153d2bfa328c17fd),
|
|
40
|
+
y: uint256(0x2a8e90dbce025a51265129b231df4f9f21e120fe106ef2049bf8a50041bfd877)
|
|
41
41
|
}),
|
|
42
42
|
qLookup: Honk.G1Point({
|
|
43
43
|
x: uint256(0x1958b13f38f58756e23989a418de3c113d47a2256ba6f60a9e2ec0523c52a991),
|
|
44
44
|
y: uint256(0x286c1d4c53af6654de284fbb620f90a9e00aa9470a9e3c58a56cc81e212df923)
|
|
45
45
|
}),
|
|
46
46
|
qArith: Honk.G1Point({
|
|
47
|
-
x: uint256(
|
|
48
|
-
y: uint256(
|
|
47
|
+
x: uint256(0x1650ab20908fac8b39842f152937e151f60f4b68ca0a64de89b55769a5a388a9),
|
|
48
|
+
y: uint256(0x1230774514e3201dd3195bffe89d5ad12c88a817767171ae920aa8c93d54d0b1)
|
|
49
49
|
}),
|
|
50
50
|
qDeltaRange: Honk.G1Point({
|
|
51
|
-
x: uint256(
|
|
52
|
-
y: uint256(
|
|
51
|
+
x: uint256(0x20dcdd6ad6159d21d6fd1cf6f70bb9f0fafb3fbd38d6b1590cce5fa678c75963),
|
|
52
|
+
y: uint256(0x0576ae3c71f00267025a13bd23d1bd2db2c93254458f93ec097efd27676fd576)
|
|
53
53
|
}),
|
|
54
54
|
qElliptic: Honk.G1Point({
|
|
55
|
-
x: uint256(
|
|
56
|
-
y: uint256(
|
|
55
|
+
x: uint256(0x02c698a3d957cdc72eddea30de02c84ad9e7cc3455e39f1fec996a5618f72ec0),
|
|
56
|
+
y: uint256(0x05c14a080f71c3ae6c538965a8707377b4cdea9213ef8679e17d53f09380c50c)
|
|
57
57
|
}),
|
|
58
58
|
qMemory: Honk.G1Point({
|
|
59
|
-
x: uint256(
|
|
60
|
-
y: uint256(
|
|
59
|
+
x: uint256(0x1bc97809165931d0d7a0c80337a440c83466747f8f08e9765cc255168171063d),
|
|
60
|
+
y: uint256(0x2c5715175aee9ce87f01b047f4e012b5b3ad76f7caa7a71d20b6e2d532e5b03f)
|
|
61
61
|
}),
|
|
62
62
|
qNnf: Honk.G1Point({
|
|
63
|
-
x: uint256(
|
|
64
|
-
y: uint256(
|
|
63
|
+
x: uint256(0x02cf02022c04bf434cc76bc44ef892fc94199c36e6010a0ff8bbdc570811c782),
|
|
64
|
+
y: uint256(0x284e2925bfe6946ab3fc2ffcd8c4cc0a34e819a0e48804fb54bea83fd6f9b347)
|
|
65
65
|
}),
|
|
66
66
|
qPoseidon2External: Honk.G1Point({
|
|
67
|
-
x: uint256(
|
|
68
|
-
y: uint256(
|
|
67
|
+
x: uint256(0x0970a7dbc60b224774948c22f5fb332a898c1ee3d58d0f43fb93264c83fa286c),
|
|
68
|
+
y: uint256(0x2ae28ac80d915e2de014aae43275eaea6664633e567b9d0a9adc62df1a4d7d44)
|
|
69
69
|
}),
|
|
70
70
|
qPoseidon2Internal: Honk.G1Point({
|
|
71
|
-
x: uint256(
|
|
72
|
-
y: uint256(
|
|
71
|
+
x: uint256(0x00fc2a23fcea7461ae9f30e40daa1e443797f672b3af8cc3d86160cbed2d6f38),
|
|
72
|
+
y: uint256(0x0e5989283671addf0304e8efe910bfee62423958fd9f234a08c2afaf47085921)
|
|
73
73
|
}),
|
|
74
74
|
s1: Honk.G1Point({
|
|
75
|
-
x: uint256(
|
|
76
|
-
y: uint256(
|
|
75
|
+
x: uint256(0x116d95d8fa29df8b919b63e4e2bb8dc691b038a32397310dda7f19c23aebdf4f),
|
|
76
|
+
y: uint256(0x10ac1b5d343fb30c2014703c77250f91a65501fc3b632308e796734f94eac535)
|
|
77
77
|
}),
|
|
78
78
|
s2: Honk.G1Point({
|
|
79
|
-
x: uint256(
|
|
80
|
-
y: uint256(
|
|
79
|
+
x: uint256(0x0ba3c1078be00a82bcba91e57ab491d78e5929b8121a39f16bd6e8b05816264f),
|
|
80
|
+
y: uint256(0x11414a2d53f19eeff566eb1b12ed03595e46da88b56b0d5cd0951de93e21be81)
|
|
81
81
|
}),
|
|
82
82
|
s3: Honk.G1Point({
|
|
83
|
-
x: uint256(
|
|
84
|
-
y: uint256(
|
|
83
|
+
x: uint256(0x10f8060e4e4cab02ac9fa8c12d49a29b386fbc0061817b52cd5dfbc7675abac9),
|
|
84
|
+
y: uint256(0x0c0b74f94500a395c0f8f078446403b3387ee9174cb76093eb8b902ae1d38d10)
|
|
85
85
|
}),
|
|
86
86
|
s4: Honk.G1Point({
|
|
87
|
-
x: uint256(
|
|
88
|
-
y: uint256(
|
|
87
|
+
x: uint256(0x1bb341a50347d9b07a53327a51b51f1650e84a9440b64f2abe6a1b2efdbded26),
|
|
88
|
+
y: uint256(0x2d156d8cbf901c205ca4bfd997172e94392f9d2683313f3bdea9e1c1cabb1800)
|
|
89
89
|
}),
|
|
90
90
|
t1: Honk.G1Point({
|
|
91
91
|
x: uint256(0x099e3bd5a0a00ab7fe18040105b9b395b5d8b7b4a63b05df652b0d10ef146d26),
|
|
@@ -104,28 +104,28 @@ library HonkVerificationKey {
|
|
|
104
104
|
y: uint256(0x261522c4089330646aff96736194949330952ae74c573d1686d9cb4a00733854)
|
|
105
105
|
}),
|
|
106
106
|
id1: Honk.G1Point({
|
|
107
|
-
x: uint256(
|
|
108
|
-
y: uint256(
|
|
107
|
+
x: uint256(0x09f2edefab63ac2d0924ec06a1cb75a8203a4cb5d5f7e6fb1344188435b8871d),
|
|
108
|
+
y: uint256(0x28b7143a9786fa4ed00739bc9bb1cbbc06cc4eaed07228964927b44739152e36)
|
|
109
109
|
}),
|
|
110
110
|
id2: Honk.G1Point({
|
|
111
|
-
x: uint256(
|
|
112
|
-
y: uint256(
|
|
111
|
+
x: uint256(0x26b0d12b95f8e2550c280cd762b8a7a0866786f5b50a27f07c2a3f468fd41906),
|
|
112
|
+
y: uint256(0x1f4f477e5649bb899c050eef0d95d27e167b1a7b04c4f23183ea6711460271a0)
|
|
113
113
|
}),
|
|
114
114
|
id3: Honk.G1Point({
|
|
115
|
-
x: uint256(
|
|
116
|
-
y: uint256(
|
|
115
|
+
x: uint256(0x1432117a5e5aba3ca4c8251a388ba3eb64c890cd7a4c9f22c375545959d3dac2),
|
|
116
|
+
y: uint256(0x257b48e60d07172dda9e5058f6e2b18cbc6d89b2a28f8fd757b2a3bb5f88aeaf)
|
|
117
117
|
}),
|
|
118
118
|
id4: Honk.G1Point({
|
|
119
|
-
x: uint256(
|
|
120
|
-
y: uint256(
|
|
119
|
+
x: uint256(0x2f923c18160c73a2066f82a3b355a59da4fb43d4da5568c2a4be9d95adb5009b),
|
|
120
|
+
y: uint256(0x03e3b6a5cdce2e6cc0fc92ffe3f43a827b4b2a315a9e6d60465b0d8e3af13802)
|
|
121
121
|
}),
|
|
122
122
|
lagrangeFirst: Honk.G1Point({
|
|
123
123
|
x: uint256(0x0000000000000000000000000000000000000000000000000000000000000001),
|
|
124
124
|
y: uint256(0x0000000000000000000000000000000000000000000000000000000000000002)
|
|
125
125
|
}),
|
|
126
126
|
lagrangeLast: Honk.G1Point({
|
|
127
|
-
x: uint256(
|
|
128
|
-
y: uint256(
|
|
127
|
+
x: uint256(0x038e31f2fc154e946f6b7b0a6c0f4dd1cfbbd2e4b3a34aea3fcbbc8941347499),
|
|
128
|
+
y: uint256(0x1e8a93342268018e092bc66947eb747178c7592b5277404a79701de88bba4c06)
|
|
129
129
|
})
|
|
130
130
|
});
|
|
131
131
|
return vk;
|
|
@@ -5,13 +5,13 @@
|
|
|
5
5
|
// or FITNESS FOR A PARTICULAR PURPOSE.
|
|
6
6
|
pragma solidity >=0.8.27;
|
|
7
7
|
|
|
8
|
-
import { E3 } from "@
|
|
9
|
-
import {
|
|
10
|
-
import { IE3Program } from "@
|
|
11
|
-
import { IDecryptionVerifier } from "@
|
|
12
|
-
import { IPkVerifier } from "@
|
|
8
|
+
import { E3 } from "@interfold/contracts/contracts/interfaces/IE3.sol";
|
|
9
|
+
import { IInterfold } from "@interfold/contracts/contracts/interfaces/IInterfold.sol";
|
|
10
|
+
import { IE3Program } from "@interfold/contracts/contracts/interfaces/IE3Program.sol";
|
|
11
|
+
import { IDecryptionVerifier } from "@interfold/contracts/contracts/interfaces/IDecryptionVerifier.sol";
|
|
12
|
+
import { IPkVerifier } from "@interfold/contracts/contracts/interfaces/IPkVerifier.sol";
|
|
13
13
|
|
|
14
|
-
contract
|
|
14
|
+
contract MockInterfold {
|
|
15
15
|
bytes public plaintextOutput;
|
|
16
16
|
bytes32 public committeePublicKey;
|
|
17
17
|
|
|
@@ -22,12 +22,12 @@ contract MockEnclave {
|
|
|
22
22
|
function request(address program) external {
|
|
23
23
|
e3s[nextE3Id] = E3({
|
|
24
24
|
seed: 0,
|
|
25
|
-
committeeSize:
|
|
25
|
+
committeeSize: IInterfold.CommitteeSize.Minimum,
|
|
26
26
|
requestBlock: 0,
|
|
27
27
|
inputWindow: [uint256(0), uint256(0)],
|
|
28
28
|
encryptionSchemeId: bytes32(0),
|
|
29
29
|
e3Program: IE3Program(address(0)),
|
|
30
|
-
|
|
30
|
+
paramSet: 0, // Insecure512
|
|
31
31
|
customParams: abi.encode(address(0), nextE3Id, 2, 0, 0),
|
|
32
32
|
decryptionVerifier: IDecryptionVerifier(address(0)),
|
|
33
33
|
pkVerifier: IPkVerifier(address(0)),
|
|
@@ -51,20 +51,20 @@ contract MockEnclave {
|
|
|
51
51
|
committeePublicKey = publicKeyHash;
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
function getE3Stage(uint256) external view returns (
|
|
55
|
-
return
|
|
54
|
+
function getE3Stage(uint256) external view returns (IInterfold.E3Stage) {
|
|
55
|
+
return IInterfold.E3Stage.KeyPublished;
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
function getE3(uint256) external view returns (E3 memory) {
|
|
59
59
|
return
|
|
60
60
|
E3({
|
|
61
61
|
seed: 0,
|
|
62
|
-
committeeSize:
|
|
62
|
+
committeeSize: IInterfold.CommitteeSize.Minimum,
|
|
63
63
|
requestBlock: 0,
|
|
64
64
|
inputWindow: [uint256(0), block.timestamp + 100],
|
|
65
65
|
encryptionSchemeId: bytes32(0),
|
|
66
66
|
e3Program: IE3Program(address(0)),
|
|
67
|
-
|
|
67
|
+
paramSet: 0, // Insecure512
|
|
68
68
|
customParams: abi.encode(address(0), 0, 2, 0, 0),
|
|
69
69
|
decryptionVerifier: IDecryptionVerifier(address(0)),
|
|
70
70
|
pkVerifier: IPkVerifier(address(0)),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crisp-e3/contracts",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"files": [
|
|
6
6
|
"contracts",
|
|
@@ -31,19 +31,12 @@
|
|
|
31
31
|
"@zk-kit/lazy-imt.sol": "2.0.0-beta.12",
|
|
32
32
|
"poseidon-solidity": "^0.0.5",
|
|
33
33
|
"solady": "^0.1.13",
|
|
34
|
-
"@
|
|
34
|
+
"@interfold/contracts": "0.3.0"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@nomicfoundation/hardhat-ethers": "4",
|
|
38
|
-
"@nomicfoundation/hardhat-ethers-chai-matchers": "^3.0.0",
|
|
39
|
-
"@nomicfoundation/hardhat-network-helpers": "3",
|
|
40
|
-
"@nomicfoundation/hardhat-toolbox": "^5.0.0",
|
|
41
37
|
"@nomicfoundation/hardhat-toolbox-mocha-ethers": "3.0.0",
|
|
42
|
-
"@nomicfoundation/hardhat-typechain": "3",
|
|
43
|
-
"@nomicfoundation/hardhat-verify": "^3.0.1",
|
|
44
38
|
"@openzeppelin/contracts": "^5.0.2",
|
|
45
39
|
"@typechain/ethers-v6": "^0.5.0",
|
|
46
|
-
"@typechain/hardhat": "^9.0.0",
|
|
47
40
|
"@types/chai": "^4.2.0",
|
|
48
41
|
"@types/mocha": ">=9.1.0",
|
|
49
42
|
"@types/node": "^22.18.0",
|
|
@@ -51,7 +44,7 @@
|
|
|
51
44
|
"dotenv": "^16.4.5",
|
|
52
45
|
"ethers": "^6.15.0",
|
|
53
46
|
"forge-std": "github:foundry-rs/forge-std#v1.9.4",
|
|
54
|
-
"hardhat": "
|
|
47
|
+
"hardhat": "3.0.11",
|
|
55
48
|
"hardhat-deploy": "^0.12.4",
|
|
56
49
|
"hardhat-gas-reporter": "^1.0.8",
|
|
57
50
|
"solidity-coverage": "^0.8.1",
|
|
@@ -59,8 +52,8 @@
|
|
|
59
52
|
"typechain": "^8.3.0",
|
|
60
53
|
"typescript": "5.8.3",
|
|
61
54
|
"viem": "2.30.6",
|
|
62
|
-
"@crisp-e3/
|
|
63
|
-
"@crisp-e3/
|
|
55
|
+
"@crisp-e3/zk-inputs": "^0.11.0",
|
|
56
|
+
"@crisp-e3/sdk": "^0.11.0"
|
|
64
57
|
},
|
|
65
58
|
"scripts": {
|
|
66
59
|
"compile": "hardhat compile",
|
|
@@ -70,8 +63,8 @@
|
|
|
70
63
|
"clean:deployments": "hardhat utils:clean-deployments",
|
|
71
64
|
"deploy:contracts": "hardhat run deploy/deploy.ts",
|
|
72
65
|
"deploy:contracts:mock": "export USE_MOCKS=true PRINT_ENV_VARS=true && pnpm deploy:contracts",
|
|
73
|
-
"deploy:contracts:full": "export
|
|
74
|
-
"deploy:contracts:full:mock": "export
|
|
66
|
+
"deploy:contracts:full": "export DEPLOY_INTERFOLD=true && pnpm deploy:contracts",
|
|
67
|
+
"deploy:contracts:full:mock": "export DEPLOY_INTERFOLD=true USE_MOCKS=true PRINT_ENV_VARS=true && pnpm deploy:contracts",
|
|
75
68
|
"test": "hardhat test mocha",
|
|
76
69
|
"verify": "hardhat run deploy/verify.ts",
|
|
77
70
|
"updateSubmissionWindow": "hardhat ciphernode:window"
|