Skip to content

MESH-2006 multisig improvements part 1#1687

Merged
Neopallium merged 18 commits intodevelopfrom
MESH-1955-multisig-improvements
Aug 15, 2024
Merged

MESH-2006 multisig improvements part 1#1687
Neopallium merged 18 commits intodevelopfrom
MESH-1955-multisig-improvements

Conversation

@Neopallium
Copy link
Copy Markdown
Contributor

@Neopallium Neopallium commented Jul 4, 2024

changelog

new features

  • Execute MultiSig proposal at the same time as the last required approval. No longer uses the scheduler to execute the proposal in the next block.
  • Convert the multisig pallet to frame v2.
  • A Multisig can be made a secondary key with custom permissions (if called by the primary key).
  • A Multisig can add/remove multiple singers in a single proposal now with multisig.add_multisig_signers and multisig.remove_multisig_signers.
  • Remove most of the Bridge code (extrinsics, events, errors). Only keeping the storage.
  • Use manual pallet index values, to avoid breaking pallet ids when adding/removing pallets. Also this makes sure that all runtimes use the same pallet indices.
  • Prune proposals when they are executed or rejected.
  • Limit the total number of signers per multisig to 50.
  • Split multisig CreatorDid into AdminDid and PayingDid.
  • A multisig can add an admin DID to enable the *_via_admin controls.
  • A multisig can remove it's admin to disable the *_via_admin controls. The admin DID can also remove itself as the admin of a multisig.
  • A multisig can remove it's paying DID to pay for its own transaction/protocol fees.
  • A multisig unlinked from an identity (via identity.leave_identity_as_key) and join a new identity using multisig.approve_join_identity and the transaction fees will be paid by the primary key of the joining identity.
  • A multisig can't be a signer on another multisig.

modified external API

  • Remove Multisig.create_or_approve_proposal
  • Remove storage Multisig.ProposalIds since we don't lookup proposal ids from the proposal call.
  • Renamed storage Multisig.MultiSigTxDone to Multisig.NextProposalId.
  • Removed the bridge pallet extrinsics, events and errors.
  • Removed deprecated *_as_identity MultiSig extrinsic calls.
  • Removed the suffix _as_key from all MultiSig extrinsics.
  • Changed MultiSig storage MultiSigSigners type from Signatory<AccountId> to just AccountId.
  • Replaced all Signatory<AccountId> type with AccountId in the MutliSig pallet's events, storage and extrinsics.
  • Removed field auto_close from the ProposalDetails type (and ProposalDetail storage).
  • Refactor the ProposalDetail storage into two storage items ProposalVoteCounts and ProposalStates. ProposalVoteCounts only stores the approval/rejection vote counts. ProposalStates only store the state and expirey.
  • Change the key hasher of the Proposal value in double map MultiSig.ProposalIds from Blake2_128Concat to Blake2_128.
  • multisig.make_multisig_secondary take an optional set of permissions. Only the creator's primary key can set custom permissions.
  • multisig.add_multisig_signer has been replaced with multisig.add_multisig_signers to allow adding multiple signers.
  • multisig.remove_multisig_signer has been replaced with multisig.remove_multisig_signers to allow removing multiple signers.
  • Use BoundedVec<AccountId, T::MaxSigners> for signers list when creating/adding/removing multisig signers. Multisigs can still have more than T::MaxSigners, the limit is just used for a single call.
  • Added an multisig proposal execution reentry guard to prevent nested proposal executions.
  • Remove Multisig extrinsics *_via_creator to *_via_admin.
  • Multisig storage CreatorDid renamed to AdminDid.
  • Added Multisig storage PayingDid to hold the identity that pays transaction fees.
  • When creating a new MultiSig the calling DID is set as the PayingDid by default, but doesn't have admin controls.
  • create_multisig now adds the new multisig to the caller's identity as a secondary key. By default the multisig will have no permissions unless the caller is the primary key and has provided custom permissions.
  • Removed multisig make_multisig_primary, make_multisig_secondary and remove_creator_controls extrinsics.
  • Replaced remove_creator_controls with remove_admin_via_admin extrinsic.
  • Remove storage CurrentDid from identity pallet. This value was only set during a transaction and cleared when the transaction finished (even on errors).

new external API

  • multisig.add_admin(identity) callable by the multisig to add an identity as admin.
  • multisig.remove_admin_via_admin(multisig) callable by the admin to remove itself as admin of a multisig.
  • multisig.remove_payer() callable by the multisig to remove the paying identity. The multisig will need to pay for its own transaction/protocol fees.
  • multisig.remove_payer_via_payer(multisig) callable by the paying identity to remove itself as the payer of fees for the multisig.
  • multisig.approve_join_identity(auth_id) callable by multisig signers to approve joining a new identity. The primary key of the joining identity will pay for transaction fees.
  • multisig.join_identity(auth_id) this is called by the proposal created in approve_join_identity to accept a join identity authorization.
  • Added storage AuthToProposalId used by multisig.approve_join_identity to map an auth_id to proposal_id.

modified events

  • Renamed MultiSig event MultiSigSignaturesRequiredChanged to MultiSigSignersRequiredChanged.
  • The multisig events now use struct variants instead of tuple variants.
  • MultiSig.ProposalExecuted event is now emitted for both successful and failed executions. The result field is used to see if the execution failed and get the error.
  • MultiSig.ProposalFailedToExecute has been removed, since the error is available in the ProposalExecuted event.
  • Renamed MultiSigSignerAuthorized to MultiSigSignersAuthorized and change the signer field to signers as a bounded vec. Now only one event is emitted when adding multiple signers.
  • Renamed MultiSigSignerRemoved to MultiSigSignersRemoved and change the signer field to signers as a bounded vec. Now only one event is emitted when removing multiple signers.
  • The caller_did is now optional for multisig events: ProposalAdded, ProposalExecuted, MultiSigSignersRequiredChanged, ProposalApprovalVote, ProposalRejectionVote, ProposalApproved, and ProposalRejected. Since the multisig could be unlinked from an identity when those events are emitted.
  • Changed the caller's DID to be optional in the following committee events: FinalVotes, Approved, Rejected, and Executed.
  • Removed the caller's DID from committee event: ReleaseCoordinatorUpdated.

new events

  • Add MultiSig.ProposalApprovalVote event to signal an approval vote instead of event ProposalApproved. The ProposalApproved event is now only emitted when the proposal has received enough votes to be executed.
  • New multisig events: MultiSigAddedAdmin, MultiSigRemovedAdmin, and MultiSigRemovedPayingDid.

other

  • Remove internal Context::current_identity* API.

data migration

  • Migration to remove old MultiSig.ProposalDetail storage.
  • Migrate MultiSig signers storage from Signatory type.
  • Migrate renamed storage MultiSigToIdentity.
  • Migrate Multisig MultiSigTxDone to NextProposalId.
  • Removed storage Multisig.LostCreatorPrivileges.
  • Migrate Multisig.CreatorDid to Multisig.PayingDid and Multisig.AdminDid (only if LostCreatorPrivileges hasn't been set).

@Neopallium Neopallium changed the base branch from develop to improve_rust_integration_tests July 4, 2024 07:58
@Neopallium Neopallium changed the title [WIP] Mesh 1955 multisig improvements Mesh 1955 multisig improvements part 1 Jul 16, 2024
@Neopallium Neopallium changed the title Mesh 1955 multisig improvements part 1 [WIP] Mesh 1955 multisig improvements part 1 Jul 16, 2024
@Neopallium Neopallium changed the title [WIP] Mesh 1955 multisig improvements part 1 Mesh 1955 multisig improvements part 1 Jul 16, 2024
@Neopallium Neopallium changed the title Mesh 1955 multisig improvements part 1 Mesh 2006 multisig improvements part 1 Jul 23, 2024
@Neopallium Neopallium changed the title Mesh 2006 multisig improvements part 1 MESH-2006 multisig improvements part 1 Jul 23, 2024
Base automatically changed from improve_rust_integration_tests to develop July 28, 2024 10:09
@Neopallium Neopallium force-pushed the MESH-1955-multisig-improvements branch from 69d8dd7 to a4740dd Compare July 30, 2024 12:59
@Neopallium
Copy link
Copy Markdown
Contributor Author

Rebased to develop.

@Neopallium Neopallium force-pushed the MESH-1955-multisig-improvements branch from a4740dd to c0e77f6 Compare July 31, 2024 10:40
@Neopallium Neopallium force-pushed the MESH-1955-multisig-improvements branch from 423e9ae to fa4ccd8 Compare August 13, 2024 14:10
* Refactor ProposalDetails and ProposalStatus.

* Convert multisig pallet to frame v2.

* Refactor Multisig events.

* Don't use Concat based hashing on the Proposal in storage map ProposalIds.

* Don't use Context::current_identity in multisig pallet.  Use the MS's linked DID or it's creator DID.

* Fix bridge controller's CreatorDID.

* Allow a primary key to use custom permissions when making a multisig a secondary key.

* Add tests for 'make_multisig_secondary'.

* Support adding/removing multiple MS signers.

* Emit one event when adding/removing many signers.

* Add execution reentry guard to multisig proposal execution.

* Fix benchmark for approve and create_proposal.

* Use bounded vec for multisig signers.

* Fix multisig unit tests.

* Make MaxSigners a constant in the metadata.
* Remove Bridge extrinsics, events, errors.  Only keep the storage.

* MESH-2006 multisig improvements part 3 (#1693)

* Remove multisig.create_or_approve_proposal extrinsic and multisig.ProposalIds storage.

* Prune multisig proposal when it is executed/rejected.

* Rename MultiSigTxDone to NextProposalId.
@Neopallium Neopallium force-pushed the MESH-1955-multisig-improvements branch from 72d94dd to 1c76b51 Compare August 14, 2024 14:32
* Rename MS creator to admin and add paying DID support.

* Split a long running test into smaller tests.

* Restrict the total number of signers on a multisig.

* Always use the Multisig's DID for adding new signers.

* Multisig nesting is not allowed.

* Fix test build.

* Allow a multisig to remove it's paying DID to pay their own fees.

* Add join identity support to MultiSig.

* The approve_join_identity call is paid by the joining DIDs primary key.

* Add some missing events.

* Use wasm based weights.

* Add tests for remove_payer.

* Remove use of Context::current_identity (#1698)

* Remove use of Context::current_identity

* Add some more TODOs.

* Remove Context::set_current_identity() calls from unit tests.

* Remove some more current_identity from unit tests.

* Use controller not stash for Unbonded event.

* Fix remove_authorization for unlinked keys.

* Use GC_DID in treasury event.

* Lint fix.

* Finish TODOs.

* Remove all Context::current_identity code.

* Remove identity CurrentDid storage.
@Neopallium Neopallium merged commit a80bebd into develop Aug 15, 2024
@Neopallium Neopallium deleted the MESH-1955-multisig-improvements branch August 15, 2024 14:54
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.

3 participants