@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
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
pragma solidity >=0.8.27;
|
|
7
7
|
|
|
8
8
|
import { ICiphernodeRegistry } from "../interfaces/ICiphernodeRegistry.sol";
|
|
9
|
-
import {
|
|
9
|
+
import { IBondingRegistry } from "../interfaces/IBondingRegistry.sol";
|
|
10
10
|
import {
|
|
11
11
|
OwnableUpgradeable
|
|
12
12
|
} from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
|
|
@@ -15,60 +15,189 @@ import {
|
|
|
15
15
|
LeanIMTData
|
|
16
16
|
} from "@zk-kit/lean-imt.sol/InternalLeanIMT.sol";
|
|
17
17
|
|
|
18
|
+
/**
|
|
19
|
+
* @title CiphernodeRegistryOwnable
|
|
20
|
+
* @notice Ownable implementation of the ciphernode registry with IMT-based membership tracking
|
|
21
|
+
* @dev Manages ciphernode registration, committee selection, and integrates with bonding registry
|
|
22
|
+
*/
|
|
18
23
|
contract CiphernodeRegistryOwnable is ICiphernodeRegistry, OwnableUpgradeable {
|
|
19
24
|
using InternalLeanIMT for LeanIMTData;
|
|
20
25
|
|
|
26
|
+
////////////////////////////////////////////////////////////
|
|
27
|
+
// //
|
|
28
|
+
// Events //
|
|
29
|
+
// //
|
|
30
|
+
////////////////////////////////////////////////////////////
|
|
31
|
+
|
|
32
|
+
/// @notice Emitted when the bonding registry address is set
|
|
33
|
+
/// @param bondingRegistry Address of the bonding registry contract
|
|
34
|
+
event BondingRegistrySet(address indexed bondingRegistry);
|
|
35
|
+
|
|
21
36
|
////////////////////////////////////////////////////////////
|
|
22
37
|
// //
|
|
23
38
|
// Storage Variables //
|
|
24
39
|
// //
|
|
25
40
|
////////////////////////////////////////////////////////////
|
|
26
41
|
|
|
42
|
+
/// @notice Address of the Enclave contract authorized to request committees
|
|
27
43
|
address public enclave;
|
|
44
|
+
|
|
45
|
+
/// @notice Address of the bonding registry for checking node eligibility
|
|
46
|
+
address public bondingRegistry;
|
|
47
|
+
|
|
48
|
+
/// @notice Current number of registered ciphernodes
|
|
28
49
|
uint256 public numCiphernodes;
|
|
50
|
+
|
|
51
|
+
/// @notice Submission Window for an E3 Sortition.
|
|
52
|
+
/// @dev The submission window is the time period during which the ciphernodes can submit
|
|
53
|
+
/// their tickets to be a part of the committee.
|
|
54
|
+
uint256 public sortitionSubmissionWindow;
|
|
55
|
+
|
|
56
|
+
/// @notice Incremental Merkle Tree (IMT) containing all registered ciphernodes
|
|
29
57
|
LeanIMTData public ciphernodes;
|
|
30
58
|
|
|
31
|
-
|
|
59
|
+
/// @notice Maps E3 ID to the IMT root at the time of committee request
|
|
32
60
|
mapping(uint256 e3Id => uint256 root) public roots;
|
|
61
|
+
|
|
62
|
+
/// @notice Maps E3 ID to the hash of the committee's public key
|
|
33
63
|
mapping(uint256 e3Id => bytes32 publicKeyHash) public publicKeyHashes;
|
|
34
64
|
|
|
65
|
+
/// @notice Maps E3 ID to its committee data
|
|
66
|
+
mapping(uint256 e3Id => Committee committee) internal committees;
|
|
67
|
+
|
|
35
68
|
////////////////////////////////////////////////////////////
|
|
36
69
|
// //
|
|
37
70
|
// Errors //
|
|
38
71
|
// //
|
|
39
72
|
////////////////////////////////////////////////////////////
|
|
40
73
|
|
|
74
|
+
/// @notice Committee has already been requested for this E3
|
|
41
75
|
error CommitteeAlreadyRequested();
|
|
76
|
+
|
|
77
|
+
/// @notice Committee has already been published for this E3
|
|
42
78
|
error CommitteeAlreadyPublished();
|
|
43
|
-
|
|
79
|
+
|
|
80
|
+
/// @notice Committee has not been published yet for this E3
|
|
44
81
|
error CommitteeNotPublished();
|
|
82
|
+
|
|
83
|
+
/// @notice Committee has not been requested yet for this E3
|
|
84
|
+
error CommitteeNotRequested();
|
|
85
|
+
|
|
86
|
+
/// @notice Committee Not Initialized or Finalized
|
|
87
|
+
error CommitteeNotInitializedOrFinalized();
|
|
88
|
+
|
|
89
|
+
/// @notice Submission Window has been closed for this E3
|
|
90
|
+
error SubmissionWindowClosed();
|
|
91
|
+
|
|
92
|
+
/// @notice Submission deadline has been reached for this E3
|
|
93
|
+
error SubmissionDeadlineReached();
|
|
94
|
+
|
|
95
|
+
/// @notice Committee has already been finalized for this E3
|
|
96
|
+
error CommitteeAlreadyFinalized();
|
|
97
|
+
|
|
98
|
+
/// @notice Committee has not been finalized yet for this E3
|
|
99
|
+
error CommitteeNotFinalized();
|
|
100
|
+
|
|
101
|
+
/// @notice Node has already submitted a ticket for this E3
|
|
102
|
+
error NodeAlreadySubmitted();
|
|
103
|
+
|
|
104
|
+
/// @notice Node has not submitted a ticket for this E3
|
|
105
|
+
error NodeNotSubmitted();
|
|
106
|
+
|
|
107
|
+
/// @notice Node is not eligible for this E3
|
|
108
|
+
error NodeNotEligible();
|
|
109
|
+
|
|
110
|
+
/// @notice Ciphernode is not enabled in the registry
|
|
111
|
+
/// @param node Address of the ciphernode
|
|
45
112
|
error CiphernodeNotEnabled(address node);
|
|
113
|
+
|
|
114
|
+
/// @notice Caller is not the Enclave contract
|
|
46
115
|
error OnlyEnclave();
|
|
47
116
|
|
|
117
|
+
/// @notice Caller is not the bonding registry
|
|
118
|
+
error OnlyBondingRegistry();
|
|
119
|
+
|
|
120
|
+
/// @notice Caller is neither owner nor bonding registry
|
|
121
|
+
error NotOwnerOrBondingRegistry();
|
|
122
|
+
|
|
123
|
+
/// @notice Node is not bonded
|
|
124
|
+
/// @param node Address of the node
|
|
125
|
+
error NodeNotBonded(address node);
|
|
126
|
+
|
|
127
|
+
/// @notice Address cannot be zero
|
|
128
|
+
error ZeroAddress();
|
|
129
|
+
|
|
130
|
+
/// @notice Bonding registry has not been set
|
|
131
|
+
error BondingRegistryNotSet();
|
|
132
|
+
|
|
133
|
+
/// @notice Invalid ticket number
|
|
134
|
+
error InvalidTicketNumber();
|
|
135
|
+
|
|
136
|
+
/// @notice Submission window not closed yet
|
|
137
|
+
error SubmissionWindowNotClosed();
|
|
138
|
+
|
|
139
|
+
/// @notice Threshold not met for this E3
|
|
140
|
+
error ThresholdNotMet();
|
|
141
|
+
|
|
142
|
+
/// @notice Caller is not authorized
|
|
143
|
+
error Unauthorized();
|
|
144
|
+
|
|
48
145
|
////////////////////////////////////////////////////////////
|
|
49
146
|
// //
|
|
50
147
|
// Modifiers //
|
|
51
148
|
// //
|
|
52
149
|
////////////////////////////////////////////////////////////
|
|
53
150
|
|
|
151
|
+
/// @dev Restricts function access to only the Enclave contract
|
|
54
152
|
modifier onlyEnclave() {
|
|
55
153
|
require(msg.sender == enclave, OnlyEnclave());
|
|
56
154
|
_;
|
|
57
155
|
}
|
|
58
156
|
|
|
157
|
+
/// @dev Restricts function access to only the bonding registry
|
|
158
|
+
modifier onlyBondingRegistry() {
|
|
159
|
+
require(msg.sender == bondingRegistry, OnlyBondingRegistry());
|
|
160
|
+
_;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/// @dev Restricts function access to owner or bonding registry
|
|
164
|
+
modifier onlyOwnerOrBondingVault() {
|
|
165
|
+
require(
|
|
166
|
+
msg.sender == owner() || msg.sender == bondingRegistry,
|
|
167
|
+
NotOwnerOrBondingRegistry()
|
|
168
|
+
);
|
|
169
|
+
_;
|
|
170
|
+
}
|
|
171
|
+
|
|
59
172
|
////////////////////////////////////////////////////////////
|
|
60
173
|
// //
|
|
61
174
|
// Initialization //
|
|
62
175
|
// //
|
|
63
176
|
////////////////////////////////////////////////////////////
|
|
64
177
|
|
|
65
|
-
|
|
66
|
-
|
|
178
|
+
/// @notice Constructor that disables initializers.
|
|
179
|
+
/// @dev Prevents the implementation contract from being initialized. Initialization is performed
|
|
180
|
+
/// via the initialize() function when deployed behind a proxy.
|
|
181
|
+
constructor() {
|
|
182
|
+
_disableInitializers();
|
|
67
183
|
}
|
|
68
184
|
|
|
69
|
-
|
|
185
|
+
/// @notice Initializes the registry contract
|
|
186
|
+
/// @dev Can only be called once due to initializer modifier
|
|
187
|
+
/// @param _owner Address that will own the contract
|
|
188
|
+
/// @param _enclave Address of the Enclave contract
|
|
189
|
+
/// @param _submissionWindow The submission window for the E3 sortition in seconds
|
|
190
|
+
function initialize(
|
|
191
|
+
address _owner,
|
|
192
|
+
address _enclave,
|
|
193
|
+
uint256 _submissionWindow
|
|
194
|
+
) public initializer {
|
|
195
|
+
require(_owner != address(0), ZeroAddress());
|
|
196
|
+
require(_enclave != address(0), ZeroAddress());
|
|
197
|
+
|
|
70
198
|
__Ownable_init(msg.sender);
|
|
71
199
|
setEnclave(_enclave);
|
|
200
|
+
setSortitionSubmissionWindow(_submissionWindow);
|
|
72
201
|
if (_owner != owner()) transferOwnership(_owner);
|
|
73
202
|
}
|
|
74
203
|
|
|
@@ -78,36 +207,64 @@ contract CiphernodeRegistryOwnable is ICiphernodeRegistry, OwnableUpgradeable {
|
|
|
78
207
|
// //
|
|
79
208
|
////////////////////////////////////////////////////////////
|
|
80
209
|
|
|
210
|
+
/// @inheritdoc ICiphernodeRegistry
|
|
81
211
|
function requestCommittee(
|
|
82
212
|
uint256 e3Id,
|
|
83
|
-
|
|
213
|
+
uint256 seed,
|
|
84
214
|
uint32[2] calldata threshold
|
|
85
215
|
) external onlyEnclave returns (bool success) {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
216
|
+
Committee storage c = committees[e3Id];
|
|
217
|
+
require(!c.initialized, CommitteeAlreadyRequested());
|
|
218
|
+
|
|
219
|
+
c.initialized = true;
|
|
220
|
+
c.finalized = false;
|
|
221
|
+
c.seed = seed;
|
|
222
|
+
c.requestBlock = block.number;
|
|
223
|
+
c.submissionDeadline = block.timestamp + sortitionSubmissionWindow;
|
|
224
|
+
c.threshold = threshold;
|
|
91
225
|
roots[e3Id] = root();
|
|
92
226
|
|
|
93
|
-
|
|
94
|
-
|
|
227
|
+
emit CommitteeRequested(
|
|
228
|
+
e3Id,
|
|
229
|
+
seed,
|
|
230
|
+
threshold,
|
|
231
|
+
c.requestBlock,
|
|
232
|
+
c.submissionDeadline
|
|
233
|
+
);
|
|
95
234
|
success = true;
|
|
96
235
|
}
|
|
97
236
|
|
|
237
|
+
/// @notice Publishes a committee for an E3 computation
|
|
238
|
+
/// @dev Only callable by owner. Verifies committee is finalized and matches provided nodes.
|
|
239
|
+
/// @param e3Id ID of the E3 computation
|
|
240
|
+
/// @param nodes Array of ciphernode addresses selected for the committee
|
|
241
|
+
/// @param publicKey Aggregated public key of the committee
|
|
98
242
|
function publishCommittee(
|
|
99
243
|
uint256 e3Id,
|
|
100
|
-
|
|
244
|
+
address[] calldata nodes,
|
|
101
245
|
bytes calldata publicKey
|
|
102
|
-
) external {
|
|
103
|
-
|
|
104
|
-
|
|
246
|
+
) external onlyOwner {
|
|
247
|
+
Committee storage c = committees[e3Id];
|
|
248
|
+
|
|
249
|
+
require(c.initialized, CommitteeNotRequested());
|
|
250
|
+
require(c.finalized, CommitteeNotFinalized());
|
|
251
|
+
require(c.publicKey == bytes32(0), CommitteeAlreadyPublished());
|
|
252
|
+
require(nodes.length == c.committee.length, "Node count mismatch");
|
|
105
253
|
|
|
106
|
-
|
|
107
|
-
|
|
254
|
+
// TODO: Currently we trust the owner to publish the correct committee.
|
|
255
|
+
// TODO: Need a Proof that the public key is generated from the committee
|
|
256
|
+
bytes32 publicKeyHash = keccak256(publicKey);
|
|
257
|
+
c.publicKey = publicKeyHash;
|
|
258
|
+
publicKeyHashes[e3Id] = publicKeyHash;
|
|
259
|
+
emit CommitteePublished(e3Id, nodes, publicKey);
|
|
108
260
|
}
|
|
109
261
|
|
|
110
|
-
|
|
262
|
+
/// @inheritdoc ICiphernodeRegistry
|
|
263
|
+
function addCiphernode(address node) external onlyOwnerOrBondingVault {
|
|
264
|
+
if (isEnabled(node)) {
|
|
265
|
+
return;
|
|
266
|
+
}
|
|
267
|
+
|
|
111
268
|
uint160 ciphernode = uint160(node);
|
|
112
269
|
ciphernodes._insert(ciphernode);
|
|
113
270
|
numCiphernodes++;
|
|
@@ -119,10 +276,13 @@ contract CiphernodeRegistryOwnable is ICiphernodeRegistry, OwnableUpgradeable {
|
|
|
119
276
|
);
|
|
120
277
|
}
|
|
121
278
|
|
|
279
|
+
/// @inheritdoc ICiphernodeRegistry
|
|
122
280
|
function removeCiphernode(
|
|
123
281
|
address node,
|
|
124
282
|
uint256[] calldata siblingNodes
|
|
125
|
-
) external
|
|
283
|
+
) external onlyOwnerOrBondingVault {
|
|
284
|
+
require(isEnabled(node), CiphernodeNotEnabled(node));
|
|
285
|
+
|
|
126
286
|
uint160 ciphernode = uint160(node);
|
|
127
287
|
uint256 index = ciphernodes._indexOf(ciphernode);
|
|
128
288
|
ciphernodes._remove(ciphernode, siblingNodes);
|
|
@@ -130,23 +290,115 @@ contract CiphernodeRegistryOwnable is ICiphernodeRegistry, OwnableUpgradeable {
|
|
|
130
290
|
emit CiphernodeRemoved(node, index, numCiphernodes, ciphernodes.size);
|
|
131
291
|
}
|
|
132
292
|
|
|
293
|
+
////////////////////////////////////////////////////////////
|
|
294
|
+
// //
|
|
295
|
+
// Sortition Functions //
|
|
296
|
+
// //
|
|
297
|
+
////////////////////////////////////////////////////////////
|
|
298
|
+
|
|
299
|
+
/// @notice Submit a ticket for sortition
|
|
300
|
+
/// @dev Validates ticket against node's balance at request block and inserts into top-N
|
|
301
|
+
/// @param e3Id ID of the E3 computation
|
|
302
|
+
/// @param ticketNumber The ticket number to submit (1 to available tickets at snapshot)
|
|
303
|
+
function submitTicket(uint256 e3Id, uint256 ticketNumber) external {
|
|
304
|
+
Committee storage c = committees[e3Id];
|
|
305
|
+
require(c.initialized, CommitteeNotRequested());
|
|
306
|
+
require(!c.finalized, CommitteeAlreadyFinalized());
|
|
307
|
+
require(
|
|
308
|
+
block.timestamp <= c.submissionDeadline,
|
|
309
|
+
SubmissionDeadlineReached()
|
|
310
|
+
);
|
|
311
|
+
require(!c.submitted[msg.sender], NodeAlreadySubmitted());
|
|
312
|
+
require(isCiphernodeEligible(msg.sender), NodeNotEligible());
|
|
313
|
+
|
|
314
|
+
// Validate node eligibility and ticket number
|
|
315
|
+
_validateNodeEligibility(msg.sender, ticketNumber, e3Id);
|
|
316
|
+
|
|
317
|
+
// Compute score
|
|
318
|
+
uint256 score = _computeTicketScore(
|
|
319
|
+
msg.sender,
|
|
320
|
+
ticketNumber,
|
|
321
|
+
e3Id,
|
|
322
|
+
c.seed
|
|
323
|
+
);
|
|
324
|
+
|
|
325
|
+
// Store submission
|
|
326
|
+
c.submitted[msg.sender] = true;
|
|
327
|
+
|
|
328
|
+
// Insert into top-N (ascending score)
|
|
329
|
+
_insertTopN(c, msg.sender, score);
|
|
330
|
+
|
|
331
|
+
emit TicketSubmitted(e3Id, msg.sender, ticketNumber, score);
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
/// @notice Finalize the committee after submission window closes
|
|
335
|
+
/// @dev Can be called by anyone after the deadline. Reverts if not enough nodes submitted.
|
|
336
|
+
/// @param e3Id ID of the E3 computation
|
|
337
|
+
function finalizeCommittee(uint256 e3Id) external {
|
|
338
|
+
Committee storage c = committees[e3Id];
|
|
339
|
+
require(c.initialized, CommitteeNotRequested());
|
|
340
|
+
require(!c.finalized, CommitteeAlreadyFinalized());
|
|
341
|
+
require(
|
|
342
|
+
block.timestamp >= c.submissionDeadline,
|
|
343
|
+
SubmissionWindowNotClosed()
|
|
344
|
+
);
|
|
345
|
+
// TODO: Handle what happens if the threshold is not met.
|
|
346
|
+
require(c.topNodes.length >= c.threshold[0], ThresholdNotMet());
|
|
347
|
+
|
|
348
|
+
c.finalized = true;
|
|
349
|
+
c.committee = c.topNodes;
|
|
350
|
+
|
|
351
|
+
emit CommitteeFinalized(e3Id, c.topNodes);
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
/// @notice Check if submission window is still open for an E3
|
|
355
|
+
/// @param e3Id ID of the E3 computation
|
|
356
|
+
/// @return Whether the submission window is open
|
|
357
|
+
function isOpen(uint256 e3Id) public view returns (bool) {
|
|
358
|
+
Committee storage c = committees[e3Id];
|
|
359
|
+
if (!c.initialized || c.finalized) return false;
|
|
360
|
+
return block.timestamp <= c.submissionDeadline;
|
|
361
|
+
}
|
|
362
|
+
|
|
133
363
|
////////////////////////////////////////////////////////////
|
|
134
364
|
// //
|
|
135
365
|
// Set Functions //
|
|
136
366
|
// //
|
|
137
367
|
////////////////////////////////////////////////////////////
|
|
138
368
|
|
|
369
|
+
/// @notice Sets the Enclave contract address
|
|
370
|
+
/// @dev Only callable by owner
|
|
371
|
+
/// @param _enclave Address of the Enclave contract
|
|
139
372
|
function setEnclave(address _enclave) public onlyOwner {
|
|
373
|
+
require(_enclave != address(0), ZeroAddress());
|
|
140
374
|
enclave = _enclave;
|
|
141
375
|
emit EnclaveSet(_enclave);
|
|
142
376
|
}
|
|
143
377
|
|
|
378
|
+
/// @notice Sets the bonding registry contract address
|
|
379
|
+
/// @dev Only callable by owner
|
|
380
|
+
/// @param _bondingRegistry Address of the bonding registry contract
|
|
381
|
+
function setBondingRegistry(address _bondingRegistry) public onlyOwner {
|
|
382
|
+
require(_bondingRegistry != address(0), ZeroAddress());
|
|
383
|
+
bondingRegistry = _bondingRegistry;
|
|
384
|
+
emit BondingRegistrySet(_bondingRegistry);
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
/// @inheritdoc ICiphernodeRegistry
|
|
388
|
+
function setSortitionSubmissionWindow(
|
|
389
|
+
uint256 _sortitionSubmissionWindow
|
|
390
|
+
) public onlyOwner {
|
|
391
|
+
sortitionSubmissionWindow = _sortitionSubmissionWindow;
|
|
392
|
+
emit SortitionSubmissionWindowSet(_sortitionSubmissionWindow);
|
|
393
|
+
}
|
|
394
|
+
|
|
144
395
|
////////////////////////////////////////////////////////////
|
|
145
396
|
// //
|
|
146
397
|
// Get Functions //
|
|
147
398
|
// //
|
|
148
399
|
////////////////////////////////////////////////////////////
|
|
149
400
|
|
|
401
|
+
/// @inheritdoc ICiphernodeRegistry
|
|
150
402
|
function committeePublicKey(
|
|
151
403
|
uint256 e3Id
|
|
152
404
|
) external view returns (bytes32 publicKeyHash) {
|
|
@@ -154,27 +406,142 @@ contract CiphernodeRegistryOwnable is ICiphernodeRegistry, OwnableUpgradeable {
|
|
|
154
406
|
require(publicKeyHash != bytes32(0), CommitteeNotPublished());
|
|
155
407
|
}
|
|
156
408
|
|
|
157
|
-
|
|
158
|
-
|
|
409
|
+
/// @inheritdoc ICiphernodeRegistry
|
|
410
|
+
function isCiphernodeEligible(address node) public view returns (bool) {
|
|
411
|
+
if (!isEnabled(node)) return false;
|
|
412
|
+
|
|
413
|
+
require(bondingRegistry != address(0), BondingRegistryNotSet());
|
|
414
|
+
return IBondingRegistry(bondingRegistry).isActive(node);
|
|
159
415
|
}
|
|
160
416
|
|
|
417
|
+
/// @inheritdoc ICiphernodeRegistry
|
|
161
418
|
function isEnabled(address node) public view returns (bool) {
|
|
162
419
|
return ciphernodes._has(uint160(node));
|
|
163
420
|
}
|
|
164
421
|
|
|
422
|
+
/// @notice Returns the current root of the ciphernode IMT
|
|
423
|
+
/// @return Current IMT root
|
|
165
424
|
function root() public view returns (uint256) {
|
|
166
425
|
return (ciphernodes._root());
|
|
167
426
|
}
|
|
168
427
|
|
|
428
|
+
/// @notice Returns the IMT root at the time a committee was requested
|
|
429
|
+
/// @param e3Id ID of the E3
|
|
430
|
+
/// @return IMT root at time of committee request
|
|
169
431
|
function rootAt(uint256 e3Id) public view returns (uint256) {
|
|
170
432
|
return roots[e3Id];
|
|
171
433
|
}
|
|
172
434
|
|
|
173
|
-
|
|
174
|
-
|
|
435
|
+
/// @inheritdoc ICiphernodeRegistry
|
|
436
|
+
function getCommitteeNodes(
|
|
437
|
+
uint256 e3Id
|
|
438
|
+
) public view returns (address[] memory nodes) {
|
|
439
|
+
Committee storage c = committees[e3Id];
|
|
440
|
+
require(c.publicKey != bytes32(0), CommitteeNotPublished());
|
|
441
|
+
nodes = c.committee;
|
|
175
442
|
}
|
|
176
443
|
|
|
444
|
+
/// @notice Returns the current size of the ciphernode IMT
|
|
445
|
+
/// @return Size of the IMT
|
|
177
446
|
function treeSize() public view returns (uint256) {
|
|
178
447
|
return ciphernodes.size;
|
|
179
448
|
}
|
|
449
|
+
|
|
450
|
+
/// @notice Returns the address of the bonding registry
|
|
451
|
+
/// @return Address of the bonding registry contract
|
|
452
|
+
function getBondingRegistry() external view returns (address) {
|
|
453
|
+
return bondingRegistry;
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
////////////////////////////////////////////////////////////
|
|
457
|
+
// //
|
|
458
|
+
// Internal Functions //
|
|
459
|
+
// //
|
|
460
|
+
////////////////////////////////////////////////////////////
|
|
461
|
+
|
|
462
|
+
/// @notice Computes ticket score as keccak256(node || ticketNumber || e3Id || seed)
|
|
463
|
+
/// @param node Address of the ciphernode
|
|
464
|
+
/// @param ticketNumber The ticket number
|
|
465
|
+
/// @param e3Id ID of the E3 computation
|
|
466
|
+
/// @param seed Random seed for the E3
|
|
467
|
+
/// @return score The computed score
|
|
468
|
+
function _computeTicketScore(
|
|
469
|
+
address node,
|
|
470
|
+
uint256 ticketNumber,
|
|
471
|
+
uint256 e3Id,
|
|
472
|
+
uint256 seed
|
|
473
|
+
) internal pure returns (uint256) {
|
|
474
|
+
bytes32 hash = keccak256(
|
|
475
|
+
abi.encodePacked(node, ticketNumber, e3Id, seed)
|
|
476
|
+
);
|
|
477
|
+
return uint256(hash);
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
/// @notice Validates that a node is eligible to submit a ticket
|
|
481
|
+
/// @dev Uses snapshot of ticket balance at E3 request block for deterministic validation
|
|
482
|
+
/// @param node Address of the ciphernode
|
|
483
|
+
/// @param ticketNumber The ticket number being submitted
|
|
484
|
+
/// @param e3Id ID of the E3 computation
|
|
485
|
+
function _validateNodeEligibility(
|
|
486
|
+
address node,
|
|
487
|
+
uint256 ticketNumber,
|
|
488
|
+
uint256 e3Id
|
|
489
|
+
) internal view {
|
|
490
|
+
require(ticketNumber > 0, InvalidTicketNumber());
|
|
491
|
+
require(bondingRegistry != address(0), BondingRegistryNotSet());
|
|
492
|
+
|
|
493
|
+
Committee storage c = committees[e3Id];
|
|
494
|
+
|
|
495
|
+
// @todo Ensure we check everywhere that we use the block before the request block
|
|
496
|
+
// to ensure cases where everything is done in the same block are handled correctly.
|
|
497
|
+
uint256 ticketBalance = IBondingRegistry(bondingRegistry)
|
|
498
|
+
.getTicketBalanceAtBlock(node, c.requestBlock - 1);
|
|
499
|
+
uint256 ticketPrice = IBondingRegistry(bondingRegistry).ticketPrice();
|
|
500
|
+
|
|
501
|
+
require(ticketPrice > 0, InvalidTicketNumber());
|
|
502
|
+
uint256 availableTickets = ticketBalance / ticketPrice;
|
|
503
|
+
|
|
504
|
+
require(availableTickets > 0, NodeNotEligible());
|
|
505
|
+
require(ticketNumber <= availableTickets, InvalidTicketNumber());
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
/// @notice Inserts a node into the top-N list - Smallest scores
|
|
509
|
+
/// @dev If the node is not in the top-N, it is added to the top-N.
|
|
510
|
+
/// @param c Committee storage reference
|
|
511
|
+
/// @param node Address of the node
|
|
512
|
+
/// @param score Score of the node
|
|
513
|
+
/// @return entered Whether the node was inserted into the top-N
|
|
514
|
+
function _insertTopN(
|
|
515
|
+
Committee storage c,
|
|
516
|
+
address node,
|
|
517
|
+
uint256 score
|
|
518
|
+
) internal returns (bool entered) {
|
|
519
|
+
address[] storage top = c.topNodes;
|
|
520
|
+
uint256 cap = c.threshold[1];
|
|
521
|
+
|
|
522
|
+
if (top.length < cap) {
|
|
523
|
+
top.push(node);
|
|
524
|
+
c.scoreOf[node] = score;
|
|
525
|
+
return true;
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
uint256 worstIdx = 0;
|
|
529
|
+
uint256 worstScore = c.scoreOf[top[0]];
|
|
530
|
+
unchecked {
|
|
531
|
+
for (uint256 i = 1; i < top.length; ++i) {
|
|
532
|
+
uint256 s = c.scoreOf[top[i]];
|
|
533
|
+
if (s > worstScore) {
|
|
534
|
+
worstScore = s;
|
|
535
|
+
worstIdx = i;
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
if (score >= worstScore) return false;
|
|
541
|
+
|
|
542
|
+
top[worstIdx] = node;
|
|
543
|
+
c.scoreOf[node] = score;
|
|
544
|
+
|
|
545
|
+
return true;
|
|
546
|
+
}
|
|
180
547
|
}
|