This repository has been archived by the owner on Nov 15, 2023. It is now read-only.
Election Trait and Configurable Staking #5630
Labels
I7-refactor
Code needs refactoring.
Z3-substantial
Can be fixed by an experienced coder with a working knowledge of the codebase.
currently, staking is very much hard-coded to use
sp-phragmen
. It won't be trivial and will need a lot of code to be moved around, but ideally we should have a staking module which is independent of its underlying election and can be configured. Perhaps some chains would need simpler election mechanisms.The election trait should contain the bare minimum API, and should represent a multi-winner election:
An elect function will always
minimum_validaotr_count
).PerThing
.This is coming from the current phragmen definition, but as far as I can think of, any sane election should provide at least these two pieces of information as output.
Staking will henceforth only work with
Type Election: MultiWinnerElection<...>
.Some of the functionality that will probably be common between phragmen and any other election method that implements the above trait should be moved to
primitives/election
. This can be all the functions that work around theSupportMap
data structure and all the helper functions.Finally, the elect implementation with its tests can be decoupled from all the above and moved into a separate repo. No more
sp-phrgamen
will exist within substrate; just someTrait MultiWinnerElection
and some helpers around it.There are lots points of ambiguity here; for example where would the
equalise()
fit into this model. Before articulating more, I'd like some initial feedback if the main objective:is even worth pursuing.
The text was updated successfully, but these errors were encountered: