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

[Communities] Governance for communities #337

Merged
merged 48 commits into from
Apr 4, 2024
Merged

Conversation

pandres95
Copy link
Member

@pandres95 pandres95 commented Jan 26, 2024

Implements the multi-governance for communities:

This implementation exposes the following methods

  • set_decision_method: allows a community management origin to set which is the decision method for a community.
    Limitations

    • This value is not synced-up with Tracks, since there's no easy way to retrieve the OriginCaller used on track_of having the TrackId. Instead, the sync-up must be made manually using the appropriate calls (probably using a Root origin).
  • vote: Let a community member cast a vote for a poll opened on a track corresponding to the community.
    Limitations

    • This design considers only one track per community. For future implementations, the design should consider a structure that allows vote track the community_id derived from the membership_id and the poll class to be compared (maybe, restricting to Class = Into<T::CommunityId>).
    • When using Vote::AssetBalance, funds are held, making them effectively unusable on other applications.

    Caveats

    • To solve the issue of changing the vote over time when using Vote::AssetBalance, I needed to first release the hold, then hold the new amount. This is a bit more resource-intensive and may be punished on benchmarks. A permanent solution implies implementing InspectFreeze and MutateFreeze on pallet-assets. I can work on that as a separate PR to upstream on polkadot-sdk.
    • For Vote::Rank we have to manually sum for ranks of all members to get the max possible rank sum, and implement the concept of vote_multiplication. These implementations might change over time, as strategies to calculate vote multiplications for ranks can vary between communities.
    • For Vote::Membership we have to manually count for memberships in each community, as there's not a method for that on membership::Inspect. This implied storing MembershipsCount and mutating values on add_member/remove_member.
    • Vote::NativeBalance uses RuntimeHoldReason as FreezeId, something that requires to be set on pallet-balances as such. While unusual, this allows for maximum code reusability. If there's a need to handle it differently, we'll need to discuss in the scope of this PR.
  • remote_vote: allows for removing a vote, on a poll that's ongoing.

  • unlock: allows for releasing funds for a vote casted on a poll that's not ongoing (either cancelled or finished).

@pandres95 pandres95 self-assigned this Jan 26, 2024
@pandres95 pandres95 added the enhancement New feature or request label Jan 26, 2024
@pandres95 pandres95 marked this pull request as draft January 26, 2024 15:44
@pandres95 pandres95 force-pushed the pallet-communities-voting branch 2 times, most recently from b9c4706 to 0c93134 Compare February 2, 2024 04:25
@pandres95 pandres95 force-pushed the pallet-communities-voting branch 2 times, most recently from b13b235 to 351c07b Compare February 3, 2024 06:30
@pandres95 pandres95 marked this pull request as ready for review February 3, 2024 06:30
@pandres95 pandres95 force-pushed the pallet-communities-voting branch 3 times, most recently from d23bd2c to 8cf64da Compare March 9, 2024 12:29
@pandres95 pandres95 force-pushed the pallet-communities-voting branch 6 times, most recently from e70b76c to e49aa5b Compare March 17, 2024 23:04
@pandres95 pandres95 force-pushed the pallet-communities-voting branch from a5a5d48 to 330b281 Compare March 21, 2024 17:19
@pandres95 pandres95 force-pushed the pallet-communities-voting branch from 6696b13 to 9158bee Compare March 29, 2024 23:47
pandres95 and others added 12 commits March 29, 2024 19:52
- adjust parameters to calculate more realistic benchmarking scenarios
- fix: missing deposit balance for collection owners
… for the decision method of a community on benchmarking
* [ci] calculate weights

* change(pallet-communities): weights sanity checks

* fix(pallet-communities): on mock, adjust scheduler weight, to make sure passes scheduling add_member tests with more realistic values.

* fix(pallet-communities): adjust governance tests since more scheduled tasks are allowed per block in mock

---------

Co-authored-by: pandres95 <2502577+pandres95@users.noreply.github.com>
Co-authored-by: Pablo Andrés Dorado Suárez <hola@pablodorado.com>
@olanod olanod force-pushed the pallet-communities-voting branch from 328e540 to bef99b3 Compare April 2, 2024 08:47
@olanod olanod force-pushed the pallet-communities-voting branch from 40c0be9 to 6769f83 Compare April 4, 2024 18:55
@olanod olanod force-pushed the pallet-communities-voting branch from 3d72796 to e0a4bac Compare April 4, 2024 22:37
@olanod olanod merged commit 354d8b4 into master Apr 4, 2024
1 check failed
@olanod olanod deleted the pallet-communities-voting branch April 4, 2024 22:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
No open projects
Status: Under Review
Development

Successfully merging this pull request may close these issues.

2 participants