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

feat(mainnet): add gov: collective, membership, motion #448

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

peterwht
Copy link
Collaborator

@peterwht peterwht commented Jan 23, 2025

[This is a spike and an incomplete PR. But the governance is implemented and can be used]

Adds a Council based governance that:

  • Has NO elections (selected councillors, to start)
  • Uses pallet-motion to allow council to use Root origin

To familiarize yourself with this governance mechanism, please use the following guide.

Guide

Goal Checklist

  • Create a Motion that requires Root
    • Vote on Motion
    • Execute Motion
  • Create a Motion that adds a member
    • Vote on Motion
    • Execute Motion
  • Create a Motion that removes a member
    • Vote on Motion
    • Execute Motion

Create a Motion that requires Root

  1. Launch chain pop up parachain -f networks/mainnet.toml
  2. Navigate to Council page and note Members
  3. Navigate to sub-page for Motions
  4. Press "Propose Motion"
  5. Min threshold is currently 1/2 + 1. I recommend setting threshold to 4 (unanimous)
  6. Set the proposal call to motion.unanimous, providing Root origin
  7. Set the sub-call to something that requires Root. One recommendation is to use balances.forceSetBalance
  8. You will see a council.Proposed event
  9. On the Motions page you will see a new Motion available for vote, along with proposal info
  10. Press the Vote button and vote AYE. Repeat this with 4 dev accounts
  11. After the threshold is surpassed, the Vote button now changes to Close. Press this button and submit. The proposal is now passed! You will see several events such as council.voted, council.Approved, council.Executed

Screenshot 2025-01-23 at 10 10 07 AM

Create a Motion that adds a member

  1. Navigate to the Motions page
  2. Press Propose motion
  3. Set threshold 4 (more realistic)
  4. Select councilMembership.addMember for proposal (we do NOT need to use pallet-motion for this). Note, do not use council to set members.
  5. Add Eve or Ferdie (or other as you please)
  6. Press Propose
  7. Go through the voting process and execute the proposal
  8. Wait a bit and refresh the council page. You should now see a new member added that can propose motions and vote.

Screenshot 2025-01-23 at 10 16 46 AM

Create a Motion that removes a member

  1. Navigate to the Motions page
  2. Press Propose motion
  3. Set threshold 4 (more realistic)
  4. Select councilMembership.removeMember for proposal (we do NOT need to use pallet-motion for this). Note, do not use council to set members.
  5. Add Eve or Ferdie (or other as you please)
  6. Press Propose
  7. Go through the voting process and execute the proposal
  8. Wait a bit and refresh the council page. You should now see one less member.

Notes

  • One important thing to confirm for ANY governance we choose: do we have to pay DOT to propose a runtime upgrade. This can be costly if so.

@@ -189,7 +189,7 @@ pub fn mainnet_chain_spec(relay: Relay) -> MainnetChainSpec {
)
.with_name("Pop Network")
.with_id("pop")
.with_chain_type(ChainType::Live)
.with_chain_type(ChainType::Development)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

temporary change for better dev account support.

}

impl pallet_membership::Config<pallet_membership::Instance1> for Runtime {
type AddOrigin = MoreThanHalfCouncil;
Copy link
Collaborator Author

@peterwht peterwht Jan 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

recommend we make several of these configs Super Majority (2/3 or 3/4). We can't do unanimous for removing members as the removed member probably wouldn't vote AYE.

Comment on lines +56 to +59
type SimpleMajorityOrigin =
pallet_collective::EnsureProportionMoreThan<AccountId, CouncilCollective, 1, 2>;
type SuperMajorityOrigin =
pallet_collective::EnsureProportionAtLeast<AccountId, CouncilCollective, 2, 3>;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

recommend we remove these two origins and force unanimous if we want to use Root.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes sense to me.

@peterwht
Copy link
Collaborator Author

[sc-2571]

@al3mart
Copy link
Collaborator

al3mart commented Jan 24, 2025

image

Polakdot js apps seems to crash after inputting an external motion 😓 with the expectation of pallet_democracy being present ?

For the record the call I noted as a preimage was balances.forceSetBalance.

I'd assume this is expected as the runtime doesn't feature a way for non council members to cast votes. I think the app will have just wrapped the noted call as a democracy call.
Though is just ugly that the app presents that message.

Copy link
Collaborator

@al3mart al3mart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The inclusion of these seemed like a sensible choice. Provides a little better UX for the accounts voting on the motions.

Also seems more flexible looking ahead.

}

impl pallet_membership::Config<pallet_membership::Instance1> for Runtime {
type AddOrigin = MoreThanHalfCouncil;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems that AddOrigin should be configured to be unanimous.

type MaxMembers = CouncilMaxMembers;
type MembershipChanged = Council;
type MembershipInitialized = Council;
type PrimeOrigin = MoreThanHalfCouncil;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PrimeOrigin should be configured to the closest ratio equivalent to all votes in favor but one.

type MembershipChanged = Council;
type MembershipInitialized = Council;
type PrimeOrigin = MoreThanHalfCouncil;
type RemoveOrigin = MoreThanHalfCouncil;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

type MembershipInitialized = Council;
type PrimeOrigin = MoreThanHalfCouncil;
type RemoveOrigin = MoreThanHalfCouncil;
type ResetOrigin = MoreThanHalfCouncil;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like it should be either unanimous or the same as the above ones.

type RemoveOrigin = MoreThanHalfCouncil;
type ResetOrigin = MoreThanHalfCouncil;
type RuntimeEvent = RuntimeEvent;
type SwapOrigin = MoreThanHalfCouncil;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Super majority or a ratio equivalent to all votes in favor but one seems to fit this origin.

@peterwht peterwht changed the base branch from main to al3mart/refactor-mainnet-governance January 24, 2025 17:44
@peterwht peterwht changed the base branch from al3mart/refactor-mainnet-governance to main January 24, 2025 17:44
@peterwht
Copy link
Collaborator Author

[sc-2200]

@AlexD10S
Copy link
Collaborator

The step-by-step guide in the PR description is great. I've been testing and looks good 👌

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