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 Aug 10, 2023
1 parent 9e42bee commit 43d45f0
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 @@ -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;
};
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 @@ -56,13 +56,15 @@ export class ThresholdDecrypter {
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 @@ -80,7 +82,8 @@ export class ThresholdDecrypter {
web3Provider: ethers.providers.Web3Provider,
conditionExpr: ConditionExpression,
variant: FerveoVariant,
ciphertext: Ciphertext
ciphertext: Ciphertext,
verifyRitual = true
): Promise<DecryptionSharePrecomputed[] | DecryptionShareSimple[]> {
const ritualState = await DkgCoordinatorAgent.getRitualState(
web3Provider,
Expand All @@ -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(
Expand Down
8 changes: 0 additions & 8 deletions src/dkg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

1 comment on commit 43d45f0

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bundled size for the package is listed below:

build/module/src/kits: 19.53 KB
build/module/src/characters: 78.13 KB
build/module/src/policies: 19.53 KB
build/module/src/agents: 39.06 KB
build/module/src/conditions/predefined: 19.53 KB
build/module/src/conditions/base: 54.69 KB
build/module/src/conditions/context: 42.97 KB
build/module/src/conditions: 156.25 KB
build/module/src/sdk/strategy: 31.25 KB
build/module/src/sdk: 42.97 KB
build/module/src: 437.50 KB
build/module/types/ethers-contracts/factories: 82.03 KB
build/module/types/ethers-contracts: 152.34 KB
build/module/types: 156.25 KB
build/module: 648.44 KB
build/main/src/kits: 19.53 KB
build/main/src/characters: 78.13 KB
build/main/src/policies: 19.53 KB
build/main/src/agents: 39.06 KB
build/main/src/conditions/predefined: 19.53 KB
build/main/src/conditions/base: 54.69 KB
build/main/src/conditions/context: 42.97 KB
build/main/src/conditions: 156.25 KB
build/main/src/sdk/strategy: 35.16 KB
build/main/src/sdk: 46.88 KB
build/main/src: 445.31 KB
build/main/types/ethers-contracts/factories: 82.03 KB
build/main/types/ethers-contracts: 152.34 KB
build/main/types: 156.25 KB
build/main: 656.25 KB
build: 1.28 MB

Please sign in to comment.