Skip to content

Commit

Permalink
Reintroduce abi.encoded proof that is to be provided when publishing …
Browse files Browse the repository at this point in the history
…a committee
  • Loading branch information
cristovaoth committed Jun 26, 2024
1 parent 7482c89 commit ca901de
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 9 deletions.
4 changes: 2 additions & 2 deletions packages/evm/contracts/interfaces/ICyphernodeRegistry.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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;

Expand Down
8 changes: 6 additions & 2 deletions packages/evm/contracts/registry/CyphernodeRegistryOwnable.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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());

Expand Down Expand Up @@ -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];
}

Expand Down
6 changes: 5 additions & 1 deletion packages/evm/contracts/registry/NaiveRegistryFilter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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
);
}

////////////////////////////////////////////////////////////
Expand Down
16 changes: 12 additions & 4 deletions packages/evm/contracts/test/MockCyphernodeRegistry.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -28,7 +32,7 @@ contract MockCyphernodeRegistry is ICyphernodeRegistry {
}
}

function isCyphernodeEnabled(address) external pure returns (bool) {
function isCyphernodeEligible(address) external pure returns (bool) {
return false;
}
}
Expand All @@ -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;
}
}

0 comments on commit ca901de

Please sign in to comment.