From 933416e106d3338a404405d41dbeafc08544f973 Mon Sep 17 00:00:00 2001 From: Piotr Roslaniec Date: Wed, 6 Sep 2023 11:08:57 +0200 Subject: [PATCH] update after rebase --- src/taco.ts | 14 +------ test/unit/cbd-strategy.test.ts | 5 +-- test/unit/conditions/condition-expr.test.ts | 44 --------------------- 3 files changed, 3 insertions(+), 60 deletions(-) diff --git a/src/taco.ts b/src/taco.ts index fad36b183..7b5e15876 100644 --- a/src/taco.ts +++ b/src/taco.ts @@ -45,19 +45,7 @@ export const decrypt = async ( ritualId, ritual.dkgParams.threshold ); - // TODO: What do we do if there are no conditions? - if (!messageKit.acp.conditions) { - throw new Error('ThresholdMessageKit does not contain conditions'); - } - const conditionExpr = ConditionExpression.fromWASMConditions( - messageKit.acp.conditions - ); - return decrypter.retrieveAndDecrypt( - provider, - conditionExpr, - messageKit, - signer - ); + return decrypter.retrieveAndDecrypt(provider, messageKit, signer); }; export const taco = { diff --git a/test/unit/cbd-strategy.test.ts b/test/unit/cbd-strategy.test.ts index 96ebf908a..3ca3b07a3 100644 --- a/test/unit/cbd-strategy.test.ts +++ b/test/unit/cbd-strategy.test.ts @@ -32,7 +32,6 @@ const { const secretKey = SecretKey.fromBEBytes(aliceSecretKeyBytes); const provider = fakeProvider(secretKey.toBEBytes()); const signer = fakeSigner(secretKey.toBEBytes()); -const aliceSigner = fakeSigner(aliceSecretKey.toBEBytes()); const ownsNFT = new ERC721Ownership({ contractAddress: '0x1e988ba4692e52Bc50b375bcC8585b95c48AaD77', parameters: [3591], @@ -132,9 +131,9 @@ describe('CbdDeployedStrategy', () => { const decryptedMessage = await deployedStrategy.decrypter.retrieveAndDecrypt( - aliceProvider, + provider, thresholdMessageKit, - aliceSigner + signer ); expect(getUrsulasSpy).toHaveBeenCalled(); expect(getParticipantsSpy).toHaveBeenCalled(); diff --git a/test/unit/conditions/condition-expr.test.ts b/test/unit/conditions/condition-expr.test.ts index 4aa493c07..873a4b042 100644 --- a/test/unit/conditions/condition-expr.test.ts +++ b/test/unit/conditions/condition-expr.test.ts @@ -226,50 +226,6 @@ describe('condition set', () => { } ); - it.each([ - // no "operator" nor "method" value - { - version: ConditionExpression.VERSION, - condition: { - randoKey: 'randoValue', - otherKey: 'otherValue', - }, - }, - // invalid "method" and no "contractAddress" - { - version: ConditionExpression.VERSION, - condition: { - method: 'doWhatIWant', - returnValueTest: { - index: 0, - comparator: '>', - value: '100', - }, - chain: 5, - }, - }, - // condition with wrong method "method" and no contract address - { - version: ConditionExpression.VERSION, - condition: { - ...testTimeConditionObj, - method: 'doWhatIWant', - }, - }, - // rpc condition (no contract address) with disallowed method - { - version: ConditionExpression.VERSION, - condition: { - ...testRpcConditionObj, - method: 'isPolicyActive', - }, - }, - ])("can't determine condition type", (invalidCondition) => { - expect(() => { - ConditionExpression.fromObj(invalidCondition); - }).toThrow('unrecognized condition data'); - }); - it.each(['_invalid_condition_type_', undefined as unknown as string])( 'rejects an invalid condition type', (invalidConditionType) => {