ava-labs / avalanchego

Go implementation of an Avalanche node.
https://avax.network
BSD 3-Clause "New" or "Revised" License
2.14k stars 675 forks source link

Proposal to change Avalanche Multisig logic #888

Open ramilexe opened 3 years ago

ramilexe commented 3 years ago

Intro:

We are working on implementing distributed multisig for Avalanche. Existing multisig example works when all private keys presented in single KeyChain. In our fork we implemented two methods: signTxPartially and composeSignature to allow multisig holders to sign transaction separately and then compose it all together (at some relayer) and broadcast to the Avalanche Network.

The problem:

Avalanche Multisig requires to know exact number and addresses of holders who will participate in the signing of the transaction.

Example 1:

Transaction with 3 multisig users and 2 threshold. In case we submit tx with 3 signature we get error input has more signers than expected

Example 2:

Transaction with 3 multisig users (A, B, C) and 2 threshold. To be able to sign it distributed way each user needs to know exact another user who will participate in operation.

Possible solultion:

Each user will generate all possible combinations of signatures:

Proposal

  1. Remove validation if the number of signatures is more than the threshold
    case out.Threshold < uint32(numSigs):
        return errTooManySigners
  2. Remove validation to exactly match the number of requested sigs and number of sigs in credential:
    case numSigs != len(cred.Sigs):
        return errInputCredentialSignersMismatch

It allows to add all multisig addresses to Input and doesn't care about matching to exact numbers.

Discussing or question are welcome.

github-actions[bot] commented 1 year ago

This issue has become stale because it has been open 60 days with no activity. Adding the lifecycle/frozen label will cause this issue to ignore lifecycle events.