@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 CHANGED
@@ -22,47 +22,36 @@ pnpm test
22
22
 
23
23
  ## Deployment
24
24
 
25
- ### For testing
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
- For testing, you can deploy the contracts without using the Risc0 verifier. The following command
28
- can be run:
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
- ```bash
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:full
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 enclave program for secure voting.
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 Enclave (`Enclave.request`).
58
- - `verify` - that is called when the ciphertext output is published on Enclave
59
- (`Enclave.publishCiphertextOutput`). This function ensures that the ciphertext output is valid.
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 Enclave contract when a new input is published (`Enclave.publishInput`). In CRISP, the data
64
- providers (the ones submitting the inputs) are the voters, and the input submitted is the vote
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/enclave/tree/main/circuits/crates/libs/greco). See the
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 "@enclave-e3/contracts/contracts/interfaces/IE3Program.sol";
11
- import { IEnclave } from "@enclave-e3/contracts/contracts/interfaces/IEnclave.sol";
12
- import { E3 } from "@enclave-e3/contracts/contracts/interfaces/IE3.sol";
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
- IEnclave public enclave;
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 EnclaveAddressZero();
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 _enclave The enclave address
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(IEnclave _enclave, IRiscZeroVerifier _risc0Verifier, HonkVerifier _honkVerifier, bytes32 _imageId) Ownable(msg.sender) {
80
- if (address(_enclave) == address(0)) revert EnclaveAddressZero();
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
- enclave = _enclave;
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(enclave) && msg.sender != owner()) revert CallerNotAuthorized();
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 = enclave.getE3(e3Id);
150
+ E3 memory e3 = interfold.getE3(e3Id);
151
151
 
152
152
  // check that we are in the correct stage
153
- IEnclave.E3Stage stage = enclave.getE3Stage(e3Id);
154
- if (stage != IEnclave.E3Stage.KeyPublished) {
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 = enclave.getE3(e3Id);
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 = 0x0a2a97cbcf70be68e297357fc7b940d5c4a69e571fda313ec2749d9b9edb5eac;
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(0x242d54b68c66568368d0404f9cd1b34bc0a494cedfcc53c14bd6945f504fdb48),
20
- y: uint256(0x2157a81ed36f526beb4f73ddd0ba9eefff28f4e2681efea259d897a7ccc2b7c5)
19
+ x: uint256(0x188b8bd77632a8af920326bfc2d2281a3cf604913221391edf1ac9fe02120ed1),
20
+ y: uint256(0x147f80c895be168b9689d122f5bdedb2296de44d941e5378c591d23574445cc4)
21
21
  }),
22
22
  qr: Honk.G1Point({
23
- x: uint256(0x220f22ce02c5f86433f0b0c092eb10d7a6f8665a8ed85ad10ecdf1263597233b),
24
- y: uint256(0x0bd316345847358ce7158797f94bde087c32ab752c4a7719a11b4bdbbc84f974)
23
+ x: uint256(0x1a02c9f1ae6e0b1037b0881654328eec39501f97ae51aaffeb05eb3a2b2de119),
24
+ y: uint256(0x29eb45831f58c59b72bf876b4a67f63a98a3bbf96487afec9f7a2c2210972b5b)
25
25
  }),
26
26
  qo: Honk.G1Point({
27
- x: uint256(0x008acfd1ebe1d9a02e4f382defde95296beee0d436243203888814709d9010f6),
28
- y: uint256(0x1baf2528d464b5eb2d89e2c945de6b316ab2276dc4bb2f54018e1f30d7a74e5b)
27
+ x: uint256(0x26f8a24a0977ba8288b255e99a4529da51a051e128c629c3a748f5de3c5bb0ef),
28
+ y: uint256(0x258179ad2b2e943faeae74eed595dd5f8a3849b28af17e01546cccd47619746c)
29
29
  }),
30
30
  q4: Honk.G1Point({
31
- x: uint256(0x28049e993f2d92edee7f7e0e88db6a2b3cd685e315c008b6756f0c57da94f2a8),
32
- y: uint256(0x1ab99eec5fc4626da9bdd107f385e5c7789645af76f89ad39eebfd688e42d551)
31
+ x: uint256(0x29c3b196a166824a0dad36a68b62c2ab74baa3acf00d43599e24149cabd77b3c),
32
+ y: uint256(0x08866f6cafd256c09ccdf564dad394dc082ca16221bb3a8b4957437ac54e4d5b)
33
33
  }),
34
34
  qm: Honk.G1Point({
35
- x: uint256(0x1e10931f45270e5b77bd6527dac65c9686699918ae2b72c79c3f2fd8f5b4eaf7),
36
- y: uint256(0x10ca3b75073c6976ed27c79f4c447b858cf1c2f6df9bd7c2c29ef3e6394539df)
35
+ x: uint256(0x0b70643590be080324d22dd1d1044b39f979d1b8c4a9994bad2c12fe031fdbd8),
36
+ y: uint256(0x094b2f9ef76de679e3696371ad08d24c549f710efc6d635f114e9eff35e2a4cf)
37
37
  }),
38
38
  qc: Honk.G1Point({
39
- x: uint256(0x1411083d6937bc5991da7850d0b6d1cd35a91c9a9005b9916ce1fe624913dd2e),
40
- y: uint256(0x07863eeb3af1ada7c6ddcfe010829a22ee57628b375e23d25813c137b5d85cc0)
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(0x03130a68b3e95125f16a488caab56bd8696b7916b06b7ec38b82ec8eeef502fb),
48
- y: uint256(0x2d3817390db7d4de3a9992c85d10ead9152303f1b0b1fc090c5212c8465e8849)
47
+ x: uint256(0x1650ab20908fac8b39842f152937e151f60f4b68ca0a64de89b55769a5a388a9),
48
+ y: uint256(0x1230774514e3201dd3195bffe89d5ad12c88a817767171ae920aa8c93d54d0b1)
49
49
  }),
50
50
  qDeltaRange: Honk.G1Point({
51
- x: uint256(0x03e8f687eff189f129b0fa24fb1596c0e45521032cf95b37a8010f90289cee28),
52
- y: uint256(0x0687c67cf56e0e6cbbd7f9d240c482ce7c29529c2c2645a13d458200691ceabd)
51
+ x: uint256(0x20dcdd6ad6159d21d6fd1cf6f70bb9f0fafb3fbd38d6b1590cce5fa678c75963),
52
+ y: uint256(0x0576ae3c71f00267025a13bd23d1bd2db2c93254458f93ec097efd27676fd576)
53
53
  }),
54
54
  qElliptic: Honk.G1Point({
55
- x: uint256(0x0af96472dc301f8ea15d24c89932462eff60385960a9a8e367c5afeab2f29089),
56
- y: uint256(0x073f733bd4638696274b6853acd979b76c4011b2a92df241c794cf983cad7e56)
55
+ x: uint256(0x02c698a3d957cdc72eddea30de02c84ad9e7cc3455e39f1fec996a5618f72ec0),
56
+ y: uint256(0x05c14a080f71c3ae6c538965a8707377b4cdea9213ef8679e17d53f09380c50c)
57
57
  }),
58
58
  qMemory: Honk.G1Point({
59
- x: uint256(0x28ae521fef3cd4137334cd47109c2a61b2ef60c1037ada38394cbc283ec9fb14),
60
- y: uint256(0x1db8a90ad93ca5a434d436afc55ae0fb65ba655ef04e88bc83882458399b3401)
59
+ x: uint256(0x1bc97809165931d0d7a0c80337a440c83466747f8f08e9765cc255168171063d),
60
+ y: uint256(0x2c5715175aee9ce87f01b047f4e012b5b3ad76f7caa7a71d20b6e2d532e5b03f)
61
61
  }),
62
62
  qNnf: Honk.G1Point({
63
- x: uint256(0x1efcf0bf90e4730db87f1c39c5c4d7fe5912707b8e03fb6a228cf573cbb7a847),
64
- y: uint256(0x0789f3f4a2d3e9694fb444693d3637bbe77a80c15cbc9b698aa9a2f170cb96aa)
63
+ x: uint256(0x02cf02022c04bf434cc76bc44ef892fc94199c36e6010a0ff8bbdc570811c782),
64
+ y: uint256(0x284e2925bfe6946ab3fc2ffcd8c4cc0a34e819a0e48804fb54bea83fd6f9b347)
65
65
  }),
66
66
  qPoseidon2External: Honk.G1Point({
67
- x: uint256(0x0e07a8da8d6e7d7412b2bc8932c876021c9911baf5fe244426423df1f8bd8dfe),
68
- y: uint256(0x155d9bd466fc43a12bef1ee43dcddf75a65f54c6465706583bf917157902a730)
67
+ x: uint256(0x0970a7dbc60b224774948c22f5fb332a898c1ee3d58d0f43fb93264c83fa286c),
68
+ y: uint256(0x2ae28ac80d915e2de014aae43275eaea6664633e567b9d0a9adc62df1a4d7d44)
69
69
  }),
70
70
  qPoseidon2Internal: Honk.G1Point({
71
- x: uint256(0x2a7d697eac85644ebd7ed8a6183be661a5f0af7ebc00f75b881fa6b0a9df67c9),
72
- y: uint256(0x217e586cf7f60ef4fb5448cd1983908bf66e5779b486c4b070cfaa0fafaa94ec)
71
+ x: uint256(0x00fc2a23fcea7461ae9f30e40daa1e443797f672b3af8cc3d86160cbed2d6f38),
72
+ y: uint256(0x0e5989283671addf0304e8efe910bfee62423958fd9f234a08c2afaf47085921)
73
73
  }),
74
74
  s1: Honk.G1Point({
75
- x: uint256(0x1c10347f93203cbe2177cb7d68ae09288587ece9b38576d512ee4ab299a90dba),
76
- y: uint256(0x0b0b14a9a9e530df6379cda78a6fcbb6e5d316cbbc989fd2151845db71200002)
75
+ x: uint256(0x116d95d8fa29df8b919b63e4e2bb8dc691b038a32397310dda7f19c23aebdf4f),
76
+ y: uint256(0x10ac1b5d343fb30c2014703c77250f91a65501fc3b632308e796734f94eac535)
77
77
  }),
78
78
  s2: Honk.G1Point({
79
- x: uint256(0x3043bbd2cf31841736e85916d52b6472646dfefd77bda3985fb34f2c6d29a5cf),
80
- y: uint256(0x27bd57795ffc6d6860c14d8eea99e937e5dd7a8a8e6ce65989e230ac3f147dc3)
79
+ x: uint256(0x0ba3c1078be00a82bcba91e57ab491d78e5929b8121a39f16bd6e8b05816264f),
80
+ y: uint256(0x11414a2d53f19eeff566eb1b12ed03595e46da88b56b0d5cd0951de93e21be81)
81
81
  }),
82
82
  s3: Honk.G1Point({
83
- x: uint256(0x190115ef9a99f80fdc2c2e62980b84d5c760c884b0a6ceb6f4e6ed7dbe2a858c),
84
- y: uint256(0x1fae5b7348acd64c333c14310e2165bb19bb11faa671e8736f738f6f3c7bd8bc)
83
+ x: uint256(0x10f8060e4e4cab02ac9fa8c12d49a29b386fbc0061817b52cd5dfbc7675abac9),
84
+ y: uint256(0x0c0b74f94500a395c0f8f078446403b3387ee9174cb76093eb8b902ae1d38d10)
85
85
  }),
86
86
  s4: Honk.G1Point({
87
- x: uint256(0x0420023320a950d9aefa400feb726fd04430fc5ee076dd019d474d5942c1c3f8),
88
- y: uint256(0x1e932442ae6b7199b750e766a706e7144a090e46e87558380556f21189568ac6)
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(0x0366dcbbe46bdc20ba8c32bf1f728bb3545810f0a5d1f0767e92a19b100a3ea8),
108
- y: uint256(0x22dcb03e03478e67e8430dbb8c76fc2e4f7c9c4ad95e7992681418a052349c3c)
107
+ x: uint256(0x09f2edefab63ac2d0924ec06a1cb75a8203a4cb5d5f7e6fb1344188435b8871d),
108
+ y: uint256(0x28b7143a9786fa4ed00739bc9bb1cbbc06cc4eaed07228964927b44739152e36)
109
109
  }),
110
110
  id2: Honk.G1Point({
111
- x: uint256(0x2292c4a1ae537168604b25cbd971e5d34273f59112f1f11e0bd3f6a7b5a60e3a),
112
- y: uint256(0x1463b8da6c876d73a1ef8b1d3f81d0a30fbe505ad512f7695c76e69e888cc61f)
111
+ x: uint256(0x26b0d12b95f8e2550c280cd762b8a7a0866786f5b50a27f07c2a3f468fd41906),
112
+ y: uint256(0x1f4f477e5649bb899c050eef0d95d27e167b1a7b04c4f23183ea6711460271a0)
113
113
  }),
114
114
  id3: Honk.G1Point({
115
- x: uint256(0x17e0f76be7ca15add8e69985d01b0e3926da6207cc5294805f8ac77944cf4827),
116
- y: uint256(0x0b8fc29d8ec26f1a511ff4c1e8764a754eb894c936a36c68a54a8a359d6ce313)
115
+ x: uint256(0x1432117a5e5aba3ca4c8251a388ba3eb64c890cd7a4c9f22c375545959d3dac2),
116
+ y: uint256(0x257b48e60d07172dda9e5058f6e2b18cbc6d89b2a28f8fd757b2a3bb5f88aeaf)
117
117
  }),
118
118
  id4: Honk.G1Point({
119
- x: uint256(0x07689f951bf952cf71fbadd10a9d9045989b715f48ae086d76087d7bbb11defe),
120
- y: uint256(0x2f8f2787108298eb7a85b1279018462eaf254c5a8e367c24b2837517123009f6)
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(0x03f905e0bdb4b0224867351c8f171cc3a7e876816264f9f214ab5d1b904e337e),
128
- y: uint256(0x1e089d2e9200be93bf1d960df59d5bef8f619c1daee69fa3c2ec6b95d16f4fca)
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 "@enclave-e3/contracts/contracts/interfaces/IE3.sol";
9
- import { IEnclave } from "@enclave-e3/contracts/contracts/interfaces/IEnclave.sol";
10
- import { IE3Program } from "@enclave-e3/contracts/contracts/interfaces/IE3Program.sol";
11
- import { IDecryptionVerifier } from "@enclave-e3/contracts/contracts/interfaces/IDecryptionVerifier.sol";
12
- import { IPkVerifier } from "@enclave-e3/contracts/contracts/interfaces/IPkVerifier.sol";
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 MockEnclave {
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: IEnclave.CommitteeSize.Micro,
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
- e3ProgramParams: bytes(""),
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 (IEnclave.E3Stage) {
55
- return IEnclave.E3Stage.KeyPublished;
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: IEnclave.CommitteeSize.Micro,
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
- e3ProgramParams: bytes(""),
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.9.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
- "@enclave-e3/contracts": "0.1.15"
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": "^3.0.1",
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/sdk": "^0.9.0",
63
- "@crisp-e3/zk-inputs": "^0.9.0"
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 DEPLOY_ENCLAVE=true && pnpm deploy:contracts",
74
- "deploy:contracts:full:mock": "export DEPLOY_ENCLAVE=true USE_MOCKS=true PRINT_ENV_VARS=true && pnpm deploy:contracts",
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"