@enclave-e3/contracts 0.1.11 → 0.1.13
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 +3 -3
- package/artifacts/@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol/artifacts.d.ts +3 -3
- package/artifacts/@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol/ITransparentUpgradeableProxy.json +1 -1
- package/artifacts/@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol/TransparentUpgradeableProxy.json +3 -3
- package/artifacts/@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol/artifacts.d.ts +4 -4
- package/artifacts/build-info/{solc-0_8_28-c77ac33099bb85c15f46d194dd2b735e036cb799.json → solc-0_8_28-e60a5d7c133605edcf61acdd5ba43ab44ee0928e.json} +27 -12
- package/artifacts/build-info/solc-0_8_28-e60a5d7c133605edcf61acdd5ba43ab44ee0928e.output.json +1 -0
- package/artifacts/contracts/E3RefundManager.sol/E3RefundManager.json +684 -0
- package/artifacts/contracts/E3RefundManager.sol/artifacts.d.ts +27 -0
- package/artifacts/contracts/Enclave.sol/Enclave.json +530 -182
- package/artifacts/contracts/Enclave.sol/artifacts.d.ts +4 -4
- package/artifacts/contracts/interfaces/IBondingRegistry.sol/IBondingRegistry.json +14 -1
- package/artifacts/contracts/interfaces/IBondingRegistry.sol/artifacts.d.ts +2 -2
- package/artifacts/contracts/interfaces/ICiphernodeRegistry.sol/ICiphernodeRegistry.json +55 -5
- 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 +19 -24
- package/artifacts/contracts/interfaces/IE3Program.sol/artifacts.d.ts +2 -2
- package/artifacts/contracts/interfaces/IE3RefundManager.sol/IE3RefundManager.json +470 -0
- package/artifacts/contracts/interfaces/IE3RefundManager.sol/artifacts.d.ts +27 -0
- package/artifacts/contracts/interfaces/IEnclave.sol/IEnclave.json +383 -128
- 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 +16 -3
- package/artifacts/contracts/registry/BondingRegistry.sol/artifacts.d.ts +4 -4
- package/artifacts/contracts/registry/CiphernodeRegistryOwnable.sol/CiphernodeRegistryOwnable.json +91 -25
- package/artifacts/contracts/registry/CiphernodeRegistryOwnable.sol/artifacts.d.ts +6 -6
- package/artifacts/contracts/slashing/SlashingManager.sol/SlashingManager.json +3 -3
- package/artifacts/contracts/slashing/SlashingManager.sol/artifacts.d.ts +3 -3
- package/artifacts/contracts/test/MockCiphernodeRegistry.sol/MockCiphernodeRegistry.json +57 -7
- package/artifacts/contracts/test/MockCiphernodeRegistry.sol/MockCiphernodeRegistryEmptyKey.json +57 -7
- package/artifacts/contracts/test/MockCiphernodeRegistry.sol/artifacts.d.ts +8 -8
- package/artifacts/contracts/test/MockComputeProvider.sol/MockComputeProvider.json +3 -3
- package/artifacts/contracts/test/MockComputeProvider.sol/artifacts.d.ts +3 -3
- 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 +21 -26
- package/artifacts/contracts/test/MockE3Program.sol/artifacts.d.ts +4 -4
- 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 +3 -3
- package/artifacts/contracts/test/MockStableToken.sol/artifacts.d.ts +3 -3
- package/artifacts/contracts/token/EnclaveTicketToken.sol/EnclaveTicketToken.json +14 -22
- package/artifacts/contracts/token/EnclaveTicketToken.sol/artifacts.d.ts +4 -4
- package/artifacts/contracts/token/EnclaveToken.sol/EnclaveToken.json +10 -10
- package/artifacts/contracts/token/EnclaveToken.sol/artifacts.d.ts +4 -4
- package/artifacts/contracts/verifier/DkgPkVerifier.sol/BaseZKHonkVerifier.json +89 -0
- package/artifacts/contracts/verifier/DkgPkVerifier.sol/CommitmentSchemeLib.json +13 -0
- package/artifacts/contracts/verifier/DkgPkVerifier.sol/DkgPkVerifier.json +186 -0
- package/artifacts/contracts/verifier/DkgPkVerifier.sol/FrLib.json +13 -0
- package/artifacts/contracts/verifier/DkgPkVerifier.sol/Honk.json +13 -0
- package/artifacts/contracts/verifier/DkgPkVerifier.sol/HonkVerificationKey.json +13 -0
- package/artifacts/contracts/verifier/DkgPkVerifier.sol/IVerifier.json +38 -0
- package/artifacts/contracts/verifier/DkgPkVerifier.sol/RelationsLib.json +13 -0
- package/artifacts/contracts/verifier/DkgPkVerifier.sol/ZKTranscriptLib.json +400 -0
- package/artifacts/contracts/verifier/DkgPkVerifier.sol/artifacts.d.ts +155 -0
- package/artifacts/poseidon-solidity/PoseidonT3.sol/PoseidonT3.json +1 -1
- package/artifacts/poseidon-solidity/PoseidonT3.sol/artifacts.d.ts +1 -1
- package/contracts/E3RefundManager.sol +365 -0
- package/contracts/Enclave.sol +426 -119
- package/contracts/interfaces/IBondingRegistry.sol +6 -0
- package/contracts/interfaces/ICiphernodeRegistry.sol +29 -7
- package/contracts/interfaces/IE3.sol +2 -6
- package/contracts/interfaces/IE3Program.sol +3 -7
- package/contracts/interfaces/IE3RefundManager.sol +150 -0
- package/contracts/interfaces/IEnclave.sol +186 -64
- package/contracts/registry/BondingRegistry.sol +9 -0
- package/contracts/registry/CiphernodeRegistryOwnable.sol +89 -42
- package/contracts/test/MockCiphernodeRegistry.sol +20 -6
- package/contracts/test/MockE3Program.sol +3 -8
- package/contracts/verifier/DkgPkVerifier.sol +3140 -0
- package/dist/hardhat.config.d.ts.map +1 -1
- package/dist/hardhat.config.js +4 -4
- package/dist/ignition/modules/dkgPkVerifier.d.ts +3 -0
- package/dist/ignition/modules/dkgPkVerifier.d.ts.map +1 -0
- package/dist/ignition/modules/dkgPkVerifier.js +10 -0
- package/dist/ignition/modules/e3RefundManager.d.ts +3 -0
- package/dist/ignition/modules/e3RefundManager.d.ts.map +1 -0
- package/dist/ignition/modules/e3RefundManager.js +23 -0
- package/dist/ignition/modules/enclave.d.ts.map +1 -1
- package/dist/ignition/modules/enclave.js +10 -0
- package/dist/scripts/deployAndSave/e3RefundManager.d.ts +20 -0
- package/dist/scripts/deployAndSave/e3RefundManager.d.ts.map +1 -0
- package/dist/scripts/deployAndSave/e3RefundManager.js +55 -0
- package/dist/scripts/deployAndSave/enclave.d.ts +13 -1
- package/dist/scripts/deployAndSave/enclave.d.ts.map +1 -1
- package/dist/scripts/deployAndSave/enclave.js +8 -1
- package/dist/scripts/deployAndSave/verifiers.d.ts +29 -0
- package/dist/scripts/deployAndSave/verifiers.d.ts.map +1 -0
- package/dist/scripts/deployAndSave/verifiers.js +109 -0
- package/dist/scripts/deployEnclave.d.ts.map +1 -1
- package/dist/scripts/deployEnclave.js +36 -0
- package/dist/scripts/deployVerifiers.d.ts +2 -0
- package/dist/scripts/deployVerifiers.d.ts.map +1 -0
- package/dist/scripts/deployVerifiers.js +33 -0
- package/dist/scripts/index.d.ts +1 -0
- package/dist/scripts/index.d.ts.map +1 -1
- package/dist/scripts/index.js +1 -0
- package/dist/tasks/enclave.d.ts +0 -2
- package/dist/tasks/enclave.d.ts.map +1 -1
- package/dist/tasks/enclave.js +8 -72
- package/dist/tasks/program.d.ts +2 -0
- package/dist/tasks/program.d.ts.map +1 -0
- package/dist/tasks/program.js +55 -0
- package/dist/test/E3Lifecycle/E3Integration.spec.d.ts +2 -0
- package/dist/test/E3Lifecycle/E3Integration.spec.d.ts.map +1 -0
- package/dist/test/E3Lifecycle/E3Integration.spec.js +757 -0
- package/dist/test/Enclave.spec.js +83 -406
- package/dist/test/Registry/CiphernodeRegistryOwnable.spec.js +133 -59
- package/dist/types/contracts/E3RefundManager.d.ts +379 -0
- package/dist/types/contracts/E3RefundManager.d.ts.map +1 -0
- package/dist/types/contracts/E3RefundManager.js +24 -0
- package/dist/types/contracts/Enclave.d.ts +325 -73
- package/dist/types/contracts/Enclave.d.ts.map +1 -1
- package/dist/types/contracts/Enclave.js +27 -3
- package/dist/types/contracts/index.d.ts +3 -0
- package/dist/types/contracts/index.d.ts.map +1 -1
- package/dist/types/contracts/interfaces/IBondingRegistry.d.ts +11 -1
- package/dist/types/contracts/interfaces/IBondingRegistry.d.ts.map +1 -1
- package/dist/types/contracts/interfaces/ICiphernodeRegistry.d.ts +35 -7
- package/dist/types/contracts/interfaces/ICiphernodeRegistry.d.ts.map +1 -1
- package/dist/types/contracts/interfaces/ICiphernodeRegistry.js +4 -0
- package/dist/types/contracts/interfaces/IE3Program.d.ts +16 -18
- package/dist/types/contracts/interfaces/IE3Program.d.ts.map +1 -1
- package/dist/types/contracts/interfaces/IE3RefundManager.d.ts +238 -0
- package/dist/types/contracts/interfaces/IE3RefundManager.d.ts.map +1 -0
- package/dist/types/contracts/interfaces/IE3RefundManager.js +16 -0
- package/dist/types/contracts/interfaces/IEnclave.d.ts +290 -62
- package/dist/types/contracts/interfaces/IEnclave.d.ts.map +1 -1
- package/dist/types/contracts/interfaces/IEnclave.js +27 -3
- package/dist/types/contracts/interfaces/index.d.ts +1 -0
- package/dist/types/contracts/interfaces/index.d.ts.map +1 -1
- package/dist/types/contracts/registry/BondingRegistry.d.ts +11 -1
- package/dist/types/contracts/registry/BondingRegistry.d.ts.map +1 -1
- package/dist/types/contracts/registry/CiphernodeRegistryOwnable.d.ts +35 -7
- package/dist/types/contracts/registry/CiphernodeRegistryOwnable.d.ts.map +1 -1
- package/dist/types/contracts/registry/CiphernodeRegistryOwnable.js +4 -0
- package/dist/types/contracts/test/MockCiphernodeRegistry.sol/MockCiphernodeRegistry.d.ts +35 -7
- package/dist/types/contracts/test/MockCiphernodeRegistry.sol/MockCiphernodeRegistry.d.ts.map +1 -1
- package/dist/types/contracts/test/MockCiphernodeRegistry.sol/MockCiphernodeRegistry.js +4 -0
- package/dist/types/contracts/test/MockCiphernodeRegistry.sol/MockCiphernodeRegistryEmptyKey.d.ts +35 -7
- package/dist/types/contracts/test/MockCiphernodeRegistry.sol/MockCiphernodeRegistryEmptyKey.d.ts.map +1 -1
- package/dist/types/contracts/test/MockCiphernodeRegistry.sol/MockCiphernodeRegistryEmptyKey.js +4 -0
- package/dist/types/contracts/test/MockE3Program.d.ts +16 -18
- package/dist/types/contracts/test/MockE3Program.d.ts.map +1 -1
- package/dist/types/contracts/verifier/DkgPkVerifier.sol/BaseZKHonkVerifier.d.ts +36 -0
- package/dist/types/contracts/verifier/DkgPkVerifier.sol/BaseZKHonkVerifier.d.ts.map +1 -0
- package/dist/types/contracts/verifier/DkgPkVerifier.sol/BaseZKHonkVerifier.js +1 -0
- package/dist/types/contracts/verifier/DkgPkVerifier.sol/DkgPkVerifier.d.ts +36 -0
- package/dist/types/contracts/verifier/DkgPkVerifier.sol/DkgPkVerifier.d.ts.map +1 -0
- package/dist/types/contracts/verifier/DkgPkVerifier.sol/DkgPkVerifier.js +1 -0
- package/dist/types/contracts/verifier/DkgPkVerifier.sol/IVerifier.d.ts +36 -0
- package/dist/types/contracts/verifier/DkgPkVerifier.sol/IVerifier.d.ts.map +1 -0
- package/dist/types/contracts/verifier/DkgPkVerifier.sol/IVerifier.js +1 -0
- package/dist/types/contracts/verifier/DkgPkVerifier.sol/ZKTranscriptLib.d.ts +138 -0
- package/dist/types/contracts/verifier/DkgPkVerifier.sol/ZKTranscriptLib.d.ts.map +1 -0
- package/dist/types/contracts/verifier/DkgPkVerifier.sol/ZKTranscriptLib.js +1 -0
- package/dist/types/contracts/verifier/DkgPkVerifier.sol/index.d.ts +5 -0
- package/dist/types/contracts/verifier/DkgPkVerifier.sol/index.d.ts.map +1 -0
- package/dist/types/contracts/verifier/DkgPkVerifier.sol/index.js +1 -0
- package/dist/types/contracts/verifier/index.d.ts +3 -0
- package/dist/types/contracts/verifier/index.d.ts.map +1 -0
- package/dist/types/contracts/verifier/index.js +1 -0
- package/dist/types/factories/@openzeppelin/contracts/proxy/transparent/ProxyAdmin__factory.d.ts +1 -1
- package/dist/types/factories/@openzeppelin/contracts/proxy/transparent/ProxyAdmin__factory.d.ts.map +1 -1
- package/dist/types/factories/@openzeppelin/contracts/proxy/transparent/ProxyAdmin__factory.js +1 -1
- package/dist/types/factories/@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol/TransparentUpgradeableProxy__factory.d.ts +1 -1
- package/dist/types/factories/@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol/TransparentUpgradeableProxy__factory.d.ts.map +1 -1
- package/dist/types/factories/@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol/TransparentUpgradeableProxy__factory.js +1 -1
- package/dist/types/factories/contracts/E3RefundManager__factory.d.ts +540 -0
- package/dist/types/factories/contracts/E3RefundManager__factory.d.ts.map +1 -0
- package/dist/types/factories/contracts/E3RefundManager__factory.js +706 -0
- package/dist/types/factories/contracts/Enclave__factory.d.ts +412 -143
- package/dist/types/factories/contracts/Enclave__factory.d.ts.map +1 -1
- package/dist/types/factories/contracts/Enclave__factory.js +528 -180
- package/dist/types/factories/contracts/index.d.ts +2 -0
- package/dist/types/factories/contracts/index.d.ts.map +1 -1
- package/dist/types/factories/contracts/index.js +2 -0
- package/dist/types/factories/contracts/interfaces/IBondingRegistry__factory.d.ts +10 -0
- package/dist/types/factories/contracts/interfaces/IBondingRegistry__factory.d.ts.map +1 -1
- package/dist/types/factories/contracts/interfaces/IBondingRegistry__factory.js +13 -0
- package/dist/types/factories/contracts/interfaces/ICiphernodeRegistry__factory.d.ts +42 -4
- package/dist/types/factories/contracts/interfaces/ICiphernodeRegistry__factory.d.ts.map +1 -1
- package/dist/types/factories/contracts/interfaces/ICiphernodeRegistry__factory.js +54 -4
- package/dist/types/factories/contracts/interfaces/IE3Program__factory.d.ts +14 -18
- package/dist/types/factories/contracts/interfaces/IE3Program__factory.d.ts.map +1 -1
- package/dist/types/factories/contracts/interfaces/IE3Program__factory.js +18 -23
- package/dist/types/factories/contracts/interfaces/IE3RefundManager__factory.d.ts +358 -0
- package/dist/types/factories/contracts/interfaces/IE3RefundManager__factory.d.ts.map +1 -0
- package/dist/types/factories/contracts/interfaces/IE3RefundManager__factory.js +471 -0
- package/dist/types/factories/contracts/interfaces/IEnclave__factory.d.ts +303 -103
- package/dist/types/factories/contracts/interfaces/IEnclave__factory.d.ts.map +1 -1
- package/dist/types/factories/contracts/interfaces/IEnclave__factory.js +382 -127
- package/dist/types/factories/contracts/interfaces/index.d.ts +1 -0
- package/dist/types/factories/contracts/interfaces/index.d.ts.map +1 -1
- package/dist/types/factories/contracts/interfaces/index.js +1 -0
- package/dist/types/factories/contracts/registry/BondingRegistry__factory.d.ts +11 -1
- package/dist/types/factories/contracts/registry/BondingRegistry__factory.d.ts.map +1 -1
- package/dist/types/factories/contracts/registry/BondingRegistry__factory.js +14 -1
- package/dist/types/factories/contracts/registry/CiphernodeRegistryOwnable__factory.d.ts +62 -12
- package/dist/types/factories/contracts/registry/CiphernodeRegistryOwnable__factory.d.ts.map +1 -1
- package/dist/types/factories/contracts/registry/CiphernodeRegistryOwnable__factory.js +79 -13
- package/dist/types/factories/contracts/slashing/SlashingManager__factory.d.ts +1 -1
- package/dist/types/factories/contracts/slashing/SlashingManager__factory.d.ts.map +1 -1
- package/dist/types/factories/contracts/slashing/SlashingManager__factory.js +1 -1
- package/dist/types/factories/contracts/test/MockCiphernodeRegistry.sol/MockCiphernodeRegistryEmptyKey__factory.d.ts +43 -5
- 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 +55 -5
- package/dist/types/factories/contracts/test/MockCiphernodeRegistry.sol/MockCiphernodeRegistry__factory.d.ts +43 -5
- 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 +55 -5
- package/dist/types/factories/contracts/test/MockComputeProvider__factory.d.ts +1 -1
- package/dist/types/factories/contracts/test/MockComputeProvider__factory.d.ts.map +1 -1
- package/dist/types/factories/contracts/test/MockComputeProvider__factory.js +1 -1
- package/dist/types/factories/contracts/test/MockE3Program__factory.d.ts +15 -19
- package/dist/types/factories/contracts/test/MockE3Program__factory.d.ts.map +1 -1
- package/dist/types/factories/contracts/test/MockE3Program__factory.js +19 -24
- package/dist/types/factories/contracts/test/MockStableToken.sol/MockUSDC__factory.d.ts +1 -1
- package/dist/types/factories/contracts/test/MockStableToken.sol/MockUSDC__factory.d.ts.map +1 -1
- package/dist/types/factories/contracts/test/MockStableToken.sol/MockUSDC__factory.js +1 -1
- package/dist/types/factories/contracts/token/EnclaveTicketToken__factory.d.ts +1 -1
- package/dist/types/factories/contracts/token/EnclaveTicketToken__factory.d.ts.map +1 -1
- package/dist/types/factories/contracts/token/EnclaveTicketToken__factory.js +1 -1
- package/dist/types/factories/contracts/token/EnclaveToken__factory.d.ts +1 -1
- package/dist/types/factories/contracts/token/EnclaveToken__factory.d.ts.map +1 -1
- package/dist/types/factories/contracts/token/EnclaveToken__factory.js +1 -1
- package/dist/types/factories/contracts/verifier/DkgPkVerifier.sol/BaseZKHonkVerifier__factory.d.ts +66 -0
- package/dist/types/factories/contracts/verifier/DkgPkVerifier.sol/BaseZKHonkVerifier__factory.d.ts.map +1 -0
- package/dist/types/factories/contracts/verifier/DkgPkVerifier.sol/BaseZKHonkVerifier__factory.js +90 -0
- package/dist/types/factories/contracts/verifier/DkgPkVerifier.sol/DkgPkVerifier__factory.d.ts +87 -0
- package/dist/types/factories/contracts/verifier/DkgPkVerifier.sol/DkgPkVerifier__factory.d.ts.map +1 -0
- package/dist/types/factories/contracts/verifier/DkgPkVerifier.sol/DkgPkVerifier__factory.js +122 -0
- package/dist/types/factories/contracts/verifier/DkgPkVerifier.sol/IVerifier__factory.d.ts +26 -0
- package/dist/types/factories/contracts/verifier/DkgPkVerifier.sol/IVerifier__factory.d.ts.map +1 -0
- package/dist/types/factories/contracts/verifier/DkgPkVerifier.sol/IVerifier__factory.js +39 -0
- package/dist/types/factories/contracts/verifier/DkgPkVerifier.sol/ZKTranscriptLib__factory.d.ts +323 -0
- package/dist/types/factories/contracts/verifier/DkgPkVerifier.sol/ZKTranscriptLib__factory.d.ts.map +1 -0
- package/dist/types/factories/contracts/verifier/DkgPkVerifier.sol/ZKTranscriptLib__factory.js +422 -0
- package/dist/types/factories/contracts/verifier/DkgPkVerifier.sol/index.d.ts +5 -0
- package/dist/types/factories/contracts/verifier/DkgPkVerifier.sol/index.d.ts.map +1 -0
- package/dist/types/factories/contracts/verifier/DkgPkVerifier.sol/index.js +7 -0
- package/dist/types/factories/contracts/verifier/index.d.ts +2 -0
- package/dist/types/factories/contracts/verifier/index.d.ts.map +1 -0
- package/dist/types/factories/contracts/verifier/index.js +4 -0
- package/dist/types/index.d.ts +12 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +6 -0
- package/package.json +17 -3
- package/artifacts/build-info/solc-0_8_28-c77ac33099bb85c15f46d194dd2b735e036cb799.output.json +0 -1
|
@@ -9,10 +9,10 @@ import { network } from "hardhat";
|
|
|
9
9
|
import { poseidon2 } from "poseidon-lite";
|
|
10
10
|
import BondingRegistryModule from "../ignition/modules/bondingRegistry";
|
|
11
11
|
import CiphernodeRegistryModule from "../ignition/modules/ciphernodeRegistry";
|
|
12
|
+
import E3RefundManagerModule from "../ignition/modules/e3RefundManager";
|
|
12
13
|
import EnclaveModule from "../ignition/modules/enclave";
|
|
13
14
|
import EnclaveTicketTokenModule from "../ignition/modules/enclaveTicketToken";
|
|
14
15
|
import EnclaveTokenModule from "../ignition/modules/enclaveToken";
|
|
15
|
-
import MockCiphernodeRegistryEmptyKeyModule from "../ignition/modules/mockCiphernodeRegistryEmptyKey";
|
|
16
16
|
import mockComputeProviderModule from "../ignition/modules/mockComputeProvider";
|
|
17
17
|
import MockDecryptionVerifierModule from "../ignition/modules/mockDecryptionVerifier";
|
|
18
18
|
import MockE3ProgramModule from "../ignition/modules/mockE3Program";
|
|
@@ -26,6 +26,14 @@ describe("Enclave", function () {
|
|
|
26
26
|
const SORTITION_SUBMISSION_WINDOW = 10;
|
|
27
27
|
const addressOne = "0x0000000000000000000000000000000000000001";
|
|
28
28
|
const AddressTwo = "0x0000000000000000000000000000000000000002";
|
|
29
|
+
const timeoutConfig = {
|
|
30
|
+
committeeFormationWindow: 3600, // 1 hour
|
|
31
|
+
dkgWindow: 3600, // 1 hour
|
|
32
|
+
computeWindow: 3600, // 1 hour
|
|
33
|
+
decryptionWindow: 3600, // 1 hour
|
|
34
|
+
gracePeriod: 300, // 5 minutes
|
|
35
|
+
};
|
|
36
|
+
const inputWindowDuration = 300;
|
|
29
37
|
const encryptionSchemeId = "0x2c2a814a0495f913a3a312fc4771e37552bc14f8a2d4075a08122d356f0849c6";
|
|
30
38
|
const newEncryptionSchemeId = "0x0000000000000000000000000000000000000000000000000000000000000002";
|
|
31
39
|
const abiCoder = ethers.AbiCoder.defaultAbiCoder();
|
|
@@ -132,11 +140,25 @@ describe("Enclave", function () {
|
|
|
132
140
|
maxDuration: THIRTY_DAYS_IN_SECONDS,
|
|
133
141
|
registry: addressOne,
|
|
134
142
|
bondingRegistry: await bondingRegistryContract.bondingRegistry.getAddress(),
|
|
143
|
+
e3RefundManager: addressOne, // placeholder, will be updated
|
|
135
144
|
feeToken: await usdcToken.getAddress(),
|
|
145
|
+
timeoutConfig,
|
|
136
146
|
},
|
|
137
147
|
},
|
|
138
148
|
});
|
|
139
149
|
const enclaveAddress = await enclaveContract.enclave.getAddress();
|
|
150
|
+
const e3RefundManagerContract = await ignition.deploy(E3RefundManagerModule, {
|
|
151
|
+
parameters: {
|
|
152
|
+
E3RefundManager: {
|
|
153
|
+
owner: ownerAddress,
|
|
154
|
+
enclave: enclaveAddress,
|
|
155
|
+
treasury: ownerAddress,
|
|
156
|
+
},
|
|
157
|
+
},
|
|
158
|
+
});
|
|
159
|
+
const e3RefundManagerAddress = await e3RefundManagerContract.e3RefundManager.getAddress();
|
|
160
|
+
const enclave = EnclaveFactory.connect(enclaveAddress, owner);
|
|
161
|
+
await enclave.setE3RefundManager(e3RefundManagerAddress);
|
|
140
162
|
const ciphernodeRegistry = await ignition.deploy(CiphernodeRegistryModule, {
|
|
141
163
|
parameters: {
|
|
142
164
|
CiphernodeRegistry: {
|
|
@@ -147,7 +169,6 @@ describe("Enclave", function () {
|
|
|
147
169
|
},
|
|
148
170
|
});
|
|
149
171
|
const ciphernodeRegistryAddress = await ciphernodeRegistry.cipherNodeRegistry.getAddress();
|
|
150
|
-
const enclave = EnclaveFactory.connect(enclaveAddress, owner);
|
|
151
172
|
const ciphernodeRegistryContract = CiphernodeRegistryOwnableFactory.connect(ciphernodeRegistryAddress, owner);
|
|
152
173
|
const bondingRegistry = BondingRegistryFactory.connect(await bondingRegistryContract.bondingRegistry.getAddress(), owner);
|
|
153
174
|
const registryAddress = await enclave.ciphernodeRegistry();
|
|
@@ -177,8 +198,10 @@ describe("Enclave", function () {
|
|
|
177
198
|
await enclave.setDecryptionVerifier(encryptionSchemeId, await decryptionVerifier.mockDecryptionVerifier.getAddress());
|
|
178
199
|
const request = {
|
|
179
200
|
threshold: [2, 2],
|
|
180
|
-
|
|
181
|
-
|
|
201
|
+
inputWindow: [
|
|
202
|
+
(await time.latest()) + 10,
|
|
203
|
+
(await time.latest()) + inputWindowDuration,
|
|
204
|
+
],
|
|
182
205
|
e3Program: await e3Program.mockE3Program.getAddress(),
|
|
183
206
|
e3ProgramParams: encodedE3ProgramParams,
|
|
184
207
|
computeProviderParams: abiCoder.encode(["address"], [await decryptionVerifier.mockDecryptionVerifier.getAddress()]),
|
|
@@ -235,11 +258,6 @@ describe("Enclave", function () {
|
|
|
235
258
|
await enclave.setMaxDuration(1);
|
|
236
259
|
expect(await enclave.maxDuration()).to.equal(1);
|
|
237
260
|
});
|
|
238
|
-
it("returns true if max duration is set successfully", async function () {
|
|
239
|
-
const { enclave } = await loadFixture(setup);
|
|
240
|
-
const result = await enclave.setMaxDuration.staticCall(1);
|
|
241
|
-
expect(result).to.be.true;
|
|
242
|
-
});
|
|
243
261
|
it("emits MaxDurationSet event", async function () {
|
|
244
262
|
const { enclave } = await loadFixture(setup);
|
|
245
263
|
await expect(enclave.setMaxDuration(1))
|
|
@@ -272,11 +290,6 @@ describe("Enclave", function () {
|
|
|
272
290
|
await enclave.setCiphernodeRegistry(AddressTwo);
|
|
273
291
|
expect(await enclave.ciphernodeRegistry()).to.equal(AddressTwo);
|
|
274
292
|
});
|
|
275
|
-
it("returns true if ciphernodeRegistry is set successfully", async function () {
|
|
276
|
-
const { enclave } = await loadFixture(setup);
|
|
277
|
-
const result = await enclave.setCiphernodeRegistry.staticCall(AddressTwo);
|
|
278
|
-
expect(result).to.be.true;
|
|
279
|
-
});
|
|
280
293
|
it("emits CiphernodeRegistrySet event", async function () {
|
|
281
294
|
const { enclave } = await loadFixture(setup);
|
|
282
295
|
await expect(enclave.setCiphernodeRegistry(AddressTwo))
|
|
@@ -300,11 +313,6 @@ describe("Enclave", function () {
|
|
|
300
313
|
expect(await enclave.e3ProgramsParams(encodedE3ProgramsParams[0])).to.be
|
|
301
314
|
.true;
|
|
302
315
|
});
|
|
303
|
-
it("returns true if parameters are set successfully", async function () {
|
|
304
|
-
const { enclave } = await loadFixture(setup);
|
|
305
|
-
const result = await enclave.setE3ProgramsParams.staticCall(encodedE3ProgramsParams);
|
|
306
|
-
expect(result).to.be.true;
|
|
307
|
-
});
|
|
308
316
|
it("emits AllowedE3ProgramsParamsSet event", async function () {
|
|
309
317
|
const { enclave } = await loadFixture(setup);
|
|
310
318
|
await expect(enclave.setE3ProgramsParams(encodedE3ProgramsParams))
|
|
@@ -331,8 +339,7 @@ describe("Enclave", function () {
|
|
|
331
339
|
const { enclave, request, usdcToken } = await loadFixture(setup);
|
|
332
340
|
await makeRequest(enclave, usdcToken, {
|
|
333
341
|
threshold: request.threshold,
|
|
334
|
-
|
|
335
|
-
duration: request.duration,
|
|
342
|
+
inputWindow: request.inputWindow,
|
|
336
343
|
e3Program: request.e3Program,
|
|
337
344
|
e3ProgramParams: request.e3ProgramParams,
|
|
338
345
|
computeProviderParams: request.computeProviderParams,
|
|
@@ -340,7 +347,8 @@ describe("Enclave", function () {
|
|
|
340
347
|
});
|
|
341
348
|
const e3 = await enclave.getE3(0);
|
|
342
349
|
expect(e3.threshold).to.deep.equal(request.threshold);
|
|
343
|
-
expect(e3.
|
|
350
|
+
expect(e3.inputWindow[0]).to.equal(request.inputWindow[0]);
|
|
351
|
+
expect(e3.inputWindow[1]).to.equal(request.inputWindow[1]);
|
|
344
352
|
expect(e3.e3Program).to.equal(request.e3Program);
|
|
345
353
|
expect(e3.e3ProgramParams).to.equal(request.e3ProgramParams);
|
|
346
354
|
expect(e3.decryptionVerifier).to.equal(abiCoder.decode(["address"], request.computeProviderParams)[0]);
|
|
@@ -379,11 +387,6 @@ describe("Enclave", function () {
|
|
|
379
387
|
expect(await enclave.setDecryptionVerifier(newEncryptionSchemeId, await mocks.decryptionVerifier.getAddress()));
|
|
380
388
|
expect(await enclave.getDecryptionVerifier(newEncryptionSchemeId)).to.equal(await mocks.decryptionVerifier.getAddress());
|
|
381
389
|
});
|
|
382
|
-
it("returns true if decryption verifier is enabled successfully", async function () {
|
|
383
|
-
const { enclave, mocks } = await loadFixture(setup);
|
|
384
|
-
const result = await enclave.setDecryptionVerifier.staticCall(newEncryptionSchemeId, await mocks.decryptionVerifier.getAddress());
|
|
385
|
-
expect(result).to.be.true;
|
|
386
|
-
});
|
|
387
390
|
it("emits EncryptionSchemeEnabled", async function () {
|
|
388
391
|
const { enclave, mocks } = await loadFixture(setup);
|
|
389
392
|
await expect(await enclave.setDecryptionVerifier(newEncryptionSchemeId, await mocks.decryptionVerifier.getAddress()))
|
|
@@ -411,11 +414,6 @@ describe("Enclave", function () {
|
|
|
411
414
|
expect(await enclave.disableEncryptionScheme(encryptionSchemeId));
|
|
412
415
|
expect(await enclave.getDecryptionVerifier(encryptionSchemeId)).to.equal(ethers.ZeroAddress);
|
|
413
416
|
});
|
|
414
|
-
it("returns true if encryption scheme is disabled successfully", async function () {
|
|
415
|
-
const { enclave } = await loadFixture(setup);
|
|
416
|
-
const result = await enclave.disableEncryptionScheme.staticCall(encryptionSchemeId);
|
|
417
|
-
expect(result).to.be.true;
|
|
418
|
-
});
|
|
419
417
|
it("emits EncryptionSchemeDisabled", async function () {
|
|
420
418
|
const { enclave } = await loadFixture(setup);
|
|
421
419
|
await expect(await enclave.disableEncryptionScheme(encryptionSchemeId))
|
|
@@ -441,11 +439,6 @@ describe("Enclave", function () {
|
|
|
441
439
|
const enabled = await enclave.e3Programs(e3Program);
|
|
442
440
|
expect(enabled).to.be.true;
|
|
443
441
|
});
|
|
444
|
-
it("returns true if E3 Program is enabled successfully", async function () {
|
|
445
|
-
const { enclave } = await loadFixture(setup);
|
|
446
|
-
const result = await enclave.enableE3Program.staticCall(AddressTwo);
|
|
447
|
-
expect(result).to.be.true;
|
|
448
|
-
});
|
|
449
442
|
it("emits E3ProgramEnabled event", async function () {
|
|
450
443
|
const { enclave } = await loadFixture(setup);
|
|
451
444
|
await expect(enclave.enableE3Program(AddressTwo))
|
|
@@ -472,11 +465,6 @@ describe("Enclave", function () {
|
|
|
472
465
|
const enabled = await enclave.e3Programs(e3Program);
|
|
473
466
|
expect(enabled).to.be.false;
|
|
474
467
|
});
|
|
475
|
-
it("returns true if E3 Program is disabled successfully", async function () {
|
|
476
|
-
const { enclave, mocks: { e3Program }, } = await loadFixture(setup);
|
|
477
|
-
const result = await enclave.disableE3Program.staticCall(e3Program);
|
|
478
|
-
expect(result).to.be.true;
|
|
479
|
-
});
|
|
480
468
|
it("emits E3ProgramDisabled event", async function () {
|
|
481
469
|
const { enclave, mocks: { e3Program }, } = await loadFixture(setup);
|
|
482
470
|
await expect(enclave.disableE3Program(e3Program))
|
|
@@ -489,8 +477,7 @@ describe("Enclave", function () {
|
|
|
489
477
|
const { enclave, request, usdcToken } = await loadFixture(setup);
|
|
490
478
|
await expect(enclave.request({
|
|
491
479
|
threshold: request.threshold,
|
|
492
|
-
|
|
493
|
-
duration: request.duration,
|
|
480
|
+
inputWindow: request.inputWindow,
|
|
494
481
|
e3Program: request.e3Program,
|
|
495
482
|
e3ProgramParams: request.e3ProgramParams,
|
|
496
483
|
computeProviderParams: request.computeProviderParams,
|
|
@@ -501,8 +488,7 @@ describe("Enclave", function () {
|
|
|
501
488
|
const { enclave, request, usdcToken } = await loadFixture(setup);
|
|
502
489
|
const fee = await enclave.getE3Quote({
|
|
503
490
|
threshold: [0, 2],
|
|
504
|
-
|
|
505
|
-
duration: request.duration,
|
|
491
|
+
inputWindow: request.inputWindow,
|
|
506
492
|
e3Program: request.e3Program,
|
|
507
493
|
e3ProgramParams: request.e3ProgramParams,
|
|
508
494
|
computeProviderParams: request.computeProviderParams,
|
|
@@ -511,8 +497,7 @@ describe("Enclave", function () {
|
|
|
511
497
|
await usdcToken.approve(await enclave.getAddress(), fee);
|
|
512
498
|
await expect(enclave.request({
|
|
513
499
|
threshold: [0, 2],
|
|
514
|
-
|
|
515
|
-
duration: request.duration,
|
|
500
|
+
inputWindow: request.inputWindow,
|
|
516
501
|
e3Program: request.e3Program,
|
|
517
502
|
e3ProgramParams: request.e3ProgramParams,
|
|
518
503
|
computeProviderParams: request.computeProviderParams,
|
|
@@ -525,8 +510,7 @@ describe("Enclave", function () {
|
|
|
525
510
|
const { enclave, request, usdcToken } = await loadFixture(setup);
|
|
526
511
|
await expect(makeRequest(enclave, usdcToken, {
|
|
527
512
|
threshold: [3, 2],
|
|
528
|
-
|
|
529
|
-
duration: request.duration,
|
|
513
|
+
inputWindow: request.inputWindow,
|
|
530
514
|
e3Program: request.e3Program,
|
|
531
515
|
e3ProgramParams: request.e3ProgramParams,
|
|
532
516
|
computeProviderParams: request.computeProviderParams,
|
|
@@ -535,40 +519,25 @@ describe("Enclave", function () {
|
|
|
535
519
|
.to.be.revertedWithCustomError(enclave, "InvalidThreshold")
|
|
536
520
|
.withArgs([3, 2]);
|
|
537
521
|
});
|
|
538
|
-
it("reverts if duration is
|
|
539
|
-
const { enclave, request, usdcToken } = await loadFixture(setup);
|
|
540
|
-
await expect(makeRequest(enclave, usdcToken, {
|
|
541
|
-
threshold: request.threshold,
|
|
542
|
-
startWindow: request.startWindow,
|
|
543
|
-
duration: 0,
|
|
544
|
-
e3Program: request.e3Program,
|
|
545
|
-
e3ProgramParams: request.e3ProgramParams,
|
|
546
|
-
computeProviderParams: request.computeProviderParams,
|
|
547
|
-
customParams: request.customParams,
|
|
548
|
-
}))
|
|
549
|
-
.to.be.revertedWithCustomError(enclave, "InvalidDuration")
|
|
550
|
-
.withArgs(0);
|
|
551
|
-
});
|
|
552
|
-
it("reverts if duration is greater than maxDuration", async function () {
|
|
522
|
+
it("reverts if total duration is greater than maxDuration", async function () {
|
|
553
523
|
const { enclave, request, usdcToken } = await loadFixture(setup);
|
|
554
524
|
await expect(makeRequest(enclave, usdcToken, {
|
|
555
|
-
threshold:
|
|
556
|
-
|
|
557
|
-
|
|
525
|
+
threshold: [2, 3],
|
|
526
|
+
inputWindow: [
|
|
527
|
+
request.inputWindow[0],
|
|
528
|
+
request.inputWindow[1] + time.duration.days(31),
|
|
529
|
+
],
|
|
558
530
|
e3Program: request.e3Program,
|
|
559
531
|
e3ProgramParams: request.e3ProgramParams,
|
|
560
532
|
computeProviderParams: request.computeProviderParams,
|
|
561
533
|
customParams: request.customParams,
|
|
562
|
-
}))
|
|
563
|
-
.to.be.revertedWithCustomError(enclave, "InvalidDuration")
|
|
564
|
-
.withArgs(time.duration.days(31));
|
|
534
|
+
})).to.be.revertedWithCustomError(enclave, "InvalidDuration");
|
|
565
535
|
});
|
|
566
536
|
it("reverts if E3 Program is not enabled", async function () {
|
|
567
537
|
const { enclave, request, usdcToken } = await loadFixture(setup);
|
|
568
538
|
await expect(makeRequest(enclave, usdcToken, {
|
|
569
|
-
threshold:
|
|
570
|
-
|
|
571
|
-
duration: request.duration,
|
|
539
|
+
threshold: [2, 3],
|
|
540
|
+
inputWindow: request.inputWindow,
|
|
572
541
|
e3Program: ethers.ZeroAddress,
|
|
573
542
|
e3ProgramParams: request.e3ProgramParams,
|
|
574
543
|
computeProviderParams: request.computeProviderParams,
|
|
@@ -582,8 +551,7 @@ describe("Enclave", function () {
|
|
|
582
551
|
await enclave.disableEncryptionScheme(encryptionSchemeId);
|
|
583
552
|
await expect(makeRequest(enclave, usdcToken, {
|
|
584
553
|
threshold: request.threshold,
|
|
585
|
-
|
|
586
|
-
duration: request.duration,
|
|
554
|
+
inputWindow: request.inputWindow,
|
|
587
555
|
e3Program: request.e3Program,
|
|
588
556
|
e3ProgramParams: request.e3ProgramParams,
|
|
589
557
|
computeProviderParams: request.computeProviderParams,
|
|
@@ -596,8 +564,7 @@ describe("Enclave", function () {
|
|
|
596
564
|
const { enclave, request, usdcToken } = await loadFixture(setup);
|
|
597
565
|
await makeRequest(enclave, usdcToken, {
|
|
598
566
|
threshold: request.threshold,
|
|
599
|
-
|
|
600
|
-
duration: request.duration,
|
|
567
|
+
inputWindow: request.inputWindow,
|
|
601
568
|
e3Program: request.e3Program,
|
|
602
569
|
e3ProgramParams: request.e3ProgramParams,
|
|
603
570
|
computeProviderParams: request.computeProviderParams,
|
|
@@ -606,7 +573,8 @@ describe("Enclave", function () {
|
|
|
606
573
|
const e3 = await enclave.getE3(0);
|
|
607
574
|
const block = await ethers.provider.getBlock("latest").catch((e) => e);
|
|
608
575
|
expect(e3.threshold).to.deep.equal(request.threshold);
|
|
609
|
-
expect(e3.
|
|
576
|
+
expect(e3.inputWindow[0]).to.equal(request.inputWindow[0]);
|
|
577
|
+
expect(e3.inputWindow[1]).to.equal(request.inputWindow[1]);
|
|
610
578
|
expect(e3.e3Program).to.equal(request.e3Program);
|
|
611
579
|
expect(e3.requestBlock).to.equal(block.number);
|
|
612
580
|
expect(e3.decryptionVerifier).to.equal(abiCoder.decode(["address"], request.computeProviderParams)[0]);
|
|
@@ -618,8 +586,7 @@ describe("Enclave", function () {
|
|
|
618
586
|
const { enclave, request, usdcToken } = await loadFixture(setup);
|
|
619
587
|
const tx = await makeRequest(enclave, usdcToken, {
|
|
620
588
|
threshold: request.threshold,
|
|
621
|
-
|
|
622
|
-
duration: request.duration,
|
|
589
|
+
inputWindow: request.inputWindow,
|
|
623
590
|
e3Program: request.e3Program,
|
|
624
591
|
e3ProgramParams: request.e3ProgramParams,
|
|
625
592
|
computeProviderParams: request.computeProviderParams,
|
|
@@ -631,253 +598,6 @@ describe("Enclave", function () {
|
|
|
631
598
|
.withArgs(0, e3, request.e3Program);
|
|
632
599
|
});
|
|
633
600
|
});
|
|
634
|
-
describe("activate()", function () {
|
|
635
|
-
it("reverts if E3 does not exist", async function () {
|
|
636
|
-
const { enclave } = await loadFixture(setup);
|
|
637
|
-
await expect(enclave.activate(0))
|
|
638
|
-
.to.be.revertedWithCustomError(enclave, "E3DoesNotExist")
|
|
639
|
-
.withArgs(0);
|
|
640
|
-
});
|
|
641
|
-
it("reverts if E3 has already been activated", async function () {
|
|
642
|
-
const { enclave, request, usdcToken, ciphernodeRegistryContract, operator1, operator2, } = await loadFixture(setup);
|
|
643
|
-
await makeRequest(enclave, usdcToken, {
|
|
644
|
-
threshold: request.threshold,
|
|
645
|
-
startWindow: request.startWindow,
|
|
646
|
-
duration: request.duration,
|
|
647
|
-
e3Program: request.e3Program,
|
|
648
|
-
e3ProgramParams: request.e3ProgramParams,
|
|
649
|
-
computeProviderParams: request.computeProviderParams,
|
|
650
|
-
customParams: request.customParams,
|
|
651
|
-
});
|
|
652
|
-
await setupAndPublishCommittee(ciphernodeRegistryContract, 0, [await operator1.getAddress(), await operator2.getAddress()], data, operator1, operator2);
|
|
653
|
-
await expect(enclave.getE3(0)).to.not.be.revert(ethers);
|
|
654
|
-
await expect(enclave.activate(0)).to.not.be.revert(ethers);
|
|
655
|
-
await expect(enclave.activate(0))
|
|
656
|
-
.to.be.revertedWithCustomError(enclave, "E3AlreadyActivated")
|
|
657
|
-
.withArgs(0);
|
|
658
|
-
});
|
|
659
|
-
it("reverts if E3 is not yet ready to start", async function () {
|
|
660
|
-
const { enclave, request, usdcToken } = await loadFixture(setup);
|
|
661
|
-
const startTime = [
|
|
662
|
-
(await time.latest()) + 1000,
|
|
663
|
-
(await time.latest()) + 2000,
|
|
664
|
-
];
|
|
665
|
-
await makeRequest(enclave, usdcToken, {
|
|
666
|
-
threshold: request.threshold,
|
|
667
|
-
startWindow: startTime,
|
|
668
|
-
duration: request.duration,
|
|
669
|
-
e3Program: request.e3Program,
|
|
670
|
-
e3ProgramParams: request.e3ProgramParams,
|
|
671
|
-
computeProviderParams: request.computeProviderParams,
|
|
672
|
-
customParams: request.customParams,
|
|
673
|
-
});
|
|
674
|
-
await expect(enclave.activate(0)).to.be.revertedWithCustomError(enclave, "E3NotReady");
|
|
675
|
-
});
|
|
676
|
-
it("reverts if E3 start has expired", async function () {
|
|
677
|
-
const { enclave, request, usdcToken, ciphernodeRegistryContract, operator1, operator2, } = await loadFixture(setup);
|
|
678
|
-
const e3Id = 0;
|
|
679
|
-
const currentTime = await time.latest();
|
|
680
|
-
const startTime = [currentTime + 10, currentTime + 100];
|
|
681
|
-
await makeRequest(enclave, usdcToken, {
|
|
682
|
-
...request,
|
|
683
|
-
startWindow: startTime,
|
|
684
|
-
});
|
|
685
|
-
await setupAndPublishCommittee(ciphernodeRegistryContract, e3Id, [await operator1.getAddress(), await operator2.getAddress()], data, operator1, operator2);
|
|
686
|
-
await mine(2, { interval: 2000 });
|
|
687
|
-
await expect(enclave.activate(e3Id)).to.be.revertedWithCustomError(enclave, "E3Expired");
|
|
688
|
-
});
|
|
689
|
-
it("reverts if ciphernodeRegistry does not return a public key", async function () {
|
|
690
|
-
const { enclave, request, usdcToken } = await loadFixture(setup);
|
|
691
|
-
const startTime = [
|
|
692
|
-
(await time.latest()) + 1000,
|
|
693
|
-
(await time.latest()) + 2000,
|
|
694
|
-
];
|
|
695
|
-
await makeRequest(enclave, usdcToken, {
|
|
696
|
-
threshold: request.threshold,
|
|
697
|
-
startWindow: startTime,
|
|
698
|
-
duration: request.duration,
|
|
699
|
-
e3Program: request.e3Program,
|
|
700
|
-
e3ProgramParams: request.e3ProgramParams,
|
|
701
|
-
computeProviderParams: request.computeProviderParams,
|
|
702
|
-
customParams: request.customParams,
|
|
703
|
-
});
|
|
704
|
-
await expect(enclave.activate(0)).to.be.revertedWithCustomError(enclave, "E3NotReady");
|
|
705
|
-
});
|
|
706
|
-
it("reverts if E3 start has expired", async function () {
|
|
707
|
-
const { enclave, request, usdcToken, ciphernodeRegistryContract, operator1, operator2, } = await loadFixture(setup);
|
|
708
|
-
const e3Id = 0;
|
|
709
|
-
const currentTime = await time.latest();
|
|
710
|
-
const startTime = [currentTime + 5, currentTime + 50];
|
|
711
|
-
await makeRequest(enclave, usdcToken, {
|
|
712
|
-
...request,
|
|
713
|
-
startWindow: startTime,
|
|
714
|
-
});
|
|
715
|
-
await setupAndPublishCommittee(ciphernodeRegistryContract, e3Id, [await operator1.getAddress(), await operator2.getAddress()], data, operator1, operator2);
|
|
716
|
-
await time.increaseTo(currentTime + request.duration + 100);
|
|
717
|
-
await expect(enclave.activate(e3Id)).to.be.revertedWithCustomError(enclave, "E3Expired");
|
|
718
|
-
});
|
|
719
|
-
it("reverts if ciphernodeRegistry does not return a public key", async function () {
|
|
720
|
-
const { enclave, request, usdcToken } = await loadFixture(setup);
|
|
721
|
-
await makeRequest(enclave, usdcToken, request);
|
|
722
|
-
const prevRegistry = await enclave.ciphernodeRegistry();
|
|
723
|
-
const reg = await ignition.deploy(MockCiphernodeRegistryEmptyKeyModule);
|
|
724
|
-
const nextRegistry = await reg.mockCiphernodeRegistryEmptyKey.getAddress();
|
|
725
|
-
await enclave.setCiphernodeRegistry(nextRegistry);
|
|
726
|
-
await expect(enclave.activate(0)).to.be.revertedWithCustomError(reg.mockCiphernodeRegistryEmptyKey, "CommitteeNotPublished");
|
|
727
|
-
await enclave.setCiphernodeRegistry(prevRegistry);
|
|
728
|
-
});
|
|
729
|
-
it("sets committeePublicKey correctly", async () => {
|
|
730
|
-
const { enclave, request, ciphernodeRegistryContract, usdcToken, operator1, operator2, } = await loadFixture(setup);
|
|
731
|
-
await makeRequest(enclave, usdcToken, {
|
|
732
|
-
threshold: request.threshold,
|
|
733
|
-
startWindow: request.startWindow,
|
|
734
|
-
duration: request.duration,
|
|
735
|
-
e3Program: request.e3Program,
|
|
736
|
-
e3ProgramParams: request.e3ProgramParams,
|
|
737
|
-
computeProviderParams: request.computeProviderParams,
|
|
738
|
-
customParams: request.customParams,
|
|
739
|
-
});
|
|
740
|
-
const e3Id = 0;
|
|
741
|
-
await setupAndPublishCommittee(ciphernodeRegistryContract, e3Id, [await operator1.getAddress(), await operator2.getAddress()], data, operator1, operator2);
|
|
742
|
-
const publicKey = await ciphernodeRegistryContract.committeePublicKey(e3Id);
|
|
743
|
-
let e3 = await enclave.getE3(e3Id);
|
|
744
|
-
expect(e3.committeePublicKey).to.not.equal(publicKey);
|
|
745
|
-
await enclave.activate(e3Id);
|
|
746
|
-
e3 = await enclave.getE3(e3Id);
|
|
747
|
-
expect(e3.committeePublicKey).to.equal(publicKey);
|
|
748
|
-
});
|
|
749
|
-
it("returns true if E3 is activated successfully", async () => {
|
|
750
|
-
const { enclave, request, usdcToken, ciphernodeRegistryContract, operator1, operator2, } = await loadFixture(setup);
|
|
751
|
-
await makeRequest(enclave, usdcToken, {
|
|
752
|
-
threshold: request.threshold,
|
|
753
|
-
startWindow: request.startWindow,
|
|
754
|
-
duration: request.duration,
|
|
755
|
-
e3Program: request.e3Program,
|
|
756
|
-
e3ProgramParams: request.e3ProgramParams,
|
|
757
|
-
computeProviderParams: request.computeProviderParams,
|
|
758
|
-
customParams: request.customParams,
|
|
759
|
-
});
|
|
760
|
-
const e3Id = 0;
|
|
761
|
-
await setupAndPublishCommittee(ciphernodeRegistryContract, e3Id, [await operator1.getAddress(), await operator2.getAddress()], data, operator1, operator2);
|
|
762
|
-
expect(await enclave.activate.staticCall(e3Id)).to.be.equal(true);
|
|
763
|
-
});
|
|
764
|
-
it("emits E3Activated event", async () => {
|
|
765
|
-
const { enclave, request, usdcToken, ciphernodeRegistryContract, operator1, operator2, } = await loadFixture(setup);
|
|
766
|
-
await makeRequest(enclave, usdcToken, {
|
|
767
|
-
threshold: request.threshold,
|
|
768
|
-
startWindow: request.startWindow,
|
|
769
|
-
duration: request.duration,
|
|
770
|
-
e3Program: request.e3Program,
|
|
771
|
-
e3ProgramParams: request.e3ProgramParams,
|
|
772
|
-
computeProviderParams: request.computeProviderParams,
|
|
773
|
-
customParams: request.customParams,
|
|
774
|
-
});
|
|
775
|
-
const e3Id = 0;
|
|
776
|
-
await setupAndPublishCommittee(ciphernodeRegistryContract, e3Id, [await operator1.getAddress(), await operator2.getAddress()], data, operator1, operator2);
|
|
777
|
-
await expect(enclave.activate(e3Id)).to.emit(enclave, "E3Activated");
|
|
778
|
-
});
|
|
779
|
-
});
|
|
780
|
-
describe("publishInput()", function () {
|
|
781
|
-
it("reverts if E3 does not exist", async function () {
|
|
782
|
-
const { enclave } = await loadFixture(setup);
|
|
783
|
-
await expect(enclave.publishInput(0, "0x"))
|
|
784
|
-
.to.be.revertedWithCustomError(enclave, "E3DoesNotExist")
|
|
785
|
-
.withArgs(0);
|
|
786
|
-
});
|
|
787
|
-
it("reverts if E3 has not been activated", async function () {
|
|
788
|
-
const { enclave, request, usdcToken } = await loadFixture(setup);
|
|
789
|
-
await makeRequest(enclave, usdcToken, {
|
|
790
|
-
threshold: request.threshold,
|
|
791
|
-
startWindow: request.startWindow,
|
|
792
|
-
duration: request.duration,
|
|
793
|
-
e3Program: request.e3Program,
|
|
794
|
-
e3ProgramParams: request.e3ProgramParams,
|
|
795
|
-
computeProviderParams: request.computeProviderParams,
|
|
796
|
-
customParams: request.customParams,
|
|
797
|
-
});
|
|
798
|
-
const inputData = abiCoder.encode(["bytes32"], [ethers.ZeroHash]);
|
|
799
|
-
await expect(enclave.getE3(0)).to.not.be.revert(ethers);
|
|
800
|
-
await expect(enclave.publishInput(0, inputData))
|
|
801
|
-
.to.be.revertedWithCustomError(enclave, "E3NotActivated")
|
|
802
|
-
.withArgs(0);
|
|
803
|
-
});
|
|
804
|
-
it("reverts if input is not valid", async function () {
|
|
805
|
-
const { enclave, request, usdcToken, ciphernodeRegistryContract, operator1, operator2, } = await loadFixture(setup);
|
|
806
|
-
await makeRequest(enclave, usdcToken, {
|
|
807
|
-
threshold: request.threshold,
|
|
808
|
-
startWindow: request.startWindow,
|
|
809
|
-
duration: request.duration,
|
|
810
|
-
e3Program: request.e3Program,
|
|
811
|
-
e3ProgramParams: request.e3ProgramParams,
|
|
812
|
-
computeProviderParams: request.computeProviderParams,
|
|
813
|
-
customParams: request.customParams,
|
|
814
|
-
});
|
|
815
|
-
await setupAndPublishCommittee(ciphernodeRegistryContract, 0, [await operator1.getAddress(), await operator2.getAddress()], data, operator1, operator2);
|
|
816
|
-
await enclave.activate(0);
|
|
817
|
-
await expect(enclave.publishInput(0, "0xaabbcc")).to.be.revertedWithCustomError(enclave, "InvalidInput");
|
|
818
|
-
});
|
|
819
|
-
it("reverts if outside of input window", async function () {
|
|
820
|
-
const { enclave, request, usdcToken, ciphernodeRegistryContract, operator1, operator2, } = await loadFixture(setup);
|
|
821
|
-
await makeRequest(enclave, usdcToken, {
|
|
822
|
-
threshold: request.threshold,
|
|
823
|
-
startWindow: request.startWindow,
|
|
824
|
-
duration: request.duration,
|
|
825
|
-
e3Program: request.e3Program,
|
|
826
|
-
e3ProgramParams: request.e3ProgramParams,
|
|
827
|
-
computeProviderParams: request.computeProviderParams,
|
|
828
|
-
customParams: request.customParams,
|
|
829
|
-
});
|
|
830
|
-
await setupAndPublishCommittee(ciphernodeRegistryContract, 0, [await operator1.getAddress(), await operator2.getAddress()], data, operator1, operator2);
|
|
831
|
-
await enclave.activate(0);
|
|
832
|
-
await mine(2, { interval: request.duration });
|
|
833
|
-
await expect(enclave.publishInput(0, ethers.ZeroHash)).to.be.revertedWithCustomError(enclave, "InputDeadlinePassed");
|
|
834
|
-
});
|
|
835
|
-
it("it allows publishing input to different requests", async function () {
|
|
836
|
-
const fixtureSetup = () => setup();
|
|
837
|
-
const { enclave, request, usdcToken, ciphernodeRegistryContract, operator1, operator2, } = await loadFixture(fixtureSetup);
|
|
838
|
-
const inputData = "0x12345678";
|
|
839
|
-
await makeRequest(enclave, usdcToken, {
|
|
840
|
-
threshold: request.threshold,
|
|
841
|
-
startWindow: request.startWindow,
|
|
842
|
-
duration: request.duration,
|
|
843
|
-
e3Program: request.e3Program,
|
|
844
|
-
e3ProgramParams: request.e3ProgramParams,
|
|
845
|
-
computeProviderParams: request.computeProviderParams,
|
|
846
|
-
customParams: request.customParams,
|
|
847
|
-
});
|
|
848
|
-
await setupAndPublishCommittee(ciphernodeRegistryContract, 0, [await operator1.getAddress(), await operator2.getAddress()], data, operator1, operator2);
|
|
849
|
-
await enclave.activate(0);
|
|
850
|
-
await enclave.publishInput(0, inputData);
|
|
851
|
-
await makeRequest(enclave, usdcToken, {
|
|
852
|
-
threshold: request.threshold,
|
|
853
|
-
startWindow: request.startWindow,
|
|
854
|
-
duration: request.duration,
|
|
855
|
-
e3Program: request.e3Program,
|
|
856
|
-
e3ProgramParams: request.e3ProgramParams,
|
|
857
|
-
computeProviderParams: request.computeProviderParams,
|
|
858
|
-
customParams: request.customParams,
|
|
859
|
-
});
|
|
860
|
-
await setupAndPublishCommittee(ciphernodeRegistryContract, 1, [await operator1.getAddress(), await operator2.getAddress()], data, operator1, operator2);
|
|
861
|
-
await enclave.activate(1);
|
|
862
|
-
await enclave.publishInput(1, inputData);
|
|
863
|
-
});
|
|
864
|
-
it("returns true if input is published successfully", async function () {
|
|
865
|
-
const { enclave, request, usdcToken, ciphernodeRegistryContract, operator1, operator2, } = await loadFixture(setup);
|
|
866
|
-
const inputData = "0x12345678";
|
|
867
|
-
await makeRequest(enclave, usdcToken, {
|
|
868
|
-
threshold: request.threshold,
|
|
869
|
-
startWindow: request.startWindow,
|
|
870
|
-
duration: request.duration,
|
|
871
|
-
e3Program: request.e3Program,
|
|
872
|
-
e3ProgramParams: request.e3ProgramParams,
|
|
873
|
-
computeProviderParams: request.computeProviderParams,
|
|
874
|
-
customParams: request.customParams,
|
|
875
|
-
});
|
|
876
|
-
await setupAndPublishCommittee(ciphernodeRegistryContract, 0, [await operator1.getAddress(), await operator2.getAddress()], data, operator1, operator2);
|
|
877
|
-
await enclave.activate(0);
|
|
878
|
-
expect(await enclave.publishInput.staticCall(0, inputData)).to.equal(true);
|
|
879
|
-
});
|
|
880
|
-
});
|
|
881
601
|
describe("publishCiphertextOutput()", function () {
|
|
882
602
|
it("reverts if E3 does not exist", async function () {
|
|
883
603
|
const { enclave } = await loadFixture(setup);
|
|
@@ -885,69 +605,50 @@ describe("Enclave", function () {
|
|
|
885
605
|
.to.be.revertedWithCustomError(enclave, "E3DoesNotExist")
|
|
886
606
|
.withArgs(0);
|
|
887
607
|
});
|
|
888
|
-
it("reverts if
|
|
889
|
-
const { enclave, request, usdcToken } = await loadFixture(setup);
|
|
608
|
+
it("reverts if output has already been published", async function () {
|
|
609
|
+
const { enclave, request, usdcToken, ciphernodeRegistryContract, operator1, operator2, } = await loadFixture(setup);
|
|
890
610
|
const e3Id = 0;
|
|
891
611
|
await makeRequest(enclave, usdcToken, {
|
|
892
612
|
threshold: request.threshold,
|
|
893
|
-
|
|
894
|
-
duration: request.duration,
|
|
613
|
+
inputWindow: request.inputWindow,
|
|
895
614
|
e3Program: request.e3Program,
|
|
896
615
|
e3ProgramParams: request.e3ProgramParams,
|
|
897
616
|
computeProviderParams: request.computeProviderParams,
|
|
898
617
|
customParams: request.customParams,
|
|
899
618
|
});
|
|
900
|
-
await
|
|
901
|
-
|
|
619
|
+
await setupAndPublishCommittee(ciphernodeRegistryContract, e3Id, [await operator1.getAddress(), await operator2.getAddress()], data, operator1, operator2);
|
|
620
|
+
await mine(2, { interval: inputWindowDuration });
|
|
621
|
+
await enclave.publishCiphertextOutput(e3Id, data, proof);
|
|
622
|
+
await expect(enclave.publishCiphertextOutput(e3Id, data, proof))
|
|
623
|
+
.to.be.revertedWithCustomError(enclave, "CiphertextOutputAlreadyPublished")
|
|
902
624
|
.withArgs(e3Id);
|
|
903
625
|
});
|
|
904
|
-
it("reverts if
|
|
626
|
+
it("reverts if committee duties are over", async function () {
|
|
905
627
|
const { enclave, request, usdcToken, ciphernodeRegistryContract, operator1, operator2, } = await loadFixture(setup);
|
|
906
|
-
const
|
|
628
|
+
const e3Id = 0;
|
|
907
629
|
await makeRequest(enclave, usdcToken, {
|
|
908
630
|
...request,
|
|
909
|
-
|
|
631
|
+
inputWindow: [(await time.latest()) + 20, (await time.latest()) + 100],
|
|
910
632
|
});
|
|
911
|
-
const e3Id = 0;
|
|
912
633
|
await setupAndPublishCommittee(ciphernodeRegistryContract, e3Id, [await operator1.getAddress(), await operator2.getAddress()], data, operator1, operator2);
|
|
913
|
-
await
|
|
914
|
-
|
|
915
|
-
});
|
|
916
|
-
it("reverts if output has already been published", async function () {
|
|
917
|
-
const { enclave, request, usdcToken, ciphernodeRegistryContract, operator1, operator2, } = await loadFixture(setup);
|
|
918
|
-
const e3Id = 0;
|
|
919
|
-
await makeRequest(enclave, usdcToken, {
|
|
920
|
-
threshold: request.threshold,
|
|
921
|
-
startWindow: [await time.latest(), (await time.latest()) + 100],
|
|
922
|
-
duration: request.duration,
|
|
923
|
-
e3Program: request.e3Program,
|
|
924
|
-
e3ProgramParams: request.e3ProgramParams,
|
|
925
|
-
computeProviderParams: request.computeProviderParams,
|
|
926
|
-
customParams: request.customParams,
|
|
634
|
+
await mine(2, {
|
|
635
|
+
interval: inputWindowDuration + timeoutConfig.computeWindow,
|
|
927
636
|
});
|
|
928
|
-
await
|
|
929
|
-
await enclave.activate(e3Id);
|
|
930
|
-
await mine(2, { interval: request.duration });
|
|
931
|
-
expect(await enclave.publishCiphertextOutput(e3Id, data, proof));
|
|
932
|
-
await expect(enclave.publishCiphertextOutput(e3Id, data, proof))
|
|
933
|
-
.to.be.revertedWithCustomError(enclave, "CiphertextOutputAlreadyPublished")
|
|
934
|
-
.withArgs(e3Id);
|
|
637
|
+
await expect(enclave.publishCiphertextOutput(e3Id, data, proof)).to.be.revertedWithCustomError(enclave, "CommitteeDutiesCompleted");
|
|
935
638
|
});
|
|
936
639
|
it("reverts if output is not valid", async function () {
|
|
937
640
|
const { enclave, request, usdcToken, ciphernodeRegistryContract, operator1, operator2, } = await loadFixture(setup);
|
|
938
641
|
const e3Id = 0;
|
|
939
642
|
await makeRequest(enclave, usdcToken, {
|
|
940
643
|
threshold: request.threshold,
|
|
941
|
-
|
|
942
|
-
duration: request.duration,
|
|
644
|
+
inputWindow: [(await time.latest()) + 20, (await time.latest()) + 100],
|
|
943
645
|
e3Program: request.e3Program,
|
|
944
646
|
e3ProgramParams: request.e3ProgramParams,
|
|
945
647
|
computeProviderParams: request.computeProviderParams,
|
|
946
648
|
customParams: request.customParams,
|
|
947
649
|
});
|
|
948
650
|
await setupAndPublishCommittee(ciphernodeRegistryContract, e3Id, [await operator1.getAddress(), await operator2.getAddress()], data, operator1, operator2);
|
|
949
|
-
await
|
|
950
|
-
await mine(2, { interval: request.duration });
|
|
651
|
+
await mine(2, { interval: inputWindowDuration });
|
|
951
652
|
await expect(enclave.publishCiphertextOutput(e3Id, "0x", "0x")).to.be.revertedWithCustomError(enclave, "InvalidOutput");
|
|
952
653
|
});
|
|
953
654
|
it("sets ciphertextOutput correctly", async function () {
|
|
@@ -955,11 +656,10 @@ describe("Enclave", function () {
|
|
|
955
656
|
const e3Id = 0;
|
|
956
657
|
await makeRequest(enclave, usdcToken, {
|
|
957
658
|
...request,
|
|
958
|
-
|
|
659
|
+
inputWindow: [(await time.latest()) + 20, (await time.latest()) + 100],
|
|
959
660
|
});
|
|
960
661
|
await setupAndPublishCommittee(ciphernodeRegistryContract, e3Id, [await operator1.getAddress(), await operator2.getAddress()], data, operator1, operator2);
|
|
961
|
-
await
|
|
962
|
-
await mine(2, { interval: request.duration });
|
|
662
|
+
await mine(2, { interval: inputWindowDuration });
|
|
963
663
|
expect(await enclave.publishCiphertextOutput(e3Id, data, proof));
|
|
964
664
|
const e3 = await enclave.getE3(e3Id);
|
|
965
665
|
expect(e3.ciphertextOutput).to.equal(ethers.keccak256(data));
|
|
@@ -969,11 +669,10 @@ describe("Enclave", function () {
|
|
|
969
669
|
const e3Id = 0;
|
|
970
670
|
await makeRequest(enclave, usdcToken, {
|
|
971
671
|
...request,
|
|
972
|
-
|
|
672
|
+
inputWindow: [(await time.latest()) + 20, (await time.latest()) + 100],
|
|
973
673
|
});
|
|
974
674
|
await setupAndPublishCommittee(ciphernodeRegistryContract, e3Id, [await operator1.getAddress(), await operator2.getAddress()], data, operator1, operator2);
|
|
975
|
-
await
|
|
976
|
-
await mine(2, { interval: request.duration });
|
|
675
|
+
await mine(2, { interval: inputWindowDuration });
|
|
977
676
|
expect(await enclave.publishCiphertextOutput.staticCall(e3Id, data, proof)).to.equal(true);
|
|
978
677
|
});
|
|
979
678
|
it("emits CiphertextOutputPublished event", async function () {
|
|
@@ -981,11 +680,10 @@ describe("Enclave", function () {
|
|
|
981
680
|
const e3Id = 0;
|
|
982
681
|
await makeRequest(enclave, usdcToken, {
|
|
983
682
|
...request,
|
|
984
|
-
|
|
683
|
+
inputWindow: [(await time.latest()) + 20, (await time.latest()) + 100],
|
|
985
684
|
});
|
|
986
685
|
await setupAndPublishCommittee(ciphernodeRegistryContract, e3Id, [await operator1.getAddress(), await operator2.getAddress()], data, operator1, operator2);
|
|
987
|
-
await
|
|
988
|
-
await mine(2, { interval: request.duration });
|
|
686
|
+
await mine(2, { interval: inputWindowDuration });
|
|
989
687
|
await expect(enclave.publishCiphertextOutput(e3Id, data, proof))
|
|
990
688
|
.to.emit(enclave, "CiphertextOutputPublished")
|
|
991
689
|
.withArgs(e3Id, data);
|
|
@@ -999,56 +697,38 @@ describe("Enclave", function () {
|
|
|
999
697
|
.to.be.revertedWithCustomError(enclave, "E3DoesNotExist")
|
|
1000
698
|
.withArgs(e3Id);
|
|
1001
699
|
});
|
|
1002
|
-
it("reverts if E3 has not been activated", async function () {
|
|
1003
|
-
const { enclave, request, usdcToken } = await loadFixture(setup);
|
|
1004
|
-
const e3Id = 0;
|
|
1005
|
-
await makeRequest(enclave, usdcToken, {
|
|
1006
|
-
...request,
|
|
1007
|
-
startWindow: [await time.latest(), (await time.latest()) + 100],
|
|
1008
|
-
});
|
|
1009
|
-
await expect(enclave.publishPlaintextOutput(e3Id, data, "0x"))
|
|
1010
|
-
.to.be.revertedWithCustomError(enclave, "E3NotActivated")
|
|
1011
|
-
.withArgs(e3Id);
|
|
1012
|
-
});
|
|
1013
700
|
it("reverts if ciphertextOutput has not been published", async function () {
|
|
1014
701
|
const { enclave, request, usdcToken, ciphernodeRegistryContract, operator1, operator2, } = await loadFixture(setup);
|
|
1015
702
|
const e3Id = 0;
|
|
1016
703
|
await makeRequest(enclave, usdcToken, {
|
|
1017
704
|
...request,
|
|
1018
|
-
|
|
705
|
+
inputWindow: [(await time.latest()) + 20, (await time.latest()) + 100],
|
|
1019
706
|
});
|
|
1020
707
|
await setupAndPublishCommittee(ciphernodeRegistryContract, e3Id, [await operator1.getAddress(), await operator2.getAddress()], data, operator1, operator2);
|
|
1021
|
-
await enclave.
|
|
1022
|
-
await expect(enclave.publishPlaintextOutput(e3Id, data, "0x"))
|
|
1023
|
-
.to.be.revertedWithCustomError(enclave, "CiphertextOutputNotPublished")
|
|
1024
|
-
.withArgs(e3Id);
|
|
708
|
+
await expect(enclave.publishPlaintextOutput(e3Id, data, "0x")).to.be.revertedWithCustomError(enclave, "InvalidStage");
|
|
1025
709
|
});
|
|
1026
710
|
it("reverts if plaintextOutput has already been published", async function () {
|
|
1027
711
|
const { enclave, request, usdcToken, ciphernodeRegistryContract, operator1, operator2, } = await loadFixture(setup);
|
|
1028
712
|
const e3Id = 0;
|
|
1029
713
|
await makeRequest(enclave, usdcToken, {
|
|
1030
714
|
...request,
|
|
1031
|
-
|
|
715
|
+
inputWindow: [(await time.latest()) + 20, (await time.latest()) + 100],
|
|
1032
716
|
});
|
|
1033
717
|
await setupAndPublishCommittee(ciphernodeRegistryContract, e3Id, [await operator1.getAddress(), await operator2.getAddress()], data, operator1, operator2);
|
|
1034
|
-
await
|
|
1035
|
-
await mine(2, { interval: request.duration });
|
|
718
|
+
await mine(2, { interval: inputWindowDuration });
|
|
1036
719
|
await enclave.publishCiphertextOutput(e3Id, data, proof);
|
|
1037
720
|
await enclave.publishPlaintextOutput(e3Id, data, proof);
|
|
1038
|
-
await expect(enclave.publishPlaintextOutput(e3Id, data, proof))
|
|
1039
|
-
.to.be.revertedWithCustomError(enclave, "PlaintextOutputAlreadyPublished")
|
|
1040
|
-
.withArgs(e3Id);
|
|
721
|
+
await expect(enclave.publishPlaintextOutput(e3Id, data, proof)).to.be.revertedWithCustomError(enclave, "InvalidStage");
|
|
1041
722
|
});
|
|
1042
723
|
it("reverts if output is not valid", async function () {
|
|
1043
724
|
const { enclave, request, usdcToken, ciphernodeRegistryContract, operator1, operator2, } = await loadFixture(setup);
|
|
1044
725
|
const e3Id = 0;
|
|
1045
726
|
await makeRequest(enclave, usdcToken, {
|
|
1046
727
|
...request,
|
|
1047
|
-
|
|
728
|
+
inputWindow: [(await time.latest()) + 20, (await time.latest()) + 100],
|
|
1048
729
|
});
|
|
1049
730
|
await setupAndPublishCommittee(ciphernodeRegistryContract, e3Id, [await operator1.getAddress(), await operator2.getAddress()], data, operator1, operator2);
|
|
1050
|
-
await
|
|
1051
|
-
await mine(2, { interval: request.duration });
|
|
731
|
+
await mine(2, { interval: inputWindowDuration });
|
|
1052
732
|
await enclave.publishCiphertextOutput(e3Id, data, proof);
|
|
1053
733
|
await expect(enclave.publishPlaintextOutput(e3Id, data, "0x"))
|
|
1054
734
|
.to.be.revertedWithCustomError(enclave, "InvalidOutput")
|
|
@@ -1059,11 +739,10 @@ describe("Enclave", function () {
|
|
|
1059
739
|
const e3Id = 0;
|
|
1060
740
|
await makeRequest(enclave, usdcToken, {
|
|
1061
741
|
...request,
|
|
1062
|
-
|
|
742
|
+
inputWindow: [(await time.latest()) + 20, (await time.latest()) + 100],
|
|
1063
743
|
});
|
|
1064
744
|
await setupAndPublishCommittee(ciphernodeRegistryContract, e3Id, [await operator1.getAddress(), await operator2.getAddress()], data, operator1, operator2);
|
|
1065
|
-
await
|
|
1066
|
-
await mine(2, { interval: request.duration });
|
|
745
|
+
await mine(2, { interval: inputWindowDuration });
|
|
1067
746
|
await enclave.publishCiphertextOutput(e3Id, data, proof);
|
|
1068
747
|
expect(await enclave.publishPlaintextOutput(e3Id, data, proof));
|
|
1069
748
|
const e3 = await enclave.getE3(e3Id);
|
|
@@ -1074,11 +753,10 @@ describe("Enclave", function () {
|
|
|
1074
753
|
const e3Id = 0;
|
|
1075
754
|
await makeRequest(enclave, usdcToken, {
|
|
1076
755
|
...request,
|
|
1077
|
-
|
|
756
|
+
inputWindow: [(await time.latest()) + 20, (await time.latest()) + 100],
|
|
1078
757
|
});
|
|
1079
758
|
await setupAndPublishCommittee(ciphernodeRegistryContract, e3Id, [await operator1.getAddress(), await operator2.getAddress()], data, operator1, operator2);
|
|
1080
|
-
await
|
|
1081
|
-
await mine(2, { interval: request.duration });
|
|
759
|
+
await mine(2, { interval: inputWindowDuration });
|
|
1082
760
|
await enclave.publishCiphertextOutput(e3Id, data, proof);
|
|
1083
761
|
expect(await enclave.publishPlaintextOutput.staticCall(e3Id, data, proof)).to.equal(true);
|
|
1084
762
|
});
|
|
@@ -1087,11 +765,10 @@ describe("Enclave", function () {
|
|
|
1087
765
|
const e3Id = 0;
|
|
1088
766
|
await makeRequest(enclave, usdcToken, {
|
|
1089
767
|
...request,
|
|
1090
|
-
|
|
768
|
+
inputWindow: [(await time.latest()) + 20, (await time.latest()) + 100],
|
|
1091
769
|
});
|
|
1092
770
|
await setupAndPublishCommittee(ciphernodeRegistryContract, e3Id, [await operator1.getAddress(), await operator2.getAddress()], data, operator1, operator2);
|
|
1093
|
-
await
|
|
1094
|
-
await mine(2, { interval: request.duration });
|
|
771
|
+
await mine(2, { interval: inputWindowDuration });
|
|
1095
772
|
await enclave.publishCiphertextOutput(e3Id, data, proof);
|
|
1096
773
|
await expect(await enclave.publishPlaintextOutput(e3Id, data, proof))
|
|
1097
774
|
.to.emit(enclave, "PlaintextOutputPublished")
|