Skip to content

Commit

Permalink
apply pr suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
piotr-roslaniec committed Jul 10, 2023
1 parent e241bb7 commit c54c38f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 19 deletions.
1 change: 0 additions & 1 deletion src/agents/coordinator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,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;
};
Expand Down
25 changes: 15 additions & 10 deletions src/characters/cbd-recipient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,15 @@ export class CbdTDecDecrypter {
provider: ethers.providers.Web3Provider,
conditionExpr: ConditionExpression,
variant: FerveoVariant,
ciphertext: Ciphertext
ciphertext: Ciphertext,
verifyRitual = true
): Promise<Uint8Array> {
const decryptionShares = await this.retrieve(
provider,
conditionExpr,
variant,
ciphertext
ciphertext,
verifyRitual
);

const combineDecryptionSharesFn =
Expand All @@ -81,7 +83,8 @@ export class CbdTDecDecrypter {
web3Provider: ethers.providers.Web3Provider,
conditionExpr: ConditionExpression,
variant: number,
ciphertext: Ciphertext
ciphertext: Ciphertext,
verifyRitual = true
): Promise<DecryptionSharePrecomputed[] | DecryptionShareSimple[]> {
const ritualState = await DkgCoordinatorAgent.getRitualState(
web3Provider,
Expand All @@ -93,14 +96,16 @@ export class CbdTDecDecrypter {
);
}

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(
Expand Down
8 changes: 0 additions & 8 deletions src/dkg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,14 +122,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
Expand Down

0 comments on commit c54c38f

Please sign in to comment.