@enclave-e3/contracts 0.1.4 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +46 -2
- package/artifacts/@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol/ProxyAdmin.json +135 -0
- package/artifacts/@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol/artifacts.d.ts +27 -0
- package/artifacts/@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol/ITransparentUpgradeableProxy.json +77 -0
- package/artifacts/@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol/TransparentUpgradeableProxy.json +126 -0
- package/artifacts/@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol/artifacts.d.ts +43 -0
- package/artifacts/build-info/solc-0_8_28-5150b9e6b6cf4df4986fccba97bea37a16fdfebc.json +311 -0
- package/artifacts/build-info/solc-0_8_28-5150b9e6b6cf4df4986fccba97bea37a16fdfebc.output.json +1 -0
- package/artifacts/contracts/Enclave.sol/Enclave.json +239 -147
- package/artifacts/contracts/Enclave.sol/artifacts.d.ts +6 -6
- package/artifacts/contracts/interfaces/IBondingRegistry.sol/IBondingRegistry.json +881 -0
- package/artifacts/contracts/interfaces/IBondingRegistry.sol/artifacts.d.ts +27 -0
- package/artifacts/contracts/interfaces/ICiphernodeRegistry.sol/ICiphernodeRegistry.json +326 -10
- 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 +21 -3
- package/artifacts/contracts/interfaces/IE3Program.sol/artifacts.d.ts +2 -2
- package/artifacts/contracts/interfaces/IEnclave.sol/IEnclave.json +247 -27
- package/artifacts/contracts/interfaces/IEnclave.sol/artifacts.d.ts +2 -2
- package/artifacts/contracts/interfaces/{IRegistryFilter.sol/IRegistryFilter.json → ISlashVerifier.sol/ISlashVerifier.json} +10 -10
- package/artifacts/contracts/interfaces/ISlashVerifier.sol/artifacts.d.ts +27 -0
- package/artifacts/contracts/interfaces/ISlashingManager.sol/ISlashingManager.json +759 -0
- package/artifacts/contracts/interfaces/ISlashingManager.sol/artifacts.d.ts +27 -0
- package/artifacts/contracts/lib/ExitQueueLib.sol/ExitQueueLib.json +116 -0
- package/artifacts/contracts/lib/ExitQueueLib.sol/artifacts.d.ts +27 -0
- package/artifacts/contracts/registry/BondingRegistry.sol/BondingRegistry.json +1217 -0
- package/artifacts/contracts/registry/BondingRegistry.sol/artifacts.d.ts +27 -0
- package/artifacts/contracts/registry/CiphernodeRegistryOwnable.sol/CiphernodeRegistryOwnable.json +351 -57
- package/artifacts/contracts/registry/CiphernodeRegistryOwnable.sol/artifacts.d.ts +6 -6
- package/artifacts/contracts/slashing/SlashingManager.sol/SlashingManager.json +1107 -0
- package/artifacts/contracts/slashing/SlashingManager.sol/artifacts.d.ts +27 -0
- package/artifacts/contracts/test/MockCiphernodeRegistry.sol/MockCiphernodeRegistry.json +328 -12
- package/artifacts/contracts/test/MockCiphernodeRegistry.sol/MockCiphernodeRegistryEmptyKey.json +328 -12
- package/artifacts/contracts/test/MockCiphernodeRegistry.sol/artifacts.d.ts +8 -8
- package/artifacts/contracts/test/MockComputeProvider.sol/MockComputeProvider.json +4 -4
- package/artifacts/contracts/test/MockComputeProvider.sol/artifacts.d.ts +4 -4
- package/artifacts/contracts/test/MockDecryptionVerifier.sol/MockDecryptionVerifier.json +3 -3
- package/artifacts/contracts/test/MockDecryptionVerifier.sol/artifacts.d.ts +3 -3
- package/artifacts/contracts/test/MockE3Program.sol/MockE3Program.json +26 -32
- package/artifacts/contracts/test/MockE3Program.sol/artifacts.d.ts +4 -4
- package/artifacts/contracts/test/MockSlashingVerifier.sol/MockSlashingVerifier.json +38 -0
- package/artifacts/contracts/test/MockSlashingVerifier.sol/artifacts.d.ts +27 -0
- package/artifacts/contracts/test/MockStableToken.sol/MockUSDC.json +425 -0
- package/artifacts/contracts/test/MockStableToken.sol/artifacts.d.ts +27 -0
- package/artifacts/contracts/token/EnclaveTicketToken.sol/EnclaveTicketToken.json +1222 -0
- package/artifacts/contracts/token/EnclaveTicketToken.sol/artifacts.d.ts +27 -0
- package/artifacts/contracts/token/EnclaveToken.sol/EnclaveToken.json +1460 -0
- package/artifacts/contracts/token/EnclaveToken.sol/artifacts.d.ts +27 -0
- package/artifacts/poseidon-solidity/PoseidonT3.sol/PoseidonT3.json +3 -3
- package/artifacts/poseidon-solidity/PoseidonT3.sol/artifacts.d.ts +3 -3
- package/contracts/Enclave.sol +230 -81
- package/contracts/interfaces/IBondingRegistry.sol +446 -0
- package/contracts/interfaces/ICiphernodeRegistry.sol +153 -9
- package/contracts/interfaces/IComputeProvider.sol +12 -2
- package/contracts/interfaces/IDecryptionVerifier.sol +11 -6
- package/contracts/interfaces/IE3.sol +21 -17
- package/contracts/interfaces/IE3Program.sol +30 -17
- package/contracts/interfaces/IEnclave.sol +95 -21
- package/contracts/interfaces/ISlashVerifier.sol +23 -0
- package/contracts/interfaces/ISlashingManager.sol +426 -0
- package/contracts/lib/ExitQueueLib.sol +490 -0
- package/contracts/registry/BondingRegistry.sol +737 -0
- package/contracts/registry/CiphernodeRegistryOwnable.sol +393 -26
- package/contracts/slashing/SlashingManager.sol +367 -0
- package/contracts/test/MockCiphernodeRegistry.sol +118 -24
- package/contracts/test/MockComputeProvider.sol +2 -2
- package/contracts/test/MockE3Program.sol +17 -14
- package/contracts/test/MockSlashingVerifier.sol +19 -0
- package/contracts/test/MockStableToken.sol +28 -0
- package/contracts/token/EnclaveTicketToken.sol +243 -0
- package/contracts/token/EnclaveToken.sol +267 -0
- package/dist/hardhat.config.d.ts.map +1 -1
- package/dist/hardhat.config.js +35 -16
- package/dist/ignition/modules/{mockInputValidator.d.ts → bondingRegistry.d.ts} +1 -1
- package/dist/ignition/modules/bondingRegistry.d.ts.map +1 -0
- package/dist/ignition/modules/bondingRegistry.js +35 -0
- package/dist/ignition/modules/ciphernodeRegistry.d.ts.map +1 -1
- package/dist/ignition/modules/ciphernodeRegistry.js +12 -2
- package/dist/ignition/modules/enclave.d.ts.map +1 -1
- package/dist/ignition/modules/enclave.js +16 -7
- package/dist/ignition/modules/{naiveRegistryFilter.d.ts → enclaveTicketToken.d.ts} +1 -1
- package/dist/ignition/modules/enclaveTicketToken.d.ts.map +1 -0
- package/dist/ignition/modules/enclaveTicketToken.js +17 -0
- package/dist/ignition/modules/enclaveToken.d.ts +3 -0
- package/dist/ignition/modules/enclaveToken.d.ts.map +1 -0
- package/dist/ignition/modules/{mockInputValidator.js → enclaveToken.js} +4 -4
- package/dist/ignition/modules/mockCiphernodeRegistry.d.ts.map +1 -1
- package/dist/ignition/modules/mockCiphernodeRegistry.js +0 -1
- package/dist/ignition/modules/mockCiphernodeRegistryEmptyKey.d.ts.map +1 -1
- package/dist/ignition/modules/mockCiphernodeRegistryEmptyKey.js +0 -1
- package/dist/ignition/modules/mockComputeProvider.d.ts.map +1 -1
- package/dist/ignition/modules/mockComputeProvider.js +0 -1
- package/dist/ignition/modules/mockDecryptionVerifier.d.ts.map +1 -1
- package/dist/ignition/modules/mockDecryptionVerifier.js +0 -1
- package/dist/ignition/modules/mockE3Program.d.ts.map +1 -1
- package/dist/ignition/modules/mockE3Program.js +1 -3
- package/dist/ignition/modules/mockSlashingVerifier.d.ts +3 -0
- package/dist/ignition/modules/mockSlashingVerifier.d.ts.map +1 -0
- package/dist/ignition/modules/mockSlashingVerifier.js +10 -0
- package/dist/ignition/modules/mockStableToken.d.ts +3 -0
- package/dist/ignition/modules/mockStableToken.d.ts.map +1 -0
- package/dist/ignition/modules/mockStableToken.js +11 -0
- package/dist/ignition/modules/poseidonT3.d.ts.map +1 -1
- package/dist/ignition/modules/poseidonT3.js +0 -1
- package/dist/ignition/modules/slashingManager.d.ts +3 -0
- package/dist/ignition/modules/slashingManager.d.ts.map +1 -0
- package/dist/ignition/modules/slashingManager.js +16 -0
- package/dist/scripts/cleanIgnitionState.d.ts +12 -0
- package/dist/scripts/cleanIgnitionState.d.ts.map +1 -0
- package/dist/scripts/cleanIgnitionState.js +41 -0
- package/dist/scripts/deployAndSave/bondingRegistry.d.ts +38 -0
- package/dist/scripts/deployAndSave/bondingRegistry.d.ts.map +1 -0
- package/dist/scripts/deployAndSave/bondingRegistry.js +133 -0
- package/dist/scripts/deployAndSave/ciphernodeRegistryOwnable.d.ts +11 -1
- package/dist/scripts/deployAndSave/ciphernodeRegistryOwnable.d.ts.map +1 -1
- package/dist/scripts/deployAndSave/ciphernodeRegistryOwnable.js +76 -19
- package/dist/scripts/deployAndSave/enclave.d.ts +16 -2
- package/dist/scripts/deployAndSave/enclave.d.ts.map +1 -1
- package/dist/scripts/deployAndSave/enclave.js +89 -22
- package/dist/scripts/deployAndSave/enclaveTicketToken.d.ts +20 -0
- package/dist/scripts/deployAndSave/enclaveTicketToken.d.ts.map +1 -0
- package/dist/scripts/deployAndSave/enclaveTicketToken.js +41 -0
- package/dist/scripts/deployAndSave/enclaveToken.d.ts +18 -0
- package/dist/scripts/deployAndSave/enclaveToken.d.ts.map +1 -0
- package/dist/scripts/deployAndSave/enclaveToken.js +57 -0
- package/dist/scripts/deployAndSave/mockComputeProvider.d.ts.map +1 -1
- package/dist/scripts/deployAndSave/mockComputeProvider.js +5 -5
- package/dist/scripts/deployAndSave/mockDecryptionVerifier.d.ts.map +1 -1
- package/dist/scripts/deployAndSave/mockDecryptionVerifier.js +5 -5
- package/dist/scripts/deployAndSave/mockProgram.d.ts +1 -2
- package/dist/scripts/deployAndSave/mockProgram.d.ts.map +1 -1
- package/dist/scripts/deployAndSave/mockProgram.js +7 -19
- package/dist/scripts/deployAndSave/mockStableToken.d.ts +18 -0
- package/dist/scripts/deployAndSave/mockStableToken.d.ts.map +1 -0
- package/dist/scripts/deployAndSave/mockStableToken.js +36 -0
- package/dist/scripts/deployAndSave/poseidonT3.d.ts +11 -0
- package/dist/scripts/deployAndSave/poseidonT3.d.ts.map +1 -0
- package/dist/scripts/deployAndSave/poseidonT3.js +41 -0
- package/dist/scripts/deployAndSave/slashingManager.d.ts +19 -0
- package/dist/scripts/deployAndSave/slashingManager.d.ts.map +1 -0
- package/dist/scripts/deployAndSave/slashingManager.js +38 -0
- package/dist/scripts/deployEnclave.d.ts.map +1 -1
- package/dist/scripts/deployEnclave.js +109 -23
- package/dist/scripts/deployMocks.d.ts +0 -1
- package/dist/scripts/deployMocks.d.ts.map +1 -1
- package/dist/scripts/deployMocks.js +3 -6
- package/dist/scripts/index.d.ts +7 -2
- package/dist/scripts/index.d.ts.map +1 -1
- package/dist/scripts/index.js +7 -2
- package/dist/scripts/proxy.d.ts +22 -0
- package/dist/scripts/proxy.d.ts.map +1 -0
- package/dist/scripts/proxy.js +36 -0
- package/dist/scripts/runVerification.d.ts +2 -0
- package/dist/scripts/runVerification.d.ts.map +1 -0
- package/dist/scripts/runVerification.js +16 -0
- package/dist/scripts/upgrade/bondingRegistry.d.ts +6 -0
- package/dist/scripts/upgrade/bondingRegistry.d.ts.map +1 -0
- package/dist/scripts/upgrade/bondingRegistry.js +49 -0
- package/dist/scripts/upgrade/ciphernodeRegistryOwnable.d.ts +6 -0
- package/dist/scripts/upgrade/ciphernodeRegistryOwnable.d.ts.map +1 -0
- package/dist/scripts/upgrade/ciphernodeRegistryOwnable.js +52 -0
- package/dist/scripts/upgrade/enclave.d.ts +6 -0
- package/dist/scripts/upgrade/enclave.d.ts.map +1 -0
- package/dist/scripts/upgrade/enclave.js +49 -0
- package/dist/scripts/utils.d.ts +51 -2
- package/dist/scripts/utils.d.ts.map +1 -1
- package/dist/scripts/utils.js +67 -4
- package/dist/scripts/verify.d.ts +6 -0
- package/dist/scripts/verify.d.ts.map +1 -0
- package/dist/scripts/verify.js +142 -0
- package/dist/tasks/ciphernode.d.ts +2 -0
- package/dist/tasks/ciphernode.d.ts.map +1 -1
- package/dist/tasks/ciphernode.js +290 -19
- package/dist/tasks/enclave.d.ts.map +1 -1
- package/dist/tasks/enclave.js +76 -31
- package/dist/test/Enclave.spec.js +377 -370
- package/dist/test/Registry/BondingRegistry.spec.d.ts +2 -0
- package/dist/test/Registry/BondingRegistry.spec.d.ts.map +1 -0
- package/dist/test/Registry/BondingRegistry.spec.js +684 -0
- package/dist/test/Registry/CiphernodeRegistryOwnable.spec.d.ts.map +1 -0
- package/dist/test/Registry/CiphernodeRegistryOwnable.spec.js +374 -0
- package/dist/test/Slashing/SlashingManager.spec.d.ts +2 -0
- package/dist/test/Slashing/SlashingManager.spec.d.ts.map +1 -0
- package/dist/test/Slashing/SlashingManager.spec.js +672 -0
- package/dist/types/@openzeppelin/contracts/index.d.ts +3 -0
- package/dist/types/@openzeppelin/contracts/index.d.ts.map +1 -0
- package/dist/types/@openzeppelin/contracts/proxy/index.d.ts +3 -0
- package/dist/types/@openzeppelin/contracts/proxy/index.d.ts.map +1 -0
- package/dist/types/@openzeppelin/contracts/proxy/transparent/ProxyAdmin.d.ts +97 -0
- package/dist/types/@openzeppelin/contracts/proxy/transparent/ProxyAdmin.d.ts.map +1 -0
- package/dist/types/{contracts/registry/NaiveRegistryFilter.js → @openzeppelin/contracts/proxy/transparent/ProxyAdmin.js} +0 -4
- package/dist/types/@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol/ITransparentUpgradeableProxy.d.ts +81 -0
- package/dist/types/@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol/ITransparentUpgradeableProxy.d.ts.map +1 -0
- package/dist/types/@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol/ITransparentUpgradeableProxy.js +12 -0
- package/dist/types/@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol/TransparentUpgradeableProxy.d.ts +52 -0
- package/dist/types/@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol/TransparentUpgradeableProxy.d.ts.map +1 -0
- package/dist/types/@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol/TransparentUpgradeableProxy.js +8 -0
- package/dist/types/@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol/index.d.ts +3 -0
- package/dist/types/@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol/index.d.ts.map +1 -0
- package/dist/types/@openzeppelin/contracts/proxy/transparent/index.d.ts +4 -0
- package/dist/types/@openzeppelin/contracts/proxy/transparent/index.d.ts.map +1 -0
- package/dist/types/@openzeppelin/index.d.ts +3 -0
- package/dist/types/@openzeppelin/index.d.ts.map +1 -0
- package/dist/types/contracts/Enclave.d.ts +126 -53
- package/dist/types/contracts/Enclave.d.ts.map +1 -1
- package/dist/types/contracts/Enclave.js +12 -0
- package/dist/types/contracts/index.d.ts +6 -0
- package/dist/types/contracts/index.d.ts.map +1 -1
- package/dist/types/contracts/interfaces/IBondingRegistry.d.ts +622 -0
- package/dist/types/contracts/interfaces/IBondingRegistry.d.ts.map +1 -0
- package/dist/types/contracts/interfaces/IBondingRegistry.js +24 -0
- package/dist/types/contracts/interfaces/ICiphernodeRegistry.d.ts +245 -15
- package/dist/types/contracts/interfaces/ICiphernodeRegistry.d.ts.map +1 -1
- package/dist/types/contracts/interfaces/ICiphernodeRegistry.js +16 -0
- package/dist/types/contracts/interfaces/IE3Program.d.ts +20 -10
- package/dist/types/contracts/interfaces/IE3Program.d.ts.map +1 -1
- package/dist/types/contracts/interfaces/IEnclave.d.ts +149 -20
- package/dist/types/contracts/interfaces/IEnclave.d.ts.map +1 -1
- package/dist/types/contracts/interfaces/IEnclave.js +12 -0
- package/dist/types/contracts/interfaces/{IRegistryFilter.d.ts → ISlashVerifier.d.ts} +16 -16
- package/dist/types/contracts/interfaces/ISlashVerifier.d.ts.map +1 -0
- package/dist/types/contracts/interfaces/ISlashVerifier.js +1 -0
- package/dist/types/contracts/interfaces/ISlashingManager.d.ts +384 -0
- package/dist/types/contracts/interfaces/ISlashingManager.d.ts.map +1 -0
- package/dist/types/contracts/interfaces/ISlashingManager.js +24 -0
- package/dist/types/contracts/interfaces/index.d.ts +3 -2
- package/dist/types/contracts/interfaces/index.d.ts.map +1 -1
- package/dist/types/contracts/lib/ExitQueueLib.d.ts +73 -0
- package/dist/types/contracts/lib/ExitQueueLib.d.ts.map +1 -0
- package/dist/types/contracts/lib/ExitQueueLib.js +12 -0
- package/dist/types/contracts/lib/index.d.ts +2 -0
- package/dist/types/contracts/lib/index.d.ts.map +1 -0
- package/dist/types/contracts/lib/index.js +1 -0
- package/dist/types/contracts/registry/BondingRegistry.d.ts +821 -0
- package/dist/types/contracts/registry/BondingRegistry.d.ts.map +1 -0
- package/dist/types/contracts/registry/BondingRegistry.js +44 -0
- package/dist/types/contracts/registry/CiphernodeRegistryOwnable.d.ts +194 -34
- package/dist/types/contracts/registry/CiphernodeRegistryOwnable.d.ts.map +1 -1
- package/dist/types/contracts/registry/CiphernodeRegistryOwnable.js +20 -0
- package/dist/types/contracts/registry/index.d.ts +1 -1
- package/dist/types/contracts/registry/index.d.ts.map +1 -1
- package/dist/types/contracts/slashing/SlashingManager.d.ts +592 -0
- package/dist/types/contracts/slashing/SlashingManager.d.ts.map +1 -0
- package/dist/types/contracts/slashing/SlashingManager.js +36 -0
- package/dist/types/contracts/slashing/index.d.ts +2 -0
- package/dist/types/contracts/slashing/index.d.ts.map +1 -0
- package/dist/types/contracts/slashing/index.js +1 -0
- package/dist/types/contracts/test/MockCiphernodeRegistry.sol/MockCiphernodeRegistry.d.ts +247 -17
- package/dist/types/contracts/test/MockCiphernodeRegistry.sol/MockCiphernodeRegistry.d.ts.map +1 -1
- package/dist/types/contracts/test/MockCiphernodeRegistry.sol/MockCiphernodeRegistry.js +16 -0
- package/dist/types/contracts/test/MockCiphernodeRegistry.sol/MockCiphernodeRegistryEmptyKey.d.ts +247 -17
- package/dist/types/contracts/test/MockCiphernodeRegistry.sol/MockCiphernodeRegistryEmptyKey.d.ts.map +1 -1
- package/dist/types/contracts/test/MockCiphernodeRegistry.sol/MockCiphernodeRegistryEmptyKey.js +16 -0
- package/dist/types/contracts/test/MockE3Program.d.ts +20 -14
- package/dist/types/contracts/test/MockE3Program.d.ts.map +1 -1
- package/dist/types/contracts/test/{MockInputValidator.d.ts → MockSlashingVerifier.d.ts} +15 -15
- package/dist/types/contracts/test/MockSlashingVerifier.d.ts.map +1 -0
- package/dist/types/contracts/test/MockSlashingVerifier.js +1 -0
- package/dist/types/contracts/test/MockStableToken.sol/MockUSDC.d.ts +227 -0
- package/dist/types/contracts/test/MockStableToken.sol/MockUSDC.d.ts.map +1 -0
- package/dist/types/contracts/test/MockStableToken.sol/MockUSDC.js +12 -0
- package/dist/types/contracts/test/MockStableToken.sol/index.d.ts +2 -0
- package/dist/types/contracts/test/MockStableToken.sol/index.d.ts.map +1 -0
- package/dist/types/contracts/test/MockStableToken.sol/index.js +1 -0
- package/dist/types/contracts/test/index.d.ts +3 -3
- package/dist/types/contracts/test/index.d.ts.map +1 -1
- package/dist/types/contracts/token/EnclaveTicketToken.d.ts +574 -0
- package/dist/types/contracts/token/EnclaveTicketToken.d.ts.map +1 -0
- package/dist/types/contracts/token/EnclaveTicketToken.js +24 -0
- package/dist/types/contracts/token/EnclaveToken.d.ts +775 -0
- package/dist/types/contracts/token/EnclaveToken.d.ts.map +1 -0
- package/dist/types/contracts/token/EnclaveToken.js +48 -0
- package/dist/types/contracts/token/index.d.ts +3 -0
- package/dist/types/contracts/token/index.d.ts.map +1 -0
- package/dist/types/contracts/token/index.js +1 -0
- package/dist/types/factories/@openzeppelin/contracts/index.d.ts +2 -0
- package/dist/types/factories/@openzeppelin/contracts/index.d.ts.map +1 -0
- package/dist/types/factories/@openzeppelin/contracts/index.js +4 -0
- package/dist/types/factories/@openzeppelin/contracts/proxy/index.d.ts +2 -0
- package/dist/types/factories/@openzeppelin/contracts/proxy/index.d.ts.map +1 -0
- package/dist/types/factories/@openzeppelin/contracts/proxy/index.js +4 -0
- package/dist/types/factories/@openzeppelin/contracts/proxy/transparent/ProxyAdmin__factory.d.ts +118 -0
- package/dist/types/factories/@openzeppelin/contracts/proxy/transparent/ProxyAdmin__factory.d.ts.map +1 -0
- package/dist/types/factories/@openzeppelin/contracts/proxy/transparent/ProxyAdmin__factory.js +157 -0
- package/dist/types/factories/@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol/ITransparentUpgradeableProxy__factory.d.ts +57 -0
- package/dist/types/factories/@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol/ITransparentUpgradeableProxy__factory.d.ts.map +1 -0
- package/dist/types/factories/@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol/ITransparentUpgradeableProxy__factory.js +78 -0
- package/dist/types/factories/@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol/TransparentUpgradeableProxy__factory.d.ts +105 -0
- package/dist/types/factories/@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol/TransparentUpgradeableProxy__factory.d.ts.map +1 -0
- package/dist/types/factories/@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol/TransparentUpgradeableProxy__factory.js +141 -0
- package/dist/types/factories/@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol/index.d.ts +3 -0
- package/dist/types/factories/@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol/index.d.ts.map +1 -0
- package/dist/types/factories/@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol/index.js +5 -0
- package/dist/types/factories/@openzeppelin/contracts/proxy/transparent/index.d.ts +3 -0
- package/dist/types/factories/@openzeppelin/contracts/proxy/transparent/index.d.ts.map +1 -0
- package/dist/types/factories/@openzeppelin/contracts/proxy/transparent/index.js +5 -0
- package/dist/types/factories/@openzeppelin/index.d.ts +2 -0
- package/dist/types/factories/@openzeppelin/index.d.ts.map +1 -0
- package/dist/types/factories/@openzeppelin/index.js +4 -0
- package/dist/types/factories/contracts/Enclave__factory.d.ts +190 -104
- package/dist/types/factories/contracts/Enclave__factory.d.ts.map +1 -1
- package/dist/types/factories/contracts/Enclave__factory.js +241 -134
- package/dist/types/factories/contracts/index.d.ts +3 -0
- package/dist/types/factories/contracts/index.d.ts.map +1 -1
- package/dist/types/factories/contracts/index.js +3 -0
- package/dist/types/factories/contracts/interfaces/IBondingRegistry__factory.d.ts +678 -0
- package/dist/types/factories/contracts/interfaces/IBondingRegistry__factory.d.ts.map +1 -0
- package/dist/types/factories/contracts/interfaces/IBondingRegistry__factory.js +882 -0
- package/dist/types/factories/contracts/interfaces/ICiphernodeRegistry__factory.d.ts +253 -9
- package/dist/types/factories/contracts/interfaces/ICiphernodeRegistry__factory.d.ts.map +1 -1
- package/dist/types/factories/contracts/interfaces/ICiphernodeRegistry__factory.js +325 -9
- package/dist/types/factories/contracts/interfaces/IE3Program__factory.d.ts +16 -2
- package/dist/types/factories/contracts/interfaces/IE3Program__factory.d.ts.map +1 -1
- package/dist/types/factories/contracts/interfaces/IE3Program__factory.js +20 -2
- package/dist/types/factories/contracts/interfaces/IEnclave__factory.d.ts +190 -24
- package/dist/types/factories/contracts/interfaces/IEnclave__factory.d.ts.map +1 -1
- package/dist/types/factories/contracts/interfaces/IEnclave__factory.js +246 -26
- package/dist/types/factories/contracts/interfaces/ISlashVerifier__factory.d.ts +26 -0
- package/dist/types/factories/contracts/interfaces/ISlashVerifier__factory.d.ts.map +1 -0
- package/dist/types/factories/contracts/interfaces/{IRegistryFilter__factory.js → ISlashVerifier__factory.js} +7 -7
- package/dist/types/factories/contracts/interfaces/ISlashingManager__factory.d.ts +594 -0
- package/dist/types/factories/contracts/interfaces/ISlashingManager__factory.d.ts.map +1 -0
- package/dist/types/factories/contracts/interfaces/ISlashingManager__factory.js +760 -0
- package/dist/types/factories/contracts/interfaces/index.d.ts +3 -2
- package/dist/types/factories/contracts/interfaces/index.d.ts.map +1 -1
- package/dist/types/factories/contracts/interfaces/index.js +3 -2
- package/dist/types/factories/contracts/lib/ExitQueueLib__factory.d.ts +107 -0
- package/dist/types/factories/contracts/lib/ExitQueueLib__factory.d.ts.map +1 -0
- package/dist/types/factories/contracts/lib/ExitQueueLib__factory.js +138 -0
- package/dist/types/factories/contracts/lib/index.d.ts +2 -0
- package/dist/types/factories/contracts/lib/index.d.ts.map +1 -0
- package/dist/types/factories/contracts/lib/index.js +4 -0
- package/dist/types/factories/contracts/registry/BondingRegistry__factory.d.ts +958 -0
- package/dist/types/factories/contracts/registry/BondingRegistry__factory.d.ts.map +1 -0
- package/dist/types/factories/contracts/registry/BondingRegistry__factory.js +1239 -0
- package/dist/types/factories/contracts/registry/CiphernodeRegistryOwnable__factory.d.ts +272 -40
- package/dist/types/factories/contracts/registry/CiphernodeRegistryOwnable__factory.d.ts.map +1 -1
- package/dist/types/factories/contracts/registry/CiphernodeRegistryOwnable__factory.js +343 -49
- package/dist/types/factories/contracts/registry/index.d.ts +1 -1
- package/dist/types/factories/contracts/registry/index.d.ts.map +1 -1
- package/dist/types/factories/contracts/registry/index.js +1 -1
- package/dist/types/factories/contracts/slashing/SlashingManager__factory.d.ts +879 -0
- package/dist/types/factories/contracts/slashing/SlashingManager__factory.d.ts.map +1 -0
- package/dist/types/factories/contracts/slashing/SlashingManager__factory.js +1129 -0
- package/dist/types/factories/contracts/slashing/index.d.ts +2 -0
- package/dist/types/factories/contracts/slashing/index.d.ts.map +1 -0
- package/dist/types/factories/contracts/slashing/index.js +4 -0
- package/dist/types/factories/contracts/test/MockCiphernodeRegistry.sol/MockCiphernodeRegistryEmptyKey__factory.d.ts +254 -10
- 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 +326 -10
- package/dist/types/factories/contracts/test/MockCiphernodeRegistry.sol/MockCiphernodeRegistry__factory.d.ts +254 -10
- 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 +326 -10
- package/dist/types/factories/contracts/test/MockComputeProvider__factory.d.ts +2 -2
- package/dist/types/factories/contracts/test/MockComputeProvider__factory.d.ts.map +1 -1
- package/dist/types/factories/contracts/test/MockComputeProvider__factory.js +2 -2
- package/dist/types/factories/contracts/test/MockDecryptionVerifier__factory.d.ts +1 -1
- package/dist/types/factories/contracts/test/MockDecryptionVerifier__factory.d.ts.map +1 -1
- package/dist/types/factories/contracts/test/MockDecryptionVerifier__factory.js +1 -1
- package/dist/types/factories/contracts/test/MockE3Program__factory.d.ts +23 -27
- package/dist/types/factories/contracts/test/MockE3Program__factory.d.ts.map +1 -1
- package/dist/types/factories/contracts/test/MockE3Program__factory.js +28 -34
- package/dist/types/factories/contracts/test/MockSlashingVerifier__factory.d.ts +43 -0
- package/dist/types/factories/contracts/test/MockSlashingVerifier__factory.d.ts.map +1 -0
- package/dist/types/factories/contracts/test/MockSlashingVerifier__factory.js +60 -0
- package/dist/types/factories/contracts/test/MockStableToken.sol/MockUSDC__factory.d.ts +338 -0
- package/dist/types/factories/contracts/test/MockStableToken.sol/MockUSDC__factory.d.ts.map +1 -0
- package/dist/types/factories/contracts/test/MockStableToken.sol/MockUSDC__factory.js +447 -0
- package/dist/types/factories/contracts/test/MockStableToken.sol/index.d.ts +2 -0
- package/dist/types/factories/contracts/test/MockStableToken.sol/index.d.ts.map +1 -0
- package/dist/types/factories/contracts/test/MockStableToken.sol/index.js +4 -0
- package/dist/types/factories/contracts/test/index.d.ts +2 -2
- package/dist/types/factories/contracts/test/index.d.ts.map +1 -1
- package/dist/types/factories/contracts/test/index.js +2 -2
- package/dist/types/factories/contracts/token/EnclaveTicketToken__factory.d.ts +894 -0
- package/dist/types/factories/contracts/token/EnclaveTicketToken__factory.d.ts.map +1 -0
- package/dist/types/factories/contracts/token/EnclaveTicketToken__factory.js +1175 -0
- package/dist/types/factories/contracts/token/EnclaveToken__factory.d.ts +1101 -0
- package/dist/types/factories/contracts/token/EnclaveToken__factory.d.ts.map +1 -0
- package/dist/types/factories/contracts/token/EnclaveToken__factory.js +1439 -0
- package/dist/types/factories/contracts/token/index.d.ts +3 -0
- package/dist/types/factories/contracts/token/index.d.ts.map +1 -0
- package/dist/types/factories/contracts/token/index.js +5 -0
- package/dist/types/factories/index.d.ts +1 -0
- package/dist/types/factories/index.d.ts.map +1 -1
- package/dist/types/factories/index.js +1 -0
- package/dist/types/factories/poseidon-solidity/PoseidonT3__factory.d.ts +1 -1
- package/dist/types/factories/poseidon-solidity/PoseidonT3__factory.d.ts.map +1 -1
- package/dist/types/factories/poseidon-solidity/PoseidonT3__factory.js +1 -1
- package/dist/types/index.d.ts +28 -12
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +13 -6
- package/package.json +30 -21
- package/LICENSE.md +0 -165
- package/artifacts/build-info/solc-0_8_27-9aea5e3f6e25811e781e96c22e8edaf1eb1a01c5.json +0 -130
- package/artifacts/build-info/solc-0_8_27-9aea5e3f6e25811e781e96c22e8edaf1eb1a01c5.output.json +0 -1
- package/artifacts/contracts/interfaces/IInputValidator.sol/IInputValidator.json +0 -38
- package/artifacts/contracts/interfaces/IInputValidator.sol/artifacts.d.ts +0 -27
- package/artifacts/contracts/interfaces/IRegistryFilter.sol/artifacts.d.ts +0 -27
- package/artifacts/contracts/registry/NaiveRegistryFilter.sol/NaiveRegistryFilter.json +0 -309
- package/artifacts/contracts/registry/NaiveRegistryFilter.sol/artifacts.d.ts +0 -27
- package/artifacts/contracts/test/MockInputValidator.sol/MockInputValidator.json +0 -43
- package/artifacts/contracts/test/MockInputValidator.sol/artifacts.d.ts +0 -27
- package/artifacts/contracts/test/MockRegistryFilter.sol/IRegistry.json +0 -37
- package/artifacts/contracts/test/MockRegistryFilter.sol/MockNaiveRegistryFilter.json +0 -262
- package/artifacts/contracts/test/MockRegistryFilter.sol/artifacts.d.ts +0 -43
- package/contracts/interfaces/IInputValidator.sol +0 -18
- package/contracts/interfaces/IRegistryFilter.sol +0 -13
- package/contracts/registry/NaiveRegistryFilter.sol +0 -124
- package/contracts/test/MockInputValidator.sol +0 -29
- package/contracts/test/MockRegistryFilter.sol +0 -117
- package/dist/ignition/modules/mockInputValidator.d.ts.map +0 -1
- package/dist/ignition/modules/naiveRegistryFilter.d.ts.map +0 -1
- package/dist/ignition/modules/naiveRegistryFilter.js +0 -16
- package/dist/scripts/deployAndSave/mockInputValidator.d.ts +0 -6
- package/dist/scripts/deployAndSave/mockInputValidator.d.ts.map +0 -1
- package/dist/scripts/deployAndSave/mockInputValidator.js +0 -18
- package/dist/scripts/deployAndSave/naiveRegistryFilter.d.ts +0 -11
- package/dist/scripts/deployAndSave/naiveRegistryFilter.d.ts.map +0 -1
- package/dist/scripts/deployAndSave/naiveRegistryFilter.js +0 -41
- package/dist/test/CiphernodeRegistry/CiphernodeRegistryOwnable.spec.d.ts.map +0 -1
- package/dist/test/CiphernodeRegistry/CiphernodeRegistryOwnable.spec.js +0 -279
- package/dist/test/CiphernodeRegistry/NaiveRegistryFilter.spec.d.ts +0 -2
- package/dist/test/CiphernodeRegistry/NaiveRegistryFilter.spec.d.ts.map +0 -1
- package/dist/test/CiphernodeRegistry/NaiveRegistryFilter.spec.js +0 -160
- package/dist/types/contracts/interfaces/IInputValidator.d.ts +0 -36
- package/dist/types/contracts/interfaces/IInputValidator.d.ts.map +0 -1
- package/dist/types/contracts/interfaces/IRegistryFilter.d.ts.map +0 -1
- package/dist/types/contracts/registry/NaiveRegistryFilter.d.ts +0 -187
- package/dist/types/contracts/registry/NaiveRegistryFilter.d.ts.map +0 -1
- package/dist/types/contracts/test/MockInputValidator.d.ts.map +0 -1
- package/dist/types/contracts/test/MockRegistryFilter.sol/IRegistry.d.ts +0 -38
- package/dist/types/contracts/test/MockRegistryFilter.sol/IRegistry.d.ts.map +0 -1
- package/dist/types/contracts/test/MockRegistryFilter.sol/MockNaiveRegistryFilter.d.ts +0 -163
- package/dist/types/contracts/test/MockRegistryFilter.sol/MockNaiveRegistryFilter.d.ts.map +0 -1
- package/dist/types/contracts/test/MockRegistryFilter.sol/MockNaiveRegistryFilter.js +0 -8
- package/dist/types/contracts/test/MockRegistryFilter.sol/index.d.ts +0 -3
- package/dist/types/contracts/test/MockRegistryFilter.sol/index.d.ts.map +0 -1
- package/dist/types/factories/contracts/interfaces/IInputValidator__factory.d.ts +0 -26
- package/dist/types/factories/contracts/interfaces/IInputValidator__factory.d.ts.map +0 -1
- package/dist/types/factories/contracts/interfaces/IInputValidator__factory.js +0 -39
- package/dist/types/factories/contracts/interfaces/IRegistryFilter__factory.d.ts +0 -26
- package/dist/types/factories/contracts/interfaces/IRegistryFilter__factory.d.ts.map +0 -1
- package/dist/types/factories/contracts/registry/NaiveRegistryFilter__factory.d.ts +0 -251
- package/dist/types/factories/contracts/registry/NaiveRegistryFilter__factory.d.ts.map +0 -1
- package/dist/types/factories/contracts/registry/NaiveRegistryFilter__factory.js +0 -331
- package/dist/types/factories/contracts/test/MockInputValidator__factory.d.ts +0 -47
- package/dist/types/factories/contracts/test/MockInputValidator__factory.d.ts.map +0 -1
- package/dist/types/factories/contracts/test/MockInputValidator__factory.js +0 -65
- package/dist/types/factories/contracts/test/MockRegistryFilter.sol/IRegistry__factory.d.ts +0 -26
- package/dist/types/factories/contracts/test/MockRegistryFilter.sol/IRegistry__factory.d.ts.map +0 -1
- package/dist/types/factories/contracts/test/MockRegistryFilter.sol/IRegistry__factory.js +0 -38
- package/dist/types/factories/contracts/test/MockRegistryFilter.sol/MockNaiveRegistryFilter__factory.d.ts +0 -216
- package/dist/types/factories/contracts/test/MockRegistryFilter.sol/MockNaiveRegistryFilter__factory.d.ts.map +0 -1
- package/dist/types/factories/contracts/test/MockRegistryFilter.sol/MockNaiveRegistryFilter__factory.js +0 -284
- package/dist/types/factories/contracts/test/MockRegistryFilter.sol/index.d.ts +0 -3
- package/dist/types/factories/contracts/test/MockRegistryFilter.sol/index.d.ts.map +0 -1
- package/dist/types/factories/contracts/test/MockRegistryFilter.sol/index.js +0 -5
- /package/dist/test/{CiphernodeRegistry → Registry}/CiphernodeRegistryOwnable.spec.d.ts +0 -0
- /package/dist/types/{contracts/test/MockRegistryFilter.sol → @openzeppelin/contracts}/index.js +0 -0
- /package/dist/types/{contracts/interfaces/IInputValidator.js → @openzeppelin/contracts/proxy/index.js} +0 -0
- /package/dist/types/{contracts/interfaces/IRegistryFilter.js → @openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol/index.js} +0 -0
- /package/dist/types/{contracts/test/MockInputValidator.js → @openzeppelin/contracts/proxy/transparent/index.js} +0 -0
- /package/dist/types/{contracts/test/MockRegistryFilter.sol/IRegistry.js → @openzeppelin/index.js} +0 -0
package/contracts/Enclave.sol
CHANGED
|
@@ -6,20 +6,24 @@
|
|
|
6
6
|
pragma solidity >=0.8.27;
|
|
7
7
|
|
|
8
8
|
import { IEnclave, E3, IE3Program } from "./interfaces/IEnclave.sol";
|
|
9
|
-
import { IInputValidator } from "./interfaces/IInputValidator.sol";
|
|
10
9
|
import { ICiphernodeRegistry } from "./interfaces/ICiphernodeRegistry.sol";
|
|
10
|
+
import { IBondingRegistry } from "./interfaces/IBondingRegistry.sol";
|
|
11
11
|
import { IDecryptionVerifier } from "./interfaces/IDecryptionVerifier.sol";
|
|
12
12
|
import {
|
|
13
13
|
OwnableUpgradeable
|
|
14
14
|
} from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
|
|
15
15
|
import {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
16
|
+
SafeERC20
|
|
17
|
+
} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
|
|
18
|
+
import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* @title Enclave
|
|
22
|
+
* @notice Main contract for managing Encrypted Execution Environments (E3)
|
|
23
|
+
* @dev Coordinates E3 lifecycle including request, activation, input publishing, and output verification
|
|
24
|
+
*/
|
|
21
25
|
contract Enclave is IEnclave, OwnableUpgradeable {
|
|
22
|
-
using
|
|
26
|
+
using SafeERC20 for IERC20;
|
|
23
27
|
|
|
24
28
|
////////////////////////////////////////////////////////////
|
|
25
29
|
// //
|
|
@@ -27,95 +31,180 @@ contract Enclave is IEnclave, OwnableUpgradeable {
|
|
|
27
31
|
// //
|
|
28
32
|
////////////////////////////////////////////////////////////
|
|
29
33
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
34
|
+
/// @notice Address of the Ciphernode Registry contract.
|
|
35
|
+
/// @dev Manages the pool of ciphernodes and committee selection.
|
|
36
|
+
ICiphernodeRegistry public ciphernodeRegistry;
|
|
33
37
|
|
|
34
|
-
|
|
35
|
-
|
|
38
|
+
/// @notice Address of the Bonding Registry contract.
|
|
39
|
+
/// @dev Handles staking and reward distribution for ciphernodes.
|
|
40
|
+
IBondingRegistry public bondingRegistry;
|
|
36
41
|
|
|
37
|
-
|
|
38
|
-
|
|
42
|
+
/// @notice Address of the ERC20 token used for E3 fees.
|
|
43
|
+
/// @dev All E3 request fees must be paid in this token.
|
|
44
|
+
IERC20 public feeToken;
|
|
45
|
+
|
|
46
|
+
/// @notice Maximum allowed duration for an E3 computation in seconds.
|
|
47
|
+
/// @dev Requests with duration exceeding this value will be rejected.
|
|
48
|
+
uint256 public maxDuration;
|
|
49
|
+
|
|
50
|
+
/// @notice ID counter for the next E3 to be created.
|
|
51
|
+
/// @dev Incremented after each successful E3 request.
|
|
52
|
+
uint256 public nexte3Id;
|
|
39
53
|
|
|
40
|
-
|
|
41
|
-
|
|
54
|
+
/// @notice Mapping of allowed E3 Programs.
|
|
55
|
+
/// @dev Only enabled E3 Programs can be used in computation requests.
|
|
56
|
+
mapping(IE3Program e3Program => bool allowed) public e3Programs;
|
|
42
57
|
|
|
43
|
-
|
|
44
|
-
|
|
58
|
+
/// @notice Mapping storing all E3 instances by their ID.
|
|
59
|
+
/// @dev Contains the full state and configuration of each E3.
|
|
60
|
+
mapping(uint256 e3Id => E3 e3) public e3s;
|
|
45
61
|
|
|
46
|
-
|
|
62
|
+
/// @notice Mapping of enabled encryption schemes to their decryption verifiers.
|
|
63
|
+
/// @dev Each encryption scheme ID maps to a contract that can verify decrypted outputs.
|
|
47
64
|
mapping(bytes32 encryptionSchemeId => IDecryptionVerifier decryptionVerifier)
|
|
48
65
|
public decryptionVerifiers;
|
|
49
66
|
|
|
50
|
-
/// Mapping
|
|
67
|
+
/// @notice Mapping storing valid E3 program ABI encoded parameter sets.
|
|
68
|
+
/// @dev Stores allowed encryption scheme parameters (e.g., BFV parameters).
|
|
51
69
|
mapping(bytes e3ProgramParams => bool allowed) public e3ProgramsParams;
|
|
52
70
|
|
|
71
|
+
/// @notice Mapping tracking fee payments for each E3.
|
|
72
|
+
/// @dev Stores the amount paid for an E3, distributed to committee upon completion.
|
|
73
|
+
mapping(uint256 e3Id => uint256 e3Payment) public e3Payments;
|
|
74
|
+
|
|
53
75
|
////////////////////////////////////////////////////////////
|
|
54
76
|
// //
|
|
55
77
|
// Errors //
|
|
56
78
|
// //
|
|
57
79
|
////////////////////////////////////////////////////////////
|
|
58
80
|
|
|
81
|
+
/// @notice Thrown when committee selection fails during E3 request or activation.
|
|
59
82
|
error CommitteeSelectionFailed();
|
|
83
|
+
|
|
84
|
+
/// @notice Thrown when an E3 request uses a program that is not enabled.
|
|
85
|
+
/// @param e3Program The E3 program address that is not allowed.
|
|
60
86
|
error E3ProgramNotAllowed(IE3Program e3Program);
|
|
87
|
+
|
|
88
|
+
/// @notice Thrown when attempting to activate an E3 that is already activated.
|
|
89
|
+
/// @param e3Id The ID of the E3 that is already activated.
|
|
61
90
|
error E3AlreadyActivated(uint256 e3Id);
|
|
91
|
+
|
|
92
|
+
/// @notice Thrown when the E3 start window or computation period has expired.
|
|
62
93
|
error E3Expired();
|
|
94
|
+
|
|
95
|
+
/// @notice Thrown when attempting operations on an E3 that has not been activated yet.
|
|
96
|
+
/// @param e3Id The ID of the E3 that is not activated.
|
|
63
97
|
error E3NotActivated(uint256 e3Id);
|
|
98
|
+
|
|
99
|
+
/// @notice Thrown when attempting to activate an E3 before its start window begins.
|
|
64
100
|
error E3NotReady();
|
|
101
|
+
|
|
102
|
+
/// @notice Thrown when attempting to access an E3 that does not exist.
|
|
103
|
+
/// @param e3Id The ID of the non-existent E3.
|
|
65
104
|
error E3DoesNotExist(uint256 e3Id);
|
|
105
|
+
|
|
106
|
+
/// @notice Thrown when attempting to enable a module or program that is already enabled.
|
|
107
|
+
/// @param module The address of the module that is already enabled.
|
|
66
108
|
error ModuleAlreadyEnabled(address module);
|
|
109
|
+
|
|
110
|
+
/// @notice Thrown when attempting to disable a module or program that is not enabled.
|
|
111
|
+
/// @param module The address of the module that is not enabled.
|
|
67
112
|
error ModuleNotEnabled(address module);
|
|
113
|
+
|
|
114
|
+
/// @notice Thrown when an invalid or disabled encryption scheme is used.
|
|
115
|
+
/// @param encryptionSchemeId The ID of the invalid encryption scheme.
|
|
68
116
|
error InvalidEncryptionScheme(bytes32 encryptionSchemeId);
|
|
117
|
+
|
|
118
|
+
/// @notice Thrown when attempting to publish input after the computation deadline has passed.
|
|
119
|
+
/// @param e3Id The ID of the E3.
|
|
120
|
+
/// @param expiration The expiration timestamp that has passed.
|
|
69
121
|
error InputDeadlinePassed(uint256 e3Id, uint256 expiration);
|
|
122
|
+
|
|
123
|
+
/// @notice Thrown when attempting to publish output before the input deadline has passed.
|
|
124
|
+
/// @param e3Id The ID of the E3.
|
|
125
|
+
/// @param expiration The expiration timestamp that has not yet passed.
|
|
70
126
|
error InputDeadlineNotPassed(uint256 e3Id, uint256 expiration);
|
|
71
|
-
|
|
127
|
+
|
|
128
|
+
/// @notice Thrown when attempting to set an invalid ciphernode registry address.
|
|
129
|
+
/// @param ciphernodeRegistry The invalid ciphernode registry address.
|
|
72
130
|
error InvalidCiphernodeRegistry(ICiphernodeRegistry ciphernodeRegistry);
|
|
131
|
+
|
|
132
|
+
/// @notice Thrown when the requested duration exceeds maxDuration or is zero.
|
|
133
|
+
/// @param duration The invalid duration value.
|
|
73
134
|
error InvalidDuration(uint256 duration);
|
|
135
|
+
|
|
136
|
+
/// @notice Thrown when output verification fails.
|
|
137
|
+
/// @param output The invalid output data.
|
|
74
138
|
error InvalidOutput(bytes output);
|
|
139
|
+
|
|
140
|
+
/// @notice Thrown when input data is invalid.
|
|
75
141
|
error InvalidInput();
|
|
142
|
+
|
|
143
|
+
/// @notice Thrown when the start window parameters are invalid.
|
|
76
144
|
error InvalidStartWindow();
|
|
145
|
+
|
|
146
|
+
/// @notice Thrown when the threshold parameters are invalid (e.g., M > N or M = 0).
|
|
147
|
+
/// @param threshold The invalid threshold array [M, N].
|
|
77
148
|
error InvalidThreshold(uint32[2] threshold);
|
|
149
|
+
|
|
150
|
+
/// @notice Thrown when attempting to publish ciphertext output that has already been published.
|
|
151
|
+
/// @param e3Id The ID of the E3.
|
|
78
152
|
error CiphertextOutputAlreadyPublished(uint256 e3Id);
|
|
153
|
+
|
|
154
|
+
/// @notice Thrown when attempting to publish plaintext output before ciphertext output.
|
|
155
|
+
/// @param e3Id The ID of the E3.
|
|
79
156
|
error CiphertextOutputNotPublished(uint256 e3Id);
|
|
157
|
+
|
|
158
|
+
/// @notice Thrown when payment is required but not provided or insufficient.
|
|
159
|
+
/// @param value The required payment amount.
|
|
80
160
|
error PaymentRequired(uint256 value);
|
|
161
|
+
|
|
162
|
+
/// @notice Thrown when attempting to publish plaintext output that has already been published.
|
|
163
|
+
/// @param e3Id The ID of the E3.
|
|
81
164
|
error PlaintextOutputAlreadyPublished(uint256 e3Id);
|
|
82
165
|
|
|
166
|
+
/// @notice Thrown when attempting to set an invalid bonding registry address.
|
|
167
|
+
/// @param bondingRegistry The invalid bonding registry address.
|
|
168
|
+
error InvalidBondingRegistry(IBondingRegistry bondingRegistry);
|
|
169
|
+
|
|
170
|
+
/// @notice Thrown when attempting to set an invalid fee token address.
|
|
171
|
+
/// @param feeToken The invalid fee token address.
|
|
172
|
+
error InvalidFeeToken(IERC20 feeToken);
|
|
173
|
+
|
|
83
174
|
////////////////////////////////////////////////////////////
|
|
84
175
|
// //
|
|
85
176
|
// Initialization //
|
|
86
177
|
// //
|
|
87
178
|
////////////////////////////////////////////////////////////
|
|
88
179
|
|
|
89
|
-
/// @
|
|
90
|
-
/// @
|
|
91
|
-
///
|
|
92
|
-
constructor(
|
|
93
|
-
|
|
94
|
-
ICiphernodeRegistry _ciphernodeRegistry,
|
|
95
|
-
uint256 _maxDuration,
|
|
96
|
-
bytes[] memory _e3ProgramsParams
|
|
97
|
-
) {
|
|
98
|
-
initialize(
|
|
99
|
-
_owner,
|
|
100
|
-
_ciphernodeRegistry,
|
|
101
|
-
_maxDuration,
|
|
102
|
-
_e3ProgramsParams
|
|
103
|
-
);
|
|
180
|
+
/// @notice Constructor that disables initializers.
|
|
181
|
+
/// @dev Prevents the implementation contract from being initialized. Initialization is performed
|
|
182
|
+
/// via the initialize() function when deployed behind a proxy.
|
|
183
|
+
constructor() {
|
|
184
|
+
_disableInitializers();
|
|
104
185
|
}
|
|
105
186
|
|
|
106
|
-
/// @
|
|
107
|
-
/// @
|
|
108
|
-
/// @param
|
|
109
|
-
/// @param
|
|
187
|
+
/// @notice Initializes the Enclave contract with initial configuration.
|
|
188
|
+
/// @dev This function can only be called once due to the initializer modifier. Sets up core dependencies.
|
|
189
|
+
/// @param _owner The owner address of this contract.
|
|
190
|
+
/// @param _ciphernodeRegistry The address of the Ciphernode Registry contract.
|
|
191
|
+
/// @param _bondingRegistry The address of the Bonding Registry contract.
|
|
192
|
+
/// @param _feeToken The address of the ERC20 token used for E3 fees.
|
|
193
|
+
/// @param _maxDuration The maximum duration of a computation in seconds.
|
|
194
|
+
/// @param _e3ProgramsParams Array of ABI encoded E3 encryption scheme parameters sets (e.g., for BFV).
|
|
110
195
|
function initialize(
|
|
111
196
|
address _owner,
|
|
112
197
|
ICiphernodeRegistry _ciphernodeRegistry,
|
|
198
|
+
IBondingRegistry _bondingRegistry,
|
|
199
|
+
IERC20 _feeToken,
|
|
113
200
|
uint256 _maxDuration,
|
|
114
201
|
bytes[] memory _e3ProgramsParams
|
|
115
202
|
) public initializer {
|
|
116
203
|
__Ownable_init(msg.sender);
|
|
117
204
|
setMaxDuration(_maxDuration);
|
|
118
205
|
setCiphernodeRegistry(_ciphernodeRegistry);
|
|
206
|
+
setBondingRegistry(_bondingRegistry);
|
|
207
|
+
setFeeToken(_feeToken);
|
|
119
208
|
setE3ProgramsParams(_e3ProgramsParams);
|
|
120
209
|
if (_owner != owner()) transferOwnership(_owner);
|
|
121
210
|
}
|
|
@@ -126,12 +215,11 @@ contract Enclave is IEnclave, OwnableUpgradeable {
|
|
|
126
215
|
// //
|
|
127
216
|
////////////////////////////////////////////////////////////
|
|
128
217
|
|
|
218
|
+
/// @inheritdoc IEnclave
|
|
129
219
|
function request(
|
|
130
220
|
E3RequestParams calldata requestParams
|
|
131
|
-
) external
|
|
132
|
-
|
|
133
|
-
// TODO: should payment checks be somewhere else? Perhaps in the E3 Program or ciphernode registry?
|
|
134
|
-
require(msg.value > 0, PaymentRequired(msg.value));
|
|
221
|
+
) external returns (uint256 e3Id, E3 memory e3) {
|
|
222
|
+
uint256 e3Fee = getE3Quote(requestParams);
|
|
135
223
|
require(
|
|
136
224
|
requestParams.threshold[1] >= requestParams.threshold[0] &&
|
|
137
225
|
requestParams.threshold[0] > 0,
|
|
@@ -165,19 +253,17 @@ contract Enclave is IEnclave, OwnableUpgradeable {
|
|
|
165
253
|
e3.expiration = 0;
|
|
166
254
|
e3.e3Program = requestParams.e3Program;
|
|
167
255
|
e3.e3ProgramParams = requestParams.e3ProgramParams;
|
|
256
|
+
e3.customParams = requestParams.customParams;
|
|
168
257
|
e3.committeePublicKey = hex"";
|
|
169
258
|
e3.ciphertextOutput = hex"";
|
|
170
259
|
e3.plaintextOutput = hex"";
|
|
171
260
|
|
|
172
|
-
(
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
requestParams.e3ProgramParams,
|
|
179
|
-
requestParams.computeProviderParams
|
|
180
|
-
);
|
|
261
|
+
bytes32 encryptionSchemeId = requestParams.e3Program.validate(
|
|
262
|
+
e3Id,
|
|
263
|
+
seed,
|
|
264
|
+
requestParams.e3ProgramParams,
|
|
265
|
+
requestParams.computeProviderParams
|
|
266
|
+
);
|
|
181
267
|
IDecryptionVerifier decryptionVerifier = decryptionVerifiers[
|
|
182
268
|
encryptionSchemeId
|
|
183
269
|
];
|
|
@@ -187,34 +273,28 @@ contract Enclave is IEnclave, OwnableUpgradeable {
|
|
|
187
273
|
IDecryptionVerifier(address(0)),
|
|
188
274
|
InvalidEncryptionScheme(encryptionSchemeId)
|
|
189
275
|
);
|
|
190
|
-
require(
|
|
191
|
-
address(inputValidator) != address(0),
|
|
192
|
-
InvalidComputationRequest(inputValidator)
|
|
193
|
-
);
|
|
194
276
|
|
|
195
277
|
e3.encryptionSchemeId = encryptionSchemeId;
|
|
196
|
-
e3.inputValidator = inputValidator;
|
|
197
278
|
e3.decryptionVerifier = decryptionVerifier;
|
|
198
279
|
|
|
199
280
|
e3s[e3Id] = e3;
|
|
281
|
+
e3Payments[e3Id] = e3Fee;
|
|
282
|
+
|
|
283
|
+
feeToken.safeTransferFrom(msg.sender, address(this), e3Fee);
|
|
200
284
|
|
|
201
285
|
require(
|
|
202
286
|
ciphernodeRegistry.requestCommittee(
|
|
203
287
|
e3Id,
|
|
204
|
-
|
|
288
|
+
seed,
|
|
205
289
|
requestParams.threshold
|
|
206
290
|
),
|
|
207
291
|
CommitteeSelectionFailed()
|
|
208
292
|
);
|
|
209
293
|
|
|
210
|
-
emit E3Requested(
|
|
211
|
-
e3Id,
|
|
212
|
-
e3,
|
|
213
|
-
requestParams.filter,
|
|
214
|
-
requestParams.e3Program
|
|
215
|
-
);
|
|
294
|
+
emit E3Requested(e3Id, e3, requestParams.e3Program);
|
|
216
295
|
}
|
|
217
296
|
|
|
297
|
+
/// @inheritdoc IEnclave
|
|
218
298
|
function activate(
|
|
219
299
|
uint256 e3Id,
|
|
220
300
|
bytes calldata publicKey
|
|
@@ -240,6 +320,7 @@ contract Enclave is IEnclave, OwnableUpgradeable {
|
|
|
240
320
|
return true;
|
|
241
321
|
}
|
|
242
322
|
|
|
323
|
+
/// @inheritdoc IEnclave
|
|
243
324
|
function publishInput(
|
|
244
325
|
uint256 e3Id,
|
|
245
326
|
bytes calldata data
|
|
@@ -254,20 +335,12 @@ contract Enclave is IEnclave, OwnableUpgradeable {
|
|
|
254
335
|
InputDeadlinePassed(e3Id, e3.expiration)
|
|
255
336
|
);
|
|
256
337
|
|
|
257
|
-
|
|
258
|
-
inputCounts[e3Id] = inputIndex + 1;
|
|
259
|
-
|
|
260
|
-
bytes memory input = e3.inputValidator.validate(msg.sender, data);
|
|
338
|
+
e3.e3Program.validateInput(e3Id, msg.sender, data);
|
|
261
339
|
|
|
262
|
-
uint256 inputHash = PoseidonT3.hash(
|
|
263
|
-
[uint256(keccak256(input)), inputIndex]
|
|
264
|
-
);
|
|
265
|
-
inputs[e3Id]._insert(inputHash);
|
|
266
340
|
success = true;
|
|
267
|
-
|
|
268
|
-
emit InputPublished(e3Id, input, inputHash, inputIndex);
|
|
269
341
|
}
|
|
270
342
|
|
|
343
|
+
/// @inheritdoc IEnclave
|
|
271
344
|
function publishCiphertextOutput(
|
|
272
345
|
uint256 e3Id,
|
|
273
346
|
bytes calldata ciphertextOutput,
|
|
@@ -297,6 +370,7 @@ contract Enclave is IEnclave, OwnableUpgradeable {
|
|
|
297
370
|
emit CiphertextOutputPublished(e3Id, ciphertextOutput);
|
|
298
371
|
}
|
|
299
372
|
|
|
373
|
+
/// @inheritdoc IEnclave
|
|
300
374
|
function publishPlaintextOutput(
|
|
301
375
|
uint256 e3Id,
|
|
302
376
|
bytes calldata plaintextOutput,
|
|
@@ -324,15 +398,55 @@ contract Enclave is IEnclave, OwnableUpgradeable {
|
|
|
324
398
|
);
|
|
325
399
|
require(success, InvalidOutput(plaintextOutput));
|
|
326
400
|
|
|
401
|
+
_distributeRewards(e3Id);
|
|
402
|
+
|
|
327
403
|
emit PlaintextOutputPublished(e3Id, plaintextOutput);
|
|
328
404
|
}
|
|
329
405
|
|
|
406
|
+
////////////////////////////////////////////////////////////
|
|
407
|
+
// //
|
|
408
|
+
// Internal Functions //
|
|
409
|
+
// //
|
|
410
|
+
////////////////////////////////////////////////////////////
|
|
411
|
+
|
|
412
|
+
/// @notice Distributes rewards to committee members after successful E3 completion.
|
|
413
|
+
/// @dev Divides the E3 payment equally among all committee members and transfers via bonding registry.
|
|
414
|
+
/// @dev Emits RewardsDistributed event upon successful distribution.
|
|
415
|
+
/// @param e3Id The ID of the E3 for which to distribute rewards.
|
|
416
|
+
function _distributeRewards(uint256 e3Id) internal {
|
|
417
|
+
address[] memory committeeNodes = ciphernodeRegistry.getCommitteeNodes(
|
|
418
|
+
e3Id
|
|
419
|
+
);
|
|
420
|
+
uint256 committeeLength = committeeNodes.length;
|
|
421
|
+
uint256[] memory amounts = new uint256[](committeeLength);
|
|
422
|
+
|
|
423
|
+
// TODO: do we need to pay different amounts to different nodes?
|
|
424
|
+
// For now, we'll pay the same amount to all nodes.
|
|
425
|
+
uint256 amount = e3Payments[e3Id] / committeeLength;
|
|
426
|
+
for (uint256 i = 0; i < committeeLength; i++) {
|
|
427
|
+
amounts[i] = amount;
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
uint256 totalAmount = e3Payments[e3Id];
|
|
431
|
+
e3Payments[e3Id] = 0;
|
|
432
|
+
|
|
433
|
+
feeToken.approve(address(bondingRegistry), totalAmount);
|
|
434
|
+
|
|
435
|
+
bondingRegistry.distributeRewards(feeToken, committeeNodes, amounts);
|
|
436
|
+
|
|
437
|
+
// TODO: decide where does dust go? Treasury maybe?
|
|
438
|
+
feeToken.approve(address(bondingRegistry), 0);
|
|
439
|
+
|
|
440
|
+
emit RewardsDistributed(e3Id, committeeNodes, amounts);
|
|
441
|
+
}
|
|
442
|
+
|
|
330
443
|
////////////////////////////////////////////////////////////
|
|
331
444
|
// //
|
|
332
445
|
// Set Functions //
|
|
333
446
|
// //
|
|
334
447
|
////////////////////////////////////////////////////////////
|
|
335
448
|
|
|
449
|
+
/// @inheritdoc IEnclave
|
|
336
450
|
function setMaxDuration(
|
|
337
451
|
uint256 _maxDuration
|
|
338
452
|
) public onlyOwner returns (bool success) {
|
|
@@ -341,6 +455,7 @@ contract Enclave is IEnclave, OwnableUpgradeable {
|
|
|
341
455
|
emit MaxDurationSet(_maxDuration);
|
|
342
456
|
}
|
|
343
457
|
|
|
458
|
+
/// @inheritdoc IEnclave
|
|
344
459
|
function setCiphernodeRegistry(
|
|
345
460
|
ICiphernodeRegistry _ciphernodeRegistry
|
|
346
461
|
) public onlyOwner returns (bool success) {
|
|
@@ -354,6 +469,34 @@ contract Enclave is IEnclave, OwnableUpgradeable {
|
|
|
354
469
|
emit CiphernodeRegistrySet(address(_ciphernodeRegistry));
|
|
355
470
|
}
|
|
356
471
|
|
|
472
|
+
/// @inheritdoc IEnclave
|
|
473
|
+
function setBondingRegistry(
|
|
474
|
+
IBondingRegistry _bondingRegistry
|
|
475
|
+
) public onlyOwner returns (bool success) {
|
|
476
|
+
require(
|
|
477
|
+
address(_bondingRegistry) != address(0) &&
|
|
478
|
+
_bondingRegistry != bondingRegistry,
|
|
479
|
+
InvalidBondingRegistry(_bondingRegistry)
|
|
480
|
+
);
|
|
481
|
+
bondingRegistry = _bondingRegistry;
|
|
482
|
+
success = true;
|
|
483
|
+
emit BondingRegistrySet(address(_bondingRegistry));
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
/// @inheritdoc IEnclave
|
|
487
|
+
function setFeeToken(
|
|
488
|
+
IERC20 _feeToken
|
|
489
|
+
) public onlyOwner returns (bool success) {
|
|
490
|
+
require(
|
|
491
|
+
address(_feeToken) != address(0) && _feeToken != feeToken,
|
|
492
|
+
InvalidFeeToken(_feeToken)
|
|
493
|
+
);
|
|
494
|
+
feeToken = _feeToken;
|
|
495
|
+
success = true;
|
|
496
|
+
emit FeeTokenSet(address(_feeToken));
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
/// @inheritdoc IEnclave
|
|
357
500
|
function enableE3Program(
|
|
358
501
|
IE3Program e3Program
|
|
359
502
|
) public onlyOwner returns (bool success) {
|
|
@@ -366,6 +509,7 @@ contract Enclave is IEnclave, OwnableUpgradeable {
|
|
|
366
509
|
emit E3ProgramEnabled(e3Program);
|
|
367
510
|
}
|
|
368
511
|
|
|
512
|
+
/// @inheritdoc IEnclave
|
|
369
513
|
function disableE3Program(
|
|
370
514
|
IE3Program e3Program
|
|
371
515
|
) public onlyOwner returns (bool success) {
|
|
@@ -375,6 +519,7 @@ contract Enclave is IEnclave, OwnableUpgradeable {
|
|
|
375
519
|
emit E3ProgramDisabled(e3Program);
|
|
376
520
|
}
|
|
377
521
|
|
|
522
|
+
/// @inheritdoc IEnclave
|
|
378
523
|
function setDecryptionVerifier(
|
|
379
524
|
bytes32 encryptionSchemeId,
|
|
380
525
|
IDecryptionVerifier decryptionVerifier
|
|
@@ -389,6 +534,7 @@ contract Enclave is IEnclave, OwnableUpgradeable {
|
|
|
389
534
|
emit EncryptionSchemeEnabled(encryptionSchemeId);
|
|
390
535
|
}
|
|
391
536
|
|
|
537
|
+
/// @inheritdoc IEnclave
|
|
392
538
|
function disableEncryptionScheme(
|
|
393
539
|
bytes32 encryptionSchemeId
|
|
394
540
|
) public onlyOwner returns (bool success) {
|
|
@@ -404,6 +550,7 @@ contract Enclave is IEnclave, OwnableUpgradeable {
|
|
|
404
550
|
emit EncryptionSchemeDisabled(encryptionSchemeId);
|
|
405
551
|
}
|
|
406
552
|
|
|
553
|
+
/// @inheritdoc IEnclave
|
|
407
554
|
function setE3ProgramsParams(
|
|
408
555
|
bytes[] memory _e3ProgramsParams
|
|
409
556
|
) public onlyOwner returns (bool success) {
|
|
@@ -424,19 +571,21 @@ contract Enclave is IEnclave, OwnableUpgradeable {
|
|
|
424
571
|
// //
|
|
425
572
|
////////////////////////////////////////////////////////////
|
|
426
573
|
|
|
574
|
+
/// @inheritdoc IEnclave
|
|
427
575
|
function getE3(uint256 e3Id) public view returns (E3 memory e3) {
|
|
428
576
|
e3 = e3s[e3Id];
|
|
429
577
|
require(e3.e3Program != IE3Program(address(0)), E3DoesNotExist(e3Id));
|
|
430
578
|
}
|
|
431
579
|
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
580
|
+
/// @inheritdoc IEnclave
|
|
581
|
+
function getE3Quote(
|
|
582
|
+
E3RequestParams calldata
|
|
583
|
+
) public pure returns (uint256 fee) {
|
|
584
|
+
fee = 1 * 10 ** 6;
|
|
585
|
+
require(fee > 0, PaymentRequired(fee));
|
|
438
586
|
}
|
|
439
587
|
|
|
588
|
+
/// @inheritdoc IEnclave
|
|
440
589
|
function getDecryptionVerifier(
|
|
441
590
|
bytes32 encryptionSchemeId
|
|
442
591
|
) public view returns (IDecryptionVerifier) {
|