Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Alliance: Replace init_members with force_set_members #11928

Closed
joepetrowski opened this issue Jul 28, 2022 · 3 comments · Fixed by #11997
Closed

Alliance: Replace init_members with force_set_members #11928

joepetrowski opened this issue Jul 28, 2022 · 3 comments · Fixed by #11997
Assignees
Labels
J0-enhancement An additional feature request. U2-some_time_soon Issue is worth doing soon. Z1-easy Can be fixed primarily by duplicating and adapting code by an intermediate coder Z6-mentor An easy task where a mentor is available. Please indicate in the issue who the mentor could be.

Comments

@joepetrowski
Copy link
Contributor

joepetrowski commented Jul 28, 2022

The Alliance pallet's init_members function is a root call with a check that only allows it to be called if there are no members yet. This makes the logic simpler, but Root should always have the ability to change the membership of the Alliance.

The function signature should be the same, but force_set_members would remove all current members and set each role according to the supplied parameters. If the call contains no members at all, it should clean up all storage items in the pallet, effectively disbanding the Alliance and removing their Rule and UnscrupulousList.

@joepetrowski joepetrowski added J0-enhancement An additional feature request. U2-some_time_soon Issue is worth doing soon. Z6-mentor An easy task where a mentor is available. Please indicate in the issue who the mentor could be. Z1-easy Can be fixed primarily by duplicating and adapting code by an intermediate coder labels Jul 28, 2022
@muharem muharem self-assigned this Jul 28, 2022
@muharem
Copy link
Contributor

muharem commented Jul 29, 2022

@joepetrowski is this something you proposing?

can be simplified if we don't allow empty founders && fellows

force_set_members (founders, fellows, allies)
   if is_initialized && (founders.not_empty || fellows.not_empty)
       clean_members
       // new Alliance will have to clean up everything manually if needed
   if is_initialized && founders.empty && fellows.empty
       clean_all_items
       clean_members
       return
   set_members


set_members
    // current impl of set_members

clean_members
     retire all current_founders // return deposit if exist
     retire all current_fellows // return deposit if exist
     retire all current_allies // return deposit if exist
     remove collectives_remove_members // founders and fellows

clean_all_items
    remove rule
    remove announcements
    remove unscrupulous_accounts
    remove unscrupulous_websites
    remove up_for_kicking 
    loop get all collectives_proposals
        remove proposal // not close

@joepetrowski
Copy link
Contributor Author

joepetrowski commented Jul 29, 2022

Yeah, that is what I had in mind.

can be simplified if we don't allow empty founders && fellows

I agree, and we could add another Root call, force_disband_alliance that takes no args and just clears everything, slashing any remaining members. (Or it could take one arg, slash: bool.*) This would be the ultimate expression of the network's dissatisfaction with the Alliance.

So then we could require that force_set_members actually includes some founders or fellows, and it just replaces the current membership with the new set. Then yeah, it'd be up to the new Alliance to clean up/modify any old storage items that the old one left behind.


/* just bool for brevity in the para, probably something like this makes more sense:

enum HandleDeposit {
    Slash,
    Refund,
}

fn force_disband_alliance(member_deposit: HandleDeposit) { ... }

@muharem
Copy link
Contributor

muharem commented Jul 29, 2022

Then we need one more method to remove proposal, currently there is only close (which executes it if its voted).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
J0-enhancement An additional feature request. U2-some_time_soon Issue is worth doing soon. Z1-easy Can be fixed primarily by duplicating and adapting code by an intermediate coder Z6-mentor An easy task where a mentor is available. Please indicate in the issue who the mentor could be.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants