From 43d45f07a0535fe4c162afd6301da2cee3e11039 Mon Sep 17 00:00:00 2001
From: Piotr Roslaniec
Date: Thu, 29 Jun 2023 18:02:22 +0200
Subject: [PATCH] apply pr suggestions
---
src/agents/coordinator.ts | 1 -
src/characters/cbd-recipient.ts | 25 +++++++++++++++----------
src/dkg.ts | 8 --------
3 files changed, 15 insertions(+), 19 deletions(-)
diff --git a/src/agents/coordinator.ts b/src/agents/coordinator.ts
index a30deb191..ca1e41f17 100644
--- a/src/agents/coordinator.ts
+++ b/src/agents/coordinator.ts
@@ -25,7 +25,6 @@ export interface CoordinatorRitual {
export type DkgParticipant = {
provider: string;
aggregated: boolean;
- // TODO: How do I get the transcript from the Coordinator?
transcript: Transcript;
decryptionRequestStaticKey: SessionStaticKey;
};
diff --git a/src/characters/cbd-recipient.ts b/src/characters/cbd-recipient.ts
index 17af50e8b..47136da84 100644
--- a/src/characters/cbd-recipient.ts
+++ b/src/characters/cbd-recipient.ts
@@ -56,13 +56,15 @@ export class ThresholdDecrypter {
provider: ethers.providers.Web3Provider,
conditionExpr: ConditionExpression,
variant: FerveoVariant,
- ciphertext: Ciphertext
+ ciphertext: Ciphertext,
+ verifyRitual = true
): Promise {
const decryptionShares = await this.retrieve(
provider,
conditionExpr,
variant,
- ciphertext
+ ciphertext,
+ verifyRitual
);
const combineDecryptionSharesFn =
@@ -80,7 +82,8 @@ export class ThresholdDecrypter {
web3Provider: ethers.providers.Web3Provider,
conditionExpr: ConditionExpression,
variant: FerveoVariant,
- ciphertext: Ciphertext
+ ciphertext: Ciphertext,
+ verifyRitual = true
): Promise {
const ritualState = await DkgCoordinatorAgent.getRitualState(
web3Provider,
@@ -92,14 +95,16 @@ export class ThresholdDecrypter {
);
}
- const isLocallyVerified = await DkgClient.verifyRitual(
- web3Provider,
- this.ritualId
- );
- if (!isLocallyVerified) {
- throw new Error(
- `Ritual with id ${this.ritualId} has failed local verification.`
+ if (verifyRitual) {
+ const isLocallyVerified = await DkgClient.verifyRitual(
+ web3Provider,
+ this.ritualId
);
+ if (!isLocallyVerified) {
+ throw new Error(
+ `Ritual with id ${this.ritualId} has failed local verification.`
+ );
+ }
}
const dkgParticipants = await DkgCoordinatorAgent.getParticipants(
diff --git a/src/dkg.ts b/src/dkg.ts
index 7481f65ce..661d23a3d 100644
--- a/src/dkg.ts
+++ b/src/dkg.ts
@@ -182,14 +182,6 @@ export class DkgClient {
ritualId
);
- // TODO: Does this check make sense here? Or do we delegate it to the Coordinator contract?
- // for (const p of participants) {
- // // Not every participant has submitted a transcript
- // if (!p.aggregated) {
- // return false;
- // }
- // }
-
const validatorMessages = participants.map((p) => {
const validatorAddress = EthereumAddress.fromString(p.provider);
// TODO: Replace with real keys