Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support multiple multisigs creation with same set of threshold and signatories #786

Open
3 of 10 tasks
chungquantin opened this issue Mar 8, 2024 · 0 comments
Open
3 of 10 tasks
Labels
P4 - Needs Investigation Requires analysis to determine cause or feasibility. Not fully understood, needs research first.

Comments

@chungquantin
Copy link

  • Bug report
  • Feature request
  • Support request
  • Other
  • What is the current behavior and expected behavior?

My team stores fund on multisigs on Polkadot and use this feature frequently. And I notice there is an odd design in the deterministic multisig private key generation. Because the generated key is deterministic and is a computation outcome of the provided signatories and threshold, one set of signatories and theshold could not own more than one multisigs due to the mentioned mechanism.

  • What is the motivation for changing the behavior?

Due to my understanding of the addMultisig method, by receiving the meta information which are list of signatories and theshold, new address can be generated. Wonder if we can add another parameter in the meta object called ID or nonce which is sequential or random. Hence, same set of parameters can produce different value of multisig address.

I also added another issue in polkadot-sdk because I am not sure if this issue can be resolved on the application level or need to update the pallet multisig: paritytech/polkadot-sdk#3618

/// File location: https://github.dev/polkadot-js/ui/tree/master/packages/ui-keyring/src
public addMultisig (addresses: (string | Uint8Array)[], threshold: bigint | BN | number, meta: KeyringPair$Meta = {}): CreateResult {
    let address = createKeyMulti(addresses, threshold);

    // For Ethereum chains, the first 20 bytes of the hash indicates the actual address
    // Testcases via creation and on-chain events:
    // -  input: 0x7a1671a0224c8927b08f978027d586ab6868de0d31bb5bc956b625ced2ab18c4
    // - output: 0x7a1671a0224c8927b08f978027d586ab6868de0d
    if (this.isEthereum) {
      address = address.slice(0, 20);
    }

    // we could use `sortAddresses`, but rather use internal encode/decode so we are 100%
    const who = u8aSorted(
      addresses.map((who) => this.decodeAddress(who))
    ).map((who) => this.encodeAddress(who));

    return this.addExternal(address, objectSpread<KeyringPair$Meta>({}, meta, { isMultisig: true, threshold: bnToBn(threshold).toNumber(), who }));
}
  • Please tell us about your environment:
  • Version: Unknown

  • Environment:

    • Node.js
    • Browser
    • Other (limited support for other environments)
  • Language:

    • JavaScript
    • TypeScript (include tsc --version)
    • Other
@TarikGul TarikGul moved this to P4 - Needs Investigation in Polkadot-js general project board Oct 30, 2024
@TarikGul TarikGul added the P4 - Needs Investigation Requires analysis to determine cause or feasibility. Not fully understood, needs research first. label Oct 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P4 - Needs Investigation Requires analysis to determine cause or feasibility. Not fully understood, needs research first.
Projects
Status: P4 - Needs Investigation
Development

No branches or pull requests

2 participants