From ca901de90804f0d8ff644b95c777a7a20c02ef9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Crist=C3=B3v=C3=A3o=20Honorato?= Date: Wed, 26 Jun 2024 14:52:48 +0200 Subject: [PATCH] Reintroduce abi.encoded proof that is to be provided when publishing a committee --- .../contracts/interfaces/ICyphernodeRegistry.sol | 4 ++-- .../registry/CyphernodeRegistryOwnable.sol | 8 ++++++-- .../contracts/registry/NaiveRegistryFilter.sol | 6 +++++- .../contracts/test/MockCyphernodeRegistry.sol | 16 ++++++++++++---- 4 files changed, 25 insertions(+), 9 deletions(-) diff --git a/packages/evm/contracts/interfaces/ICyphernodeRegistry.sol b/packages/evm/contracts/interfaces/ICyphernodeRegistry.sol index 4f69764e..f06adcfa 100644 --- a/packages/evm/contracts/interfaces/ICyphernodeRegistry.sol +++ b/packages/evm/contracts/interfaces/ICyphernodeRegistry.sol @@ -27,7 +27,7 @@ interface ICyphernodeRegistry { /// @notice This event MUST be emitted when a cyphernode is removed from the registry. event CyphernodeRemoved(address indexed node); - function isCyphernodeEnabled(address ciphernode) external returns (bool); + function isCyphernodeEligible(address cyphernode) external returns (bool); /// @notice Initiates the committee selection process for a specified E3. /// @dev This function MUST revert when not called by the Enclave contract. @@ -47,7 +47,7 @@ interface ICyphernodeRegistry { /// @param publicKey The public key generated by the selected committee. function publishCommittee( uint256 e3Id, - // NOTE: Consider including a bytes proof parameter for verification purposes ? + bytes calldata proof, bytes calldata publicKey ) external; diff --git a/packages/evm/contracts/registry/CyphernodeRegistryOwnable.sol b/packages/evm/contracts/registry/CyphernodeRegistryOwnable.sol index 537d9958..c9c17ca5 100644 --- a/packages/evm/contracts/registry/CyphernodeRegistryOwnable.sol +++ b/packages/evm/contracts/registry/CyphernodeRegistryOwnable.sol @@ -83,7 +83,11 @@ contract CyphernodeRegistryOwnable is ICyphernodeRegistry, OwnableUpgradeable { success = true; } - function publishCommittee(uint256 e3Id, bytes calldata publicKey) external { + function publishCommittee( + uint256 e3Id, + bytes calldata, + bytes calldata publicKey + ) external { // only to be published by the filter require(address(requests[e3Id]) == msg.sender, CommitteeDoesNotExist()); @@ -119,7 +123,7 @@ contract CyphernodeRegistryOwnable is ICyphernodeRegistry, OwnableUpgradeable { emit CyphernodeRemoved(node); } - function isCyphernodeEnabled(address node) external view returns (bool) { + function isCyphernodeEligible(address node) external view returns (bool) { return isEnabled[node]; } diff --git a/packages/evm/contracts/registry/NaiveRegistryFilter.sol b/packages/evm/contracts/registry/NaiveRegistryFilter.sol index e247de53..5966c8ea 100644 --- a/packages/evm/contracts/registry/NaiveRegistryFilter.sol +++ b/packages/evm/contracts/registry/NaiveRegistryFilter.sol @@ -91,7 +91,11 @@ contract NaiveRegistryFilter is IRegistryFilter, OwnableUpgradeable { ); committee.nodes = nodes; committee.publicKey = publicKey; - ICyphernodeRegistry(registry).publishCommittee(e3Id, publicKey); + ICyphernodeRegistry(registry).publishCommittee( + e3Id, + abi.encode(nodes), + publicKey + ); } //////////////////////////////////////////////////////////// diff --git a/packages/evm/contracts/test/MockCyphernodeRegistry.sol b/packages/evm/contracts/test/MockCyphernodeRegistry.sol index 7cf83f09..de4e95f3 100644 --- a/packages/evm/contracts/test/MockCyphernodeRegistry.sol +++ b/packages/evm/contracts/test/MockCyphernodeRegistry.sol @@ -16,7 +16,11 @@ contract MockCyphernodeRegistry is ICyphernodeRegistry { } } - function publishCommittee(uint256, bytes calldata) external {} + function publishCommittee( + uint256, + bytes calldata, + bytes calldata + ) external {} function committeePublicKey( uint256 e3Id @@ -28,7 +32,7 @@ contract MockCyphernodeRegistry is ICyphernodeRegistry { } } - function isCyphernodeEnabled(address) external pure returns (bool) { + function isCyphernodeEligible(address) external pure returns (bool) { return false; } } @@ -46,13 +50,17 @@ contract MockCyphernodeRegistryEmptyKey is ICyphernodeRegistry { } } - function publishCommittee(uint256, bytes calldata) external {} + function publishCommittee( + uint256, + bytes calldata, + bytes calldata + ) external {} function committeePublicKey(uint256) external pure returns (bytes memory) { return hex""; } - function isCyphernodeEnabled(address) external pure returns (bool) { + function isCyphernodeEligible(address) external pure returns (bool) { return false; } }