Skip to content

Commit

Permalink
store map of provider pks
Browse files Browse the repository at this point in the history
  • Loading branch information
piotr-roslaniec committed Jun 28, 2023
1 parent 74f6e5e commit b0e7999
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion contracts/contracts/coordination/Coordinator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ contract Coordinator is Ownable {
bool aggregated;
bytes transcript; // TODO: Consider event processing complexity vs storage cost
bytes decryptionRequestStaticKey;
bytes publicKey; // TODO: Consider event processing complexity vs storage cost
}

// TODO: Optimize layout
Expand All @@ -58,6 +57,8 @@ contract Coordinator is Ownable {

Ritual[] public rituals;

mapping(address => bytes) public providerPublicKey;

IAccessControlApplication public immutable application;
uint32 public timeout;
uint32 public maxDkgSize;
Expand Down Expand Up @@ -96,6 +97,11 @@ contract Coordinator is Ownable {
}
}

function setProviderPublicKey(bytes calldata publicKey) external {
// TODO: Verify public key length
require(publicKey.length == 48, "Invalid public key length");
providerPublicKey[msg.sender] = publicKey;
}

function setTimeout(uint32 newTimeout) external onlyOwner {
emit TimeoutChanged(timeout, newTimeout);
Expand Down Expand Up @@ -131,6 +137,11 @@ contract Coordinator is Ownable {
for(uint256 i=0; i < length; i++){
Participant storage newParticipant = ritual.participant.push();
address current = providers[i];
// Make sure that current provider has already set their public key
require(
providerPublicKey[current].length > 0,
"Provider has not set their public key"
);
require(previous < current, "Providers must be sorted");
// TODO: Improve check for eligible nodes (staking, etc) - nucypher#3109
// TODO: Change check to isAuthorized(), without amount
Expand Down

0 comments on commit b0e7999

Please sign in to comment.