diff --git a/src/agents/coordinator.ts b/src/agents/coordinator.ts index 28ed866cc..3f480e698 100644 --- a/src/agents/coordinator.ts +++ b/src/agents/coordinator.ts @@ -120,8 +120,8 @@ export class DkgCoordinatorAgent { const Coordinator = await this.connectReadOnly(provider); const dkgPublicKeyBytes = dkgPublicKey.toBytes(); const pointStruct: BLS12381.G1PointStruct = { - word0: dkgPublicKeyBytes.slice(0, 16), - word1: dkgPublicKeyBytes.slice(16, 32), + word0: dkgPublicKeyBytes.slice(0, 32), + word1: dkgPublicKeyBytes.slice(32, 48), }; return await Coordinator.getRitualIdFromPublicKey(pointStruct); } diff --git a/src/conditions/context/context.ts b/src/conditions/context/context.ts index 0b64cad90..feeeb257c 100644 --- a/src/conditions/context/context.ts +++ b/src/conditions/context/context.ts @@ -51,7 +51,7 @@ export class ConditionContext { ); if (conditionRequiresSigner && !this.signer) { throw new Error( - `Cannot use ${USER_ADDRESS_PARAM} as a parameter without a signer` + `Signer required to satisfy ${USER_ADDRESS_PARAM} context variable in condition` ); } diff --git a/test/unit/conditions/context.test.ts b/test/unit/conditions/context.test.ts index d87c6291a..dc629c7a5 100644 --- a/test/unit/conditions/context.test.ts +++ b/test/unit/conditions/context.test.ts @@ -91,6 +91,10 @@ describe('context parameters', () => { const condition = new ContractCondition(conditionObj); const conditionExpr = new ConditionExpression(condition); expect(conditionExpr.contextRequiresSigner()).toBe(true); + expect(conditionExpr.buildContext(provider, {}, signer)).toBeDefined(); + expect(() => conditionExpr.buildContext(provider, {})).toThrow( + `Signer required to satisfy ${USER_ADDRESS_PARAM} context variable in condition` + ); }); it('detects if a signer is not required', () => { @@ -100,6 +104,8 @@ describe('context parameters', () => { false ); expect(conditionExpr.contextRequiresSigner()).toBe(false); + expect(conditionExpr.buildContext(provider, {}, signer)).toBeDefined(); + expect(conditionExpr.buildContext(provider, {})).toBeDefined(); }); it('rejects on a missing signer', () => { @@ -114,7 +120,7 @@ describe('context parameters', () => { const conditionExpr = new ConditionExpression(condition); expect(conditionExpr.contextRequiresSigner()).toBe(true); expect(() => conditionExpr.buildContext(provider, {}, undefined)).toThrow( - `Cannot use ${USER_ADDRESS_PARAM} as a parameter without a signer` + `Signer required to satisfy ${USER_ADDRESS_PARAM} context variable in condition` ); });