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/test/unit/conditions/context.test.ts b/test/unit/conditions/context.test.ts index d87c6291a..40c2bb2d4 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( + `Cannot use ${USER_ADDRESS_PARAM} as a parameter without a signer` + ); }); 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', () => {