Skip to content
Unverified Commit cdceee24 authored by Gavin Wood's avatar Gavin Wood Committed by GitHub
Browse files

Society pallet (#4170)



* Introduce efficient Hash-based RNG streamer

* Initial draft of the society module

* Introduce a test

* Dual-pot logic

* Vouching

* Use chacha

* Half way through moving to cliff payout.

* Fixes

* Add some tests

* Remove printlns

* Merge remote-tracking branch 'origin/gav-verified-id' into gav-verified-id

# Conflicts:
#	frame/identity/src/lib.rs

* Merge remote-tracking branch 'origin/gav-verified-id' into gav-verified-id

# Conflicts:
#	frame/identity/src/lib.rs

* Fix `slash_payout`, add test

* Test for multi-slash_payout

* Add docs to `put_bid` function and `bidding_works` test

* Add strikes to test

* Add comments to `rotate_period`

* Implement `suspend_member`

* Off chain iteration of suspended members using linked_map

* Half of suspended candidate

* Finish suspend_candidate, need tests

* Resolve mistakes and feedback, add `suspended_candidate_rejected` test

* Remove logic which increases payout time after un-suspension

* Fix error in `slash_suspended_candidates`, add member check to `vote`

* Fix vouch rewards, dont create zero payouts, add tests for vouch

* Test unvouch

* Unbid tests

* Add lifecycle events, fix `add_member` to update `MembershipChanged`

* Head cannot be removed from society

* Use `add_member` in `found` to ensure `MembershipChanged` is triggered

* Use `Judgement` enum for suspended candidate judgement

* Make society instantiable

* Implement challenges

* Remove extra text in test

* Remove `BlockNumber` return from `slash_payout`

* Add bad vote causes slash test

* Update frame/society/src/lib.rs

Co-Authored-By: default avatarthiolliere <[email protected]>

* Add consts to module metadata

* Check `suspended_member` cant bid

* Increase strength of payout check, **must** be a member.

* Start pallet documentation

* Finish docs

* Update library names, use decl_error

* Prevent double bids, add test

* Use `map` for vouching member, and introduce banned vouchers

* Remove leftover docs

* Vouching handles removed member lifecycles w/ tests

* `take` the votes when tallying, add comprehensive checks before vouch or bid

* Check votes are cleaned up

* Check vote is for a valid candidate, add vote event

* Defender vote event

* Fix `judge_suspended_candidate`, add weight docs

* First pass fixes (blank lines, formatting, no operational)

* Bump copyright year

* Make `add_member` infallible

* More feedback updates

* Add storage access complexity

* Fix logic for AutoUnbid

* Complete weight documentation

* Optimize logic which used to result in double storage read.

* Use Bid struct rather than tuple

* Introduce `MaxMembers` configuration constant

* Add comment about fringe scenario where `MaxMembers` could go over, NBD

* Change MaxMembership to configurable storage item with ability for root to update

* Make membership challenges skew toward failure.

If no one at all votes, or the vote is tied, the user will be suspended from society. This means, that the user simply needs to vote for themselves to stay in society assuming no one else participates.

* Refactor `is_candidate`as to avoid possible double storage reads in the future.

* Blank lines

Co-authored-by: default avatarShawn Tabrizi <[email protected]>
Co-authored-by: default avatarthiolliere <[email protected]>
parent 4ed0ad6f
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment