Skip to content

Commit

Permalink
Ensure that provided decryption request static key by nodes is 42 byt…
Browse files Browse the repository at this point in the history
…es long (as of nucypher-core v0.10.0).
  • Loading branch information
derekpierre authored and cygnusv committed Jun 23, 2023
1 parent 02b93ed commit f819fac
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions contracts/contracts/coordination/Coordinator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -262,13 +262,18 @@ contract Coordinator is AccessControlDefaultAdminRules {

require(
participant.decryptionRequestStaticKey.length == 0,
"Node already provided request encrypting key"
"Node already provided decryption request static key"
);

require(
decryptionRequestStaticKey.length == 42,
"Invalid length for decryption request static key"
);

// nodes commit to their aggregation result
bytes32 aggregatedTranscriptDigest = keccak256(aggregatedTranscript);
participant.aggregated = true;
participant.decryptionRequestStaticKey = decryptionRequestStaticKey; // TODO validation?
participant.decryptionRequestStaticKey = decryptionRequestStaticKey;
emit AggregationPosted(ritualId, provider, aggregatedTranscriptDigest);

if (ritual.aggregatedTranscript.length == 0) {
Expand Down
2 changes: 1 addition & 1 deletion tests/test_coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def test_post_aggregation(coordinator, nodes, initiator):
coordinator.postTranscript(0, transcript, sender=node)

aggregated = os.urandom(TRANSCRIPT_SIZE)
decryptionRequestStaticKeys = [os.urandom(58) for node in nodes]
decryptionRequestStaticKeys = [os.urandom(42) for node in nodes]
publicKey = (os.urandom(32), os.urandom(16))
for i, node in enumerate(nodes):
assert coordinator.getRitualState(0) == RitualState.AWAITING_AGGREGATIONS
Expand Down

0 comments on commit f819fac

Please sign in to comment.