Skip to content

Fix inability to use contract clients with multisig signers - #713

Open
0xSY3 wants to merge 1 commit into
Concordium:release/p11from
0xSY3:fix/contract-client-multisig
Open

0xSY3 wants to merge 1 commit into
Concordium:release/p11from
0xSY3:fix/contract-client-multisig

Conversation

@0xSY3

@0xSY3 0xSY3 commented Nov 14, 2026

Copy link
Copy Markdown

Purpose

Since 12.0.0, the contract clients cannot be used with a signer that produces more than one signature (several keys on one credential, or several credentials). The call fails before anything is sent:

Too many sender signatures added to the transaction. Counted 2, but transaction specifies 1 allowed number of signatures.

sendUpdateTransaction in GenericContract.ts and ModuleClient.createAndSendInitTransaction build the transaction with the default of one signature and then sign with the supplied AccountSigner. Up to 11.1.1 both went through signTransaction, which handled any number of signatures.

This affects Contract, CIS2Contract, CIS3Contract, CIS4Contract, and the clients generated by @concordium/ccd-js-gen, since all of them route through these two functions.

#679 fixed the same problem for Token and Lock. These two call sites follow the same pattern and were not covered there.

Changes

  • packages/sdk/src/GenericContract.ts and packages/sdk/src/types/ModuleClient.ts: declare the signer's signature count with .addMultiSig(signer.getSignatureCount()) before building, the same way Token and Lock do.
  • packages/sdk/test/ci/GenericContract.test.ts and packages/sdk/test/ci/types/ModuleClient.test.ts: new tests for contract update and contract init, each with a signer holding one key, two keys on one credential, and one key on each of two credentials.
  • packages/sdk/CHANGELOG.md: entry under Unreleased.

Testing

New tests against the unmodified source, 4 of 6 fail (the single-key cases pass):

● createAndSendUpdateTransaction › submits a signature for every key of a signer with one credential with two keys
  Too many sender signatures added to the transaction. Counted 2, but transaction specifies 1 allowed number of signatures.
● createAndSendUpdateTransaction › submits a signature for every key of a signer with two credentials with one key each
  Too many sender signatures added to the transaction. Counted 2, but transaction specifies 1 allowed number of signatures.
● createAndSendInitTransaction › submits a signature for every key of a signer with one credential with two keys
  Too many sender signatures added to the transaction. Counted 2, but transaction specifies 1 allowed number of signatures.
● createAndSendInitTransaction › submits a signature for every key of a signer with two credentials with one key each
  Too many sender signatures added to the transaction. Counted 2, but transaction specifies 1 allowed number of signatures.
Tests:       4 failed, 2 passed, 6 total

With the fix all 6 pass.

In packages/sdk:

  • yarn test ./test/ci, yarn test-rn ./test/ci and yarn test-web ./test/ci: 54 suites, 749 tests pass in each configuration.
  • yarn typecheck, yarn lint and yarn fmt-check pass.

Notes

  • I targeted release/p11 because that is where Fix inability to use Lock/Token with multisig signers #679 landed. main has the same two call sites, and Token.sendRaw there is also still without the fix, so 12.x is affected as released. I can retarget, or open a separate PR against main, whichever you prefer.

Checklist

  • My code follows the style of this project.
  • The code compiles without warnings.
  • I have performed a self-review of the changes.
  • I have documented my code, in particular the intent of the
    hard-to-understand areas.
  • (If necessary) I have updated the CHANGELOG.

CLA acceptance

By submitting the contribution I accept the terms and conditions of the
Contributor License Agreement v1.0

`sendUpdateTransaction` and `ModuleClient.createAndSendInitTransaction` built the transaction with the
default of one signature before signing, so any signer producing more than one signature failed with
"Too many sender signatures added to the transaction". Declare the signer's signature count on the
transaction, as already done for `Token` and `Lock`.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant