@enclave-e3/contracts 0.1.7 → 0.1.8
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/artifacts/@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol/ProxyAdmin.json +1 -1
- package/artifacts/@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol/artifacts.d.ts +1 -1
- package/artifacts/@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol/ITransparentUpgradeableProxy.json +1 -1
- package/artifacts/@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol/TransparentUpgradeableProxy.json +1 -1
- package/artifacts/@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol/artifacts.d.ts +2 -2
- package/artifacts/build-info/{solc-0_8_28-4bcd87d14b711a4c77809b8506304ad531199f84.json → solc-0_8_28-bc4924096d79c352c47e61609b2798186ce67999.json} +7 -7
- package/artifacts/build-info/{solc-0_8_28-4bcd87d14b711a4c77809b8506304ad531199f84.output.json → solc-0_8_28-bc4924096d79c352c47e61609b2798186ce67999.output.json} +1 -1
- package/artifacts/contracts/Enclave.sol/Enclave.json +25 -10
- package/artifacts/contracts/Enclave.sol/artifacts.d.ts +4 -4
- package/artifacts/contracts/interfaces/IBondingRegistry.sol/IBondingRegistry.json +1 -1
- package/artifacts/contracts/interfaces/IBondingRegistry.sol/artifacts.d.ts +1 -1
- package/artifacts/contracts/interfaces/ICiphernodeRegistry.sol/ICiphernodeRegistry.json +6 -1
- package/artifacts/contracts/interfaces/ICiphernodeRegistry.sol/artifacts.d.ts +2 -2
- package/artifacts/contracts/interfaces/IComputeProvider.sol/IComputeProvider.json +1 -1
- package/artifacts/contracts/interfaces/IComputeProvider.sol/artifacts.d.ts +1 -1
- package/artifacts/contracts/interfaces/IDecryptionVerifier.sol/IDecryptionVerifier.json +1 -1
- package/artifacts/contracts/interfaces/IDecryptionVerifier.sol/artifacts.d.ts +1 -1
- package/artifacts/contracts/interfaces/IE3Program.sol/IE3Program.json +1 -1
- package/artifacts/contracts/interfaces/IE3Program.sol/artifacts.d.ts +1 -1
- package/artifacts/contracts/interfaces/IEnclave.sol/IEnclave.json +18 -8
- package/artifacts/contracts/interfaces/IEnclave.sol/artifacts.d.ts +2 -2
- package/artifacts/contracts/interfaces/ISlashVerifier.sol/ISlashVerifier.json +1 -1
- package/artifacts/contracts/interfaces/ISlashVerifier.sol/artifacts.d.ts +1 -1
- package/artifacts/contracts/interfaces/ISlashingManager.sol/ISlashingManager.json +1 -1
- package/artifacts/contracts/interfaces/ISlashingManager.sol/artifacts.d.ts +1 -1
- package/artifacts/contracts/lib/ExitQueueLib.sol/ExitQueueLib.json +1 -1
- package/artifacts/contracts/lib/ExitQueueLib.sol/artifacts.d.ts +1 -1
- package/artifacts/contracts/registry/BondingRegistry.sol/BondingRegistry.json +1 -1
- package/artifacts/contracts/registry/BondingRegistry.sol/artifacts.d.ts +1 -1
- package/artifacts/contracts/registry/CiphernodeRegistryOwnable.sol/CiphernodeRegistryOwnable.json +18 -13
- package/artifacts/contracts/registry/CiphernodeRegistryOwnable.sol/artifacts.d.ts +6 -6
- package/artifacts/contracts/slashing/SlashingManager.sol/SlashingManager.json +1 -1
- package/artifacts/contracts/slashing/SlashingManager.sol/artifacts.d.ts +1 -1
- package/artifacts/contracts/test/MockCiphernodeRegistry.sol/MockCiphernodeRegistry.json +8 -3
- package/artifacts/contracts/test/MockCiphernodeRegistry.sol/MockCiphernodeRegistryEmptyKey.json +13 -3
- package/artifacts/contracts/test/MockCiphernodeRegistry.sol/artifacts.d.ts +8 -8
- package/artifacts/contracts/test/MockComputeProvider.sol/MockComputeProvider.json +1 -1
- package/artifacts/contracts/test/MockComputeProvider.sol/artifacts.d.ts +1 -1
- package/artifacts/contracts/test/MockDecryptionVerifier.sol/MockDecryptionVerifier.json +1 -1
- package/artifacts/contracts/test/MockDecryptionVerifier.sol/artifacts.d.ts +1 -1
- package/artifacts/contracts/test/MockE3Program.sol/MockE3Program.json +1 -1
- package/artifacts/contracts/test/MockE3Program.sol/artifacts.d.ts +1 -1
- package/artifacts/contracts/test/MockSlashingVerifier.sol/MockSlashingVerifier.json +1 -1
- package/artifacts/contracts/test/MockSlashingVerifier.sol/artifacts.d.ts +1 -1
- package/artifacts/contracts/test/MockStableToken.sol/MockUSDC.json +1 -1
- package/artifacts/contracts/test/MockStableToken.sol/artifacts.d.ts +1 -1
- package/artifacts/contracts/token/EnclaveTicketToken.sol/EnclaveTicketToken.json +1 -1
- package/artifacts/contracts/token/EnclaveTicketToken.sol/artifacts.d.ts +1 -1
- package/artifacts/contracts/token/EnclaveToken.sol/EnclaveToken.json +1 -1
- package/artifacts/contracts/token/EnclaveToken.sol/artifacts.d.ts +1 -1
- package/artifacts/poseidon-solidity/PoseidonT3.sol/PoseidonT3.json +1 -1
- package/artifacts/poseidon-solidity/PoseidonT3.sol/artifacts.d.ts +1 -1
- package/contracts/Enclave.sol +5 -10
- package/contracts/interfaces/ICiphernodeRegistry.sol +3 -1
- package/contracts/interfaces/IE3.sol +3 -1
- package/contracts/interfaces/IEnclave.sol +3 -7
- package/contracts/registry/CiphernodeRegistryOwnable.sol +4 -3
- package/contracts/test/MockCiphernodeRegistry.sol +7 -3
- package/dist/hardhat.config.d.ts.map +1 -1
- package/dist/hardhat.config.js +2 -1
- package/dist/scripts/deployEnclave.d.ts.map +1 -1
- package/dist/scripts/deployEnclave.js +10 -4
- package/dist/scripts/verify.d.ts.map +1 -1
- package/dist/scripts/verify.js +8 -9
- package/dist/tasks/ciphernode.d.ts +1 -0
- package/dist/tasks/ciphernode.d.ts.map +1 -1
- package/dist/tasks/ciphernode.js +24 -0
- package/dist/tasks/enclave.d.ts.map +1 -1
- package/dist/tasks/enclave.js +13 -21
- package/dist/test/Enclave.spec.js +38 -37
- package/dist/test/Registry/CiphernodeRegistryOwnable.spec.js +5 -5
- package/dist/types/contracts/Enclave.d.ts +11 -9
- package/dist/types/contracts/Enclave.d.ts.map +1 -1
- package/dist/types/contracts/interfaces/ICiphernodeRegistry.d.ts +5 -3
- package/dist/types/contracts/interfaces/ICiphernodeRegistry.d.ts.map +1 -1
- package/dist/types/contracts/interfaces/IEnclave.d.ts +7 -7
- package/dist/types/contracts/interfaces/IEnclave.d.ts.map +1 -1
- package/dist/types/contracts/registry/CiphernodeRegistryOwnable.d.ts +5 -3
- package/dist/types/contracts/registry/CiphernodeRegistryOwnable.d.ts.map +1 -1
- package/dist/types/contracts/test/MockCiphernodeRegistry.sol/MockCiphernodeRegistry.d.ts +5 -3
- package/dist/types/contracts/test/MockCiphernodeRegistry.sol/MockCiphernodeRegistry.d.ts.map +1 -1
- package/dist/types/contracts/test/MockCiphernodeRegistry.sol/MockCiphernodeRegistryEmptyKey.d.ts +5 -3
- package/dist/types/contracts/test/MockCiphernodeRegistry.sol/MockCiphernodeRegistryEmptyKey.d.ts.map +1 -1
- package/dist/types/factories/contracts/Enclave__factory.d.ts +19 -7
- package/dist/types/factories/contracts/Enclave__factory.d.ts.map +1 -1
- package/dist/types/factories/contracts/Enclave__factory.js +23 -8
- package/dist/types/factories/contracts/interfaces/ICiphernodeRegistry__factory.d.ts +4 -0
- package/dist/types/factories/contracts/interfaces/ICiphernodeRegistry__factory.d.ts.map +1 -1
- package/dist/types/factories/contracts/interfaces/ICiphernodeRegistry__factory.js +5 -0
- package/dist/types/factories/contracts/interfaces/IEnclave__factory.d.ts +14 -6
- package/dist/types/factories/contracts/interfaces/IEnclave__factory.d.ts.map +1 -1
- package/dist/types/factories/contracts/interfaces/IEnclave__factory.js +17 -7
- package/dist/types/factories/contracts/registry/CiphernodeRegistryOwnable__factory.d.ts +5 -1
- package/dist/types/factories/contracts/registry/CiphernodeRegistryOwnable__factory.d.ts.map +1 -1
- package/dist/types/factories/contracts/registry/CiphernodeRegistryOwnable__factory.js +6 -1
- package/dist/types/factories/contracts/test/MockCiphernodeRegistry.sol/MockCiphernodeRegistryEmptyKey__factory.d.ts +9 -1
- package/dist/types/factories/contracts/test/MockCiphernodeRegistry.sol/MockCiphernodeRegistryEmptyKey__factory.d.ts.map +1 -1
- package/dist/types/factories/contracts/test/MockCiphernodeRegistry.sol/MockCiphernodeRegistryEmptyKey__factory.js +11 -1
- package/dist/types/factories/contracts/test/MockCiphernodeRegistry.sol/MockCiphernodeRegistry__factory.d.ts +5 -1
- package/dist/types/factories/contracts/test/MockCiphernodeRegistry.sol/MockCiphernodeRegistry__factory.d.ts.map +1 -1
- package/dist/types/factories/contracts/test/MockCiphernodeRegistry.sol/MockCiphernodeRegistry__factory.js +6 -1
- package/package.json +5 -5
|
@@ -44,5 +44,5 @@
|
|
|
44
44
|
"deployedLinkReferences": {},
|
|
45
45
|
"immutableReferences": {},
|
|
46
46
|
"inputSourceName": "project/contracts/test/MockComputeProvider.sol",
|
|
47
|
-
"buildInfoId": "solc-0_8_28-
|
|
47
|
+
"buildInfoId": "solc-0_8_28-bc4924096d79c352c47e61609b2798186ce67999"
|
|
48
48
|
}
|
|
@@ -15,7 +15,7 @@ export interface MockComputeProvider$Type {
|
|
|
15
15
|
readonly deployedLinkReferences: {};
|
|
16
16
|
readonly immutableReferences: {};
|
|
17
17
|
readonly inputSourceName: "project/contracts/test/MockComputeProvider.sol";
|
|
18
|
-
readonly buildInfoId: "solc-0_8_28-
|
|
18
|
+
readonly buildInfoId: "solc-0_8_28-bc4924096d79c352c47e61609b2798186ce67999";
|
|
19
19
|
};
|
|
20
20
|
|
|
21
21
|
import "hardhat/types/artifacts";
|
|
@@ -39,5 +39,5 @@
|
|
|
39
39
|
"deployedLinkReferences": {},
|
|
40
40
|
"immutableReferences": {},
|
|
41
41
|
"inputSourceName": "project/contracts/test/MockDecryptionVerifier.sol",
|
|
42
|
-
"buildInfoId": "solc-0_8_28-
|
|
42
|
+
"buildInfoId": "solc-0_8_28-bc4924096d79c352c47e61609b2798186ce67999"
|
|
43
43
|
}
|
|
@@ -15,7 +15,7 @@ export interface MockDecryptionVerifier$Type {
|
|
|
15
15
|
readonly deployedLinkReferences: {};
|
|
16
16
|
readonly immutableReferences: {};
|
|
17
17
|
readonly inputSourceName: "project/contracts/test/MockDecryptionVerifier.sol";
|
|
18
|
-
readonly buildInfoId: "solc-0_8_28-
|
|
18
|
+
readonly buildInfoId: "solc-0_8_28-bc4924096d79c352c47e61609b2798186ce67999";
|
|
19
19
|
};
|
|
20
20
|
|
|
21
21
|
import "hardhat/types/artifacts";
|
|
@@ -154,5 +154,5 @@
|
|
|
154
154
|
"deployedLinkReferences": {},
|
|
155
155
|
"immutableReferences": {},
|
|
156
156
|
"inputSourceName": "project/contracts/test/MockE3Program.sol",
|
|
157
|
-
"buildInfoId": "solc-0_8_28-
|
|
157
|
+
"buildInfoId": "solc-0_8_28-bc4924096d79c352c47e61609b2798186ce67999"
|
|
158
158
|
}
|
|
@@ -15,7 +15,7 @@ export interface MockE3Program$Type {
|
|
|
15
15
|
readonly deployedLinkReferences: {};
|
|
16
16
|
readonly immutableReferences: {};
|
|
17
17
|
readonly inputSourceName: "project/contracts/test/MockE3Program.sol";
|
|
18
|
-
readonly buildInfoId: "solc-0_8_28-
|
|
18
|
+
readonly buildInfoId: "solc-0_8_28-bc4924096d79c352c47e61609b2798186ce67999";
|
|
19
19
|
};
|
|
20
20
|
|
|
21
21
|
import "hardhat/types/artifacts";
|
|
@@ -34,5 +34,5 @@
|
|
|
34
34
|
"deployedLinkReferences": {},
|
|
35
35
|
"immutableReferences": {},
|
|
36
36
|
"inputSourceName": "project/contracts/test/MockSlashingVerifier.sol",
|
|
37
|
-
"buildInfoId": "solc-0_8_28-
|
|
37
|
+
"buildInfoId": "solc-0_8_28-bc4924096d79c352c47e61609b2798186ce67999"
|
|
38
38
|
}
|
|
@@ -15,7 +15,7 @@ export interface MockSlashingVerifier$Type {
|
|
|
15
15
|
readonly deployedLinkReferences: {};
|
|
16
16
|
readonly immutableReferences: {};
|
|
17
17
|
readonly inputSourceName: "project/contracts/test/MockSlashingVerifier.sol";
|
|
18
|
-
readonly buildInfoId: "solc-0_8_28-
|
|
18
|
+
readonly buildInfoId: "solc-0_8_28-bc4924096d79c352c47e61609b2798186ce67999";
|
|
19
19
|
};
|
|
20
20
|
|
|
21
21
|
import "hardhat/types/artifacts";
|
|
@@ -421,5 +421,5 @@
|
|
|
421
421
|
"deployedLinkReferences": {},
|
|
422
422
|
"immutableReferences": {},
|
|
423
423
|
"inputSourceName": "project/contracts/test/MockStableToken.sol",
|
|
424
|
-
"buildInfoId": "solc-0_8_28-
|
|
424
|
+
"buildInfoId": "solc-0_8_28-bc4924096d79c352c47e61609b2798186ce67999"
|
|
425
425
|
}
|
|
@@ -15,7 +15,7 @@ export interface MockUSDC$Type {
|
|
|
15
15
|
readonly deployedLinkReferences: {};
|
|
16
16
|
readonly immutableReferences: {};
|
|
17
17
|
readonly inputSourceName: "project/contracts/test/MockStableToken.sol";
|
|
18
|
-
readonly buildInfoId: "solc-0_8_28-
|
|
18
|
+
readonly buildInfoId: "solc-0_8_28-bc4924096d79c352c47e61609b2798186ce67999";
|
|
19
19
|
};
|
|
20
20
|
|
|
21
21
|
import "hardhat/types/artifacts";
|
|
@@ -15,7 +15,7 @@ export interface EnclaveTicketToken$Type {
|
|
|
15
15
|
readonly deployedLinkReferences: {};
|
|
16
16
|
readonly immutableReferences: {"3415":[{"length":32,"start":872},{"length":32,"start":1600},{"length":32,"start":2113},{"length":32,"start":3176},{"length":32,"start":3533},{"length":32,"start":3711}],"6684":[{"length":32,"start":3942}],"6686":[{"length":32,"start":3900}],"6688":[{"length":32,"start":3858}],"6690":[{"length":32,"start":4023}],"6692":[{"length":32,"start":4063}],"6695":[{"length":32,"start":4727}],"6698":[{"length":32,"start":4772}]};
|
|
17
17
|
readonly inputSourceName: "project/contracts/token/EnclaveTicketToken.sol";
|
|
18
|
-
readonly buildInfoId: "solc-0_8_28-
|
|
18
|
+
readonly buildInfoId: "solc-0_8_28-bc4924096d79c352c47e61609b2798186ce67999";
|
|
19
19
|
};
|
|
20
20
|
|
|
21
21
|
import "hardhat/types/artifacts";
|
|
@@ -15,7 +15,7 @@ export interface EnclaveToken$Type {
|
|
|
15
15
|
readonly deployedLinkReferences: {};
|
|
16
16
|
readonly immutableReferences: {"6684":[{"length":32,"start":4826}],"6686":[{"length":32,"start":4784}],"6688":[{"length":32,"start":4742}],"6690":[{"length":32,"start":4907}],"6692":[{"length":32,"start":4947}],"6695":[{"length":32,"start":5768}],"6698":[{"length":32,"start":5813}]};
|
|
17
17
|
readonly inputSourceName: "project/contracts/token/EnclaveToken.sol";
|
|
18
|
-
readonly buildInfoId: "solc-0_8_28-
|
|
18
|
+
readonly buildInfoId: "solc-0_8_28-bc4924096d79c352c47e61609b2798186ce67999";
|
|
19
19
|
};
|
|
20
20
|
|
|
21
21
|
import "hardhat/types/artifacts";
|
|
@@ -29,5 +29,5 @@
|
|
|
29
29
|
"deployedLinkReferences": {},
|
|
30
30
|
"immutableReferences": {},
|
|
31
31
|
"inputSourceName": "npm/poseidon-solidity@0.0.5/PoseidonT3.sol",
|
|
32
|
-
"buildInfoId": "solc-0_8_28-
|
|
32
|
+
"buildInfoId": "solc-0_8_28-bc4924096d79c352c47e61609b2798186ce67999"
|
|
33
33
|
}
|
|
@@ -15,7 +15,7 @@ export interface PoseidonT3$Type {
|
|
|
15
15
|
readonly deployedLinkReferences: {};
|
|
16
16
|
readonly immutableReferences: {};
|
|
17
17
|
readonly inputSourceName: "npm/poseidon-solidity@0.0.5/PoseidonT3.sol";
|
|
18
|
-
readonly buildInfoId: "solc-0_8_28-
|
|
18
|
+
readonly buildInfoId: "solc-0_8_28-bc4924096d79c352c47e61609b2798186ce67999";
|
|
19
19
|
};
|
|
20
20
|
|
|
21
21
|
import "hardhat/types/artifacts";
|
package/contracts/Enclave.sol
CHANGED
|
@@ -257,6 +257,7 @@ contract Enclave is IEnclave, OwnableUpgradeable {
|
|
|
257
257
|
e3.committeePublicKey = hex"";
|
|
258
258
|
e3.ciphertextOutput = hex"";
|
|
259
259
|
e3.plaintextOutput = hex"";
|
|
260
|
+
e3.requester = msg.sender;
|
|
260
261
|
|
|
261
262
|
bytes32 encryptionSchemeId = requestParams.e3Program.validate(
|
|
262
263
|
e3Id,
|
|
@@ -295,10 +296,7 @@ contract Enclave is IEnclave, OwnableUpgradeable {
|
|
|
295
296
|
}
|
|
296
297
|
|
|
297
298
|
/// @inheritdoc IEnclave
|
|
298
|
-
function activate(
|
|
299
|
-
uint256 e3Id,
|
|
300
|
-
bytes calldata publicKey
|
|
301
|
-
) external returns (bool success) {
|
|
299
|
+
function activate(uint256 e3Id) external returns (bool success) {
|
|
302
300
|
E3 memory e3 = getE3(e3Id);
|
|
303
301
|
|
|
304
302
|
require(e3.expiration == 0, E3AlreadyActivated(e3Id));
|
|
@@ -307,15 +305,12 @@ contract Enclave is IEnclave, OwnableUpgradeable {
|
|
|
307
305
|
require(e3.startWindow[1] >= block.timestamp, E3Expired());
|
|
308
306
|
|
|
309
307
|
bytes32 publicKeyHash = ciphernodeRegistry.committeePublicKey(e3Id);
|
|
310
|
-
|
|
311
|
-
keccak256(publicKey) == publicKeyHash,
|
|
312
|
-
CommitteeSelectionFailed()
|
|
313
|
-
);
|
|
308
|
+
|
|
314
309
|
uint256 expiresAt = block.timestamp + e3.duration;
|
|
315
310
|
e3s[e3Id].expiration = expiresAt;
|
|
316
|
-
e3s[e3Id].committeePublicKey =
|
|
311
|
+
e3s[e3Id].committeePublicKey = publicKeyHash;
|
|
317
312
|
|
|
318
|
-
emit E3Activated(e3Id, expiresAt,
|
|
313
|
+
emit E3Activated(e3Id, expiresAt, publicKeyHash);
|
|
319
314
|
|
|
320
315
|
return true;
|
|
321
316
|
}
|
|
@@ -155,10 +155,12 @@ interface ICiphernodeRegistry {
|
|
|
155
155
|
/// @param e3Id ID of the E3 for which to select the committee.
|
|
156
156
|
/// @param nodes Array of ciphernode addresses selected for the committee.
|
|
157
157
|
/// @param publicKey The public key generated by the given committee.
|
|
158
|
+
/// @param publicKeyHash The hash of the public key.
|
|
158
159
|
function publishCommittee(
|
|
159
160
|
uint256 e3Id,
|
|
160
161
|
address[] calldata nodes,
|
|
161
|
-
bytes calldata publicKey
|
|
162
|
+
bytes calldata publicKey,
|
|
163
|
+
bytes32 publicKeyHash
|
|
162
164
|
) external;
|
|
163
165
|
|
|
164
166
|
/// @notice This function should be called by the Enclave contract to get the public key of a committee.
|
|
@@ -24,9 +24,10 @@ import { IDecryptionVerifier } from "./IDecryptionVerifier.sol";
|
|
|
24
24
|
* @param e3ProgramParams ABI encoded computation parameters specific to the E3 program
|
|
25
25
|
* @param customParams Arbitrary ABI-encoded application-defined parameters.
|
|
26
26
|
* @param decryptionVerifier Address of the output verifier contract for decryption verification
|
|
27
|
-
* @param committeePublicKey
|
|
27
|
+
* @param committeePublicKey Hash of the public key of the selected committee for this computation
|
|
28
28
|
* @param ciphertextOutput Hash of the encrypted output data produced by the computation
|
|
29
29
|
* @param plaintextOutput Decrypted output data after committee decryption
|
|
30
|
+
* @param requester Address of the entity that requested the E3 computation
|
|
30
31
|
*/
|
|
31
32
|
struct E3 {
|
|
32
33
|
uint256 seed;
|
|
@@ -43,4 +44,5 @@ struct E3 {
|
|
|
43
44
|
bytes32 committeePublicKey;
|
|
44
45
|
bytes32 ciphertextOutput;
|
|
45
46
|
bytes plaintextOutput;
|
|
47
|
+
address requester;
|
|
46
48
|
}
|
|
@@ -27,11 +27,11 @@ interface IEnclave {
|
|
|
27
27
|
/// @notice This event MUST be emitted when an Encrypted Execution Environment (E3) is successfully activated.
|
|
28
28
|
/// @param e3Id ID of the E3.
|
|
29
29
|
/// @param expiration Timestamp when committee duties expire.
|
|
30
|
-
/// @param committeePublicKey
|
|
30
|
+
/// @param committeePublicKey Hash of the public key of the committee.
|
|
31
31
|
event E3Activated(
|
|
32
32
|
uint256 e3Id,
|
|
33
33
|
uint256 expiration,
|
|
34
|
-
|
|
34
|
+
bytes32 committeePublicKey
|
|
35
35
|
);
|
|
36
36
|
|
|
37
37
|
/// @notice This event MUST be emitted when an input to an Encrypted Execution Environment (E3) is
|
|
@@ -151,12 +151,8 @@ interface IEnclave {
|
|
|
151
151
|
/// @dev This function MUST revert if the given E3 has not yet been requested.
|
|
152
152
|
/// @dev This function MUST revert if the selected node committee has not yet published a public key.
|
|
153
153
|
/// @param e3Id ID of the E3.
|
|
154
|
-
/// @param publicKey Public key of the committee.
|
|
155
154
|
/// @return success True if the E3 was successfully activated.
|
|
156
|
-
function activate(
|
|
157
|
-
uint256 e3Id,
|
|
158
|
-
bytes calldata publicKey
|
|
159
|
-
) external returns (bool success);
|
|
155
|
+
function activate(uint256 e3Id) external returns (bool success);
|
|
160
156
|
|
|
161
157
|
/// @notice This function should be called to publish input data for Encrypted Execution Environment (E3).
|
|
162
158
|
/// @dev This function MUST revert if the E3 is not yet activated.
|
|
@@ -239,10 +239,12 @@ contract CiphernodeRegistryOwnable is ICiphernodeRegistry, OwnableUpgradeable {
|
|
|
239
239
|
/// @param e3Id ID of the E3 computation
|
|
240
240
|
/// @param nodes Array of ciphernode addresses selected for the committee
|
|
241
241
|
/// @param publicKey Aggregated public key of the committee
|
|
242
|
+
/// @param publicKeyHash The hash of the public key
|
|
242
243
|
function publishCommittee(
|
|
243
244
|
uint256 e3Id,
|
|
244
245
|
address[] calldata nodes,
|
|
245
|
-
bytes calldata publicKey
|
|
246
|
+
bytes calldata publicKey,
|
|
247
|
+
bytes32 publicKeyHash
|
|
246
248
|
) external onlyOwner {
|
|
247
249
|
Committee storage c = committees[e3Id];
|
|
248
250
|
|
|
@@ -253,7 +255,6 @@ contract CiphernodeRegistryOwnable is ICiphernodeRegistry, OwnableUpgradeable {
|
|
|
253
255
|
|
|
254
256
|
// TODO: Currently we trust the owner to publish the correct committee.
|
|
255
257
|
// TODO: Need a Proof that the public key is generated from the committee
|
|
256
|
-
bytes32 publicKeyHash = keccak256(publicKey);
|
|
257
258
|
c.publicKey = publicKeyHash;
|
|
258
259
|
publicKeyHashes[e3Id] = publicKeyHash;
|
|
259
260
|
emit CommitteePublished(e3Id, nodes, publicKey);
|
|
@@ -343,7 +344,7 @@ contract CiphernodeRegistryOwnable is ICiphernodeRegistry, OwnableUpgradeable {
|
|
|
343
344
|
SubmissionWindowNotClosed()
|
|
344
345
|
);
|
|
345
346
|
// TODO: Handle what happens if the threshold is not met.
|
|
346
|
-
require(c.topNodes.length >= c.threshold[
|
|
347
|
+
require(c.topNodes.length >= c.threshold[1], ThresholdNotMet());
|
|
347
348
|
|
|
348
349
|
c.finalized = true;
|
|
349
350
|
c.committee = c.topNodes;
|
|
@@ -41,7 +41,8 @@ contract MockCiphernodeRegistry is ICiphernodeRegistry {
|
|
|
41
41
|
function publishCommittee(
|
|
42
42
|
uint256,
|
|
43
43
|
address[] calldata,
|
|
44
|
-
bytes calldata
|
|
44
|
+
bytes calldata,
|
|
45
|
+
bytes32
|
|
45
46
|
) external pure {} // solhint-disable-line no-empty-blocks
|
|
46
47
|
|
|
47
48
|
function getCommitteeNodes(
|
|
@@ -88,6 +89,8 @@ contract MockCiphernodeRegistry is ICiphernodeRegistry {
|
|
|
88
89
|
}
|
|
89
90
|
|
|
90
91
|
contract MockCiphernodeRegistryEmptyKey is ICiphernodeRegistry {
|
|
92
|
+
error CommitteeNotPublished();
|
|
93
|
+
|
|
91
94
|
function requestCommittee(
|
|
92
95
|
uint256,
|
|
93
96
|
uint256,
|
|
@@ -101,7 +104,7 @@ contract MockCiphernodeRegistryEmptyKey is ICiphernodeRegistry {
|
|
|
101
104
|
}
|
|
102
105
|
|
|
103
106
|
function committeePublicKey(uint256) external pure returns (bytes32) {
|
|
104
|
-
|
|
107
|
+
revert CommitteeNotPublished();
|
|
105
108
|
}
|
|
106
109
|
|
|
107
110
|
function isCiphernodeEligible(address) external pure returns (bool) {
|
|
@@ -117,7 +120,8 @@ contract MockCiphernodeRegistryEmptyKey is ICiphernodeRegistry {
|
|
|
117
120
|
function publishCommittee(
|
|
118
121
|
uint256,
|
|
119
122
|
address[] calldata,
|
|
120
|
-
bytes calldata
|
|
123
|
+
bytes calldata,
|
|
124
|
+
bytes32
|
|
121
125
|
) external pure {} // solhint-disable-line no-empty-blocks
|
|
122
126
|
|
|
123
127
|
function getCommitteeNodes(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hardhat.config.d.ts","sourceRoot":"","sources":["../hardhat.config.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"hardhat.config.d.ts","sourceRoot":"","sources":["../hardhat.config.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAqExD,QAAA,MAAM,MAAM,EAAE,iBA+Gb,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
package/dist/hardhat.config.js
CHANGED
|
@@ -10,7 +10,7 @@ import hardhatToolboxMochaEthersPlugin from "@nomicfoundation/hardhat-toolbox-mo
|
|
|
10
10
|
import hardhatTypechainPlugin from "@nomicfoundation/hardhat-typechain";
|
|
11
11
|
import hardhatVerify from "@nomicfoundation/hardhat-verify";
|
|
12
12
|
import dotenv from "dotenv";
|
|
13
|
-
import { ciphernodeAdd, ciphernodeAdminAdd, ciphernodeMintTokens, ciphernodeRemove, ciphernodeSiblings, } from "./tasks/ciphernode";
|
|
13
|
+
import { ciphernodeAdd, ciphernodeAdminAdd, ciphernodeMintTokens, ciphernodeRemove, ciphernodeSiblings, updateSubmissionWindow, } from "./tasks/ciphernode";
|
|
14
14
|
import { activateE3, enableE3, publishCiphertext, publishCommittee, publishInput, publishPlaintext, requestCommittee, } from "./tasks/enclave";
|
|
15
15
|
import { cleanDeploymentsTask } from "./tasks/utils";
|
|
16
16
|
dotenv.config();
|
|
@@ -79,6 +79,7 @@ const config = {
|
|
|
79
79
|
publishCommittee,
|
|
80
80
|
enableE3,
|
|
81
81
|
cleanDeploymentsTask,
|
|
82
|
+
updateSubmissionWindow,
|
|
82
83
|
],
|
|
83
84
|
networks: {
|
|
84
85
|
hardhat: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deployEnclave.d.ts","sourceRoot":"","sources":["../../scripts/deployEnclave.ts"],"names":[],"mappings":"AAkBA;;GAEG;AACH,eAAO,MAAM,aAAa,GAAU,YAAY,OAAO,
|
|
1
|
+
{"version":3,"file":"deployEnclave.d.ts","sourceRoot":"","sources":["../../scripts/deployEnclave.ts"],"names":[],"mappings":"AAkBA;;GAEG;AACH,eAAO,MAAM,aAAa,GAAU,YAAY,OAAO,kBA8LtD,CAAC"}
|
|
@@ -24,10 +24,16 @@ export const deployEnclave = async (withMocks) => {
|
|
|
24
24
|
await autoCleanForLocalhost(networkName);
|
|
25
25
|
const [owner] = await ethers.getSigners();
|
|
26
26
|
const ownerAddress = await owner.getAddress();
|
|
27
|
-
const polynomial_degree = ethers.toBigInt(
|
|
28
|
-
const plaintext_modulus = ethers.toBigInt(
|
|
29
|
-
const moduli = [
|
|
30
|
-
|
|
27
|
+
const polynomial_degree = ethers.toBigInt(512);
|
|
28
|
+
const plaintext_modulus = ethers.toBigInt(10);
|
|
29
|
+
const moduli = [
|
|
30
|
+
ethers.toBigInt("0xffffee001"),
|
|
31
|
+
ethers.toBigInt("0xffffc4001"),
|
|
32
|
+
];
|
|
33
|
+
const error1_variance = "3";
|
|
34
|
+
const encoded = ethers.AbiCoder.defaultAbiCoder().encode([
|
|
35
|
+
"tuple(uint256 degree, uint256 plaintext_modulus, uint256[] moduli, string error1_variance)",
|
|
36
|
+
], [[polynomial_degree, plaintext_modulus, moduli, error1_variance]]);
|
|
31
37
|
const THIRTY_DAYS_IN_SECONDS = 60 * 60 * 24 * 30;
|
|
32
38
|
const SORTITION_SUBMISSION_WINDOW = 10;
|
|
33
39
|
const addressOne = "0x0000000000000000000000000000000000000001";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verify.d.ts","sourceRoot":"","sources":["../../scripts/verify.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"verify.d.ts","sourceRoot":"","sources":["../../scripts/verify.ts"],"names":[],"mappings":"AAqHA;;;GAGG;AACH,eAAO,MAAM,eAAe,GAAI,OAAO,MAAM,KAAG,IA6E/C,CAAC"}
|
package/dist/scripts/verify.js
CHANGED
|
@@ -29,19 +29,18 @@ const findContractPath = (contractName, artifactsDir = "artifacts") => {
|
|
|
29
29
|
const artifact = JSON.parse(fs.readFileSync(fullPath, "utf-8"));
|
|
30
30
|
if (artifact.sourceName && artifact.contractName === contractName) {
|
|
31
31
|
const sourceName = artifact.sourceName;
|
|
32
|
-
//
|
|
32
|
+
// Normalize the source name by removing leading './' if present
|
|
33
|
+
let normalizedPath = sourceName;
|
|
34
|
+
if (normalizedPath.startsWith("./")) {
|
|
35
|
+
normalizedPath = normalizedPath.slice(2);
|
|
36
|
+
}
|
|
37
|
+
// Handle external packages (from node_modules or @ packages)
|
|
33
38
|
if (sourceName.startsWith("./@") ||
|
|
34
39
|
sourceName.startsWith("@") ||
|
|
35
40
|
sourceName.includes("node_modules")) {
|
|
36
|
-
console.log(
|
|
37
|
-
return undefined;
|
|
38
|
-
}
|
|
39
|
-
// For local contracts, remove leading './' and return the path
|
|
40
|
-
let localPath = sourceName;
|
|
41
|
-
if (localPath.startsWith("./")) {
|
|
42
|
-
localPath = localPath.slice(2);
|
|
41
|
+
console.log(`📦 Found external contract: ${contractName} (from ${normalizedPath})`);
|
|
43
42
|
}
|
|
44
|
-
return `${
|
|
43
|
+
return `${normalizedPath}:${contractName}`;
|
|
45
44
|
}
|
|
46
45
|
}
|
|
47
46
|
catch (error) {
|
|
@@ -3,4 +3,5 @@ export declare const ciphernodeRemove: import("hardhat/types/tasks").NewTaskDefi
|
|
|
3
3
|
export declare const ciphernodeMintTokens: import("hardhat/types/tasks").NewTaskDefinition;
|
|
4
4
|
export declare const ciphernodeAdminAdd: import("hardhat/types/tasks").NewTaskDefinition;
|
|
5
5
|
export declare const ciphernodeSiblings: import("hardhat/types/tasks").NewTaskDefinition;
|
|
6
|
+
export declare const updateSubmissionWindow: import("hardhat/types/tasks").NewTaskDefinition;
|
|
6
7
|
//# sourceMappingURL=ciphernode.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ciphernode.d.ts","sourceRoot":"","sources":["../../tasks/ciphernode.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ciphernode.d.ts","sourceRoot":"","sources":["../../tasks/ciphernode.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,aAAa,iDA0IhB,CAAC;AAEX,eAAO,MAAM,gBAAgB,iDA4CnB,CAAC;AAEX,eAAO,MAAM,oBAAoB,iDA2FvB,CAAC;AAEX,eAAO,MAAM,kBAAkB,iDAkNrB,CAAC;AAEX,eAAO,MAAM,kBAAkB,iDAgCrB,CAAC;AAEX,eAAO,MAAM,sBAAsB,iDAoCzB,CAAC"}
|
package/dist/tasks/ciphernode.js
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
import { LeanIMT } from "@zk-kit/lean-imt";
|
|
7
7
|
import { ZeroAddress } from "ethers";
|
|
8
8
|
import { task } from "hardhat/config";
|
|
9
|
+
import { ArgumentType } from "hardhat/types/arguments";
|
|
9
10
|
import { poseidon2 } from "poseidon-lite";
|
|
10
11
|
export const ciphernodeAdd = task("ciphernode:add", "Register a ciphernode to the bonding registry and ciphernode registry")
|
|
11
12
|
.addOption({
|
|
@@ -341,3 +342,26 @@ export const ciphernodeSiblings = task("ciphernode:siblings", "Get the sibling o
|
|
|
341
342
|
},
|
|
342
343
|
}))
|
|
343
344
|
.build();
|
|
345
|
+
export const updateSubmissionWindow = task("ciphernode:window", "Update the submission window for the ciphernode registry")
|
|
346
|
+
.addOption({
|
|
347
|
+
name: "newWindow",
|
|
348
|
+
description: "the new submission window",
|
|
349
|
+
defaultValue: 10,
|
|
350
|
+
type: ArgumentType.INT,
|
|
351
|
+
})
|
|
352
|
+
.setAction(async () => ({
|
|
353
|
+
default: async ({ newWindow }, hre) => {
|
|
354
|
+
const { deployAndSaveCiphernodeRegistryOwnable } = await import("../scripts/deployAndSave/ciphernodeRegistryOwnable");
|
|
355
|
+
const { deployAndSavePoseidonT3 } = await import("../scripts/deployAndSave/poseidonT3");
|
|
356
|
+
const poseidonT3 = await deployAndSavePoseidonT3({ hre });
|
|
357
|
+
const { ciphernodeRegistry } = await deployAndSaveCiphernodeRegistryOwnable({
|
|
358
|
+
hre,
|
|
359
|
+
poseidonT3Address: poseidonT3,
|
|
360
|
+
});
|
|
361
|
+
const tx = await ciphernodeRegistry.setSortitionSubmissionWindow(newWindow);
|
|
362
|
+
console.log("Updating submission window... ", tx.hash);
|
|
363
|
+
await tx.wait();
|
|
364
|
+
console.log(`Submission window update to ${newWindow}`);
|
|
365
|
+
},
|
|
366
|
+
}))
|
|
367
|
+
.build();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enclave.d.ts","sourceRoot":"","sources":["../../tasks/enclave.ts"],"names":[],"mappings":"AAYA,eAAO,MAAM,gBAAgB,iDAkMnB,CAAC;AAEX,eAAO,MAAM,QAAQ,iDAyBX,CAAC;AAEX,eAAO,MAAM,gBAAgB,
|
|
1
|
+
{"version":3,"file":"enclave.d.ts","sourceRoot":"","sources":["../../tasks/enclave.ts"],"names":[],"mappings":"AAYA,eAAO,MAAM,gBAAgB,iDAkMnB,CAAC;AAEX,eAAO,MAAM,QAAQ,iDAyBX,CAAC;AAEX,eAAO,MAAM,gBAAgB,iDAsEnB,CAAC;AAEX,eAAO,MAAM,UAAU,iDAyBb,CAAC;AAEX,eAAO,MAAM,YAAY,iDA+Cf,CAAC;AAEX,eAAO,MAAM,iBAAiB,iDAsEpB,CAAC;AAEX,eAAO,MAAM,gBAAgB,iDAsEnB,CAAC"}
|
package/dist/tasks/enclave.js
CHANGED
|
@@ -179,9 +179,15 @@ export const publishCommittee = task("committee:publish", "Publish the publickey
|
|
|
179
179
|
description: "public key of the committee",
|
|
180
180
|
defaultValue: "",
|
|
181
181
|
type: ArgumentType.STRING,
|
|
182
|
+
})
|
|
183
|
+
.addOption({
|
|
184
|
+
name: "publicKeyHash",
|
|
185
|
+
description: "hash of the public key (bytes32)",
|
|
186
|
+
defaultValue: "",
|
|
187
|
+
type: ArgumentType.STRING,
|
|
182
188
|
})
|
|
183
189
|
.setAction(async () => ({
|
|
184
|
-
default: async ({ e3Id, nodes, publicKey }, hre) => {
|
|
190
|
+
default: async ({ e3Id, nodes, publicKey, publicKeyHash }, hre) => {
|
|
185
191
|
const { deployAndSaveCiphernodeRegistryOwnable } = await import("../scripts/deployAndSave/ciphernodeRegistryOwnable");
|
|
186
192
|
const { deployAndSavePoseidonT3 } = await import("../scripts/deployAndSave/poseidonT3");
|
|
187
193
|
const poseidonT3 = await deployAndSavePoseidonT3({ hre });
|
|
@@ -196,7 +202,10 @@ export const publishCommittee = task("committee:publish", "Publish the publickey
|
|
|
196
202
|
if (nodesToSend.length === 0 && nodes.length > 0) {
|
|
197
203
|
throw new Error("Invalid nodes format: no valid addresses found");
|
|
198
204
|
}
|
|
199
|
-
|
|
205
|
+
if (!publicKeyHash) {
|
|
206
|
+
throw new Error("publicKeyHash is required");
|
|
207
|
+
}
|
|
208
|
+
const tx = await ciphernodeRegistry.publishCommittee(e3Id, nodesToSend, publicKey, publicKeyHash);
|
|
200
209
|
console.log("Publishing committee... ", tx.hash);
|
|
201
210
|
await tx.wait();
|
|
202
211
|
console.log(`Committee public key published`);
|
|
@@ -209,31 +218,14 @@ export const activateE3 = task("e3:activate", "Activate an E3 program")
|
|
|
209
218
|
description: "Id of the E3 program",
|
|
210
219
|
defaultValue: 0,
|
|
211
220
|
type: ArgumentType.INT,
|
|
212
|
-
})
|
|
213
|
-
.addOption({
|
|
214
|
-
name: "publicKey",
|
|
215
|
-
description: "public key of the committee",
|
|
216
|
-
defaultValue: "",
|
|
217
|
-
type: ArgumentType.STRING,
|
|
218
|
-
})
|
|
219
|
-
.addOption({
|
|
220
|
-
name: "publicKeyFile",
|
|
221
|
-
description: "path to file containing the public key",
|
|
222
|
-
defaultValue: "",
|
|
223
|
-
type: ArgumentType.STRING,
|
|
224
221
|
})
|
|
225
222
|
.setAction(async () => ({
|
|
226
|
-
default: async ({ e3Id
|
|
227
|
-
const publicKey = publicKeyArg ||
|
|
228
|
-
(publicKeyFile ? fs.readFileSync(publicKeyFile, "utf8").trim() : "") ||
|
|
229
|
-
process.env.PUBLIC_KEY;
|
|
230
|
-
if (!publicKey)
|
|
231
|
-
throw new Error("No public key provided!");
|
|
223
|
+
default: async ({ e3Id }, hre) => {
|
|
232
224
|
const { deployAndSaveEnclave } = await import("../scripts/deployAndSave/enclave");
|
|
233
225
|
const { enclave } = await deployAndSaveEnclave({
|
|
234
226
|
hre,
|
|
235
227
|
});
|
|
236
|
-
const tx = await enclave.activate(e3Id
|
|
228
|
+
const tx = await enclave.activate(e3Id);
|
|
237
229
|
console.log("Activating E3 program... ", tx.hash);
|
|
238
230
|
await tx.wait();
|
|
239
231
|
console.log(`E3 program activated`);
|