-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Abstracts elections-phragmen pallet to use NposSolver #12588
Conversation
dbe65b8
to
b714023
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks broadly good. Now we need to think about deployment: If we change the prefix of the pallet in construct_runtime!
, then the whole pallet storage needs to be moved to the new prefix name.
So I see a few action items:
- We should provide that migration script for simplicity.
- There should be a clear update note on the PR stating that any chain has two options:
- rename the pallet and run the migratin
- keep the old pallet prefix in
construct_runtime!
- we should put the appropriate labels on the PR to make sure it goes into the release notes.
- Would be good if we run this PR with
follow-chain
on a block that actually does a council election
and
a few housekeeping notes :D
- as per contribution guide, avoiding force-pushes is advised.
- label and project similarly advised
I think we should rename the pallet as well fwiw. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The main challenge now is how you will reflect this change in making kitchensink-runtime
compile, and next the polkadot companion.
Co-authored-by: Kian Paimani <[email protected]>
Co-authored-by: Kian Paimani <[email protected]>
Yes, was leaving that to the end. renaming now |
bot rebase |
Rebased |
…13431) * Refactors election provider support benchmarks outside its own crate --------- Co-authored-by: command-bot <>
bot rebase |
Branch is already up-to-date |
bot merge |
Error: Github API says paritytech/polkadot#6278 is not mergeable |
bot merge |
* Abstracts elections-phragmen pallet to use NposSolver * Update frame/elections-phragmen/src/lib.rs Co-authored-by: Kian Paimani <[email protected]> * Update frame/elections-phragmen/src/lib.rs Co-authored-by: Kian Paimani <[email protected]> * changes the name of the pallet; adds changelog * update changelog * Adds weight testing * Adds log macro_rules * renames elections-phragment dir to elections * weights rename * fixes typo in cargo toml * pre/post solve weight scafolding * refactor do_post_election * refactors into pre and post election solve for independent benchmarking * deconstructs PreElectionResults struct * updates benchmarking pre and post election solve; mock weights * Update frame/elections/src/lib.rs Co-authored-by: Kian Paimani <[email protected]> * Update frame/elections/src/lib.rs Co-authored-by: Kian Paimani <[email protected]> * addresses PR comments * adds pre_solve and post_sove weights * Adds comments on election pallet id param name change * ".git/.scripts/bench-bot.sh" pallet dev pallet_elections * Finishes pre-post solve weights * Update frame/elections/src/lib.rs Co-authored-by: Kian Paimani <[email protected]> * Update frame/elections/src/lib.rs Co-authored-by: Kian Paimani <[email protected]> * Addresses PR comments: no panic in on_init path; nits * Fixes node build * Implements approval voting to use as a `NposSolver` (paritytech#13367) * Implements the approval voting methods in sp_npos_elections * fmt * remove unecessary file * comment clarification * re-run weights * fix typo * updates MaxVoters in tests for integrity_tests to pass * Refactors election provider support benchmarks outside its own crate (paritytech#13431) * Refactors election provider support benchmarks outside its own crate --------- Co-authored-by: command-bot <> --------- Co-authored-by: Kian Paimani <[email protected]> Co-authored-by: parity-processbot <> Co-authored-by: Ross Bulat <[email protected]>
…tech#12588)" (paritytech#13451) This reverts commit 4be5dd2.
This pull request has been mentioned on Polkadot Forum. There might be relevant details there: https://forum.polkadot.network/t/mis-configuring-pallet-elections-phragmen/2502/1 |
* Abstracts elections-phragmen pallet to use NposSolver * Update frame/elections-phragmen/src/lib.rs Co-authored-by: Kian Paimani <[email protected]> * Update frame/elections-phragmen/src/lib.rs Co-authored-by: Kian Paimani <[email protected]> * changes the name of the pallet; adds changelog * update changelog * Adds weight testing * Adds log macro_rules * renames elections-phragment dir to elections * weights rename * fixes typo in cargo toml * pre/post solve weight scafolding * refactor do_post_election * refactors into pre and post election solve for independent benchmarking * deconstructs PreElectionResults struct * updates benchmarking pre and post election solve; mock weights * Update frame/elections/src/lib.rs Co-authored-by: Kian Paimani <[email protected]> * Update frame/elections/src/lib.rs Co-authored-by: Kian Paimani <[email protected]> * addresses PR comments * adds pre_solve and post_sove weights * Adds comments on election pallet id param name change * ".git/.scripts/bench-bot.sh" pallet dev pallet_elections * Finishes pre-post solve weights * Update frame/elections/src/lib.rs Co-authored-by: Kian Paimani <[email protected]> * Update frame/elections/src/lib.rs Co-authored-by: Kian Paimani <[email protected]> * Addresses PR comments: no panic in on_init path; nits * Fixes node build * Implements approval voting to use as a `NposSolver` (paritytech#13367) * Implements the approval voting methods in sp_npos_elections * fmt * remove unecessary file * comment clarification * re-run weights * fix typo * updates MaxVoters in tests for integrity_tests to pass * Refactors election provider support benchmarks outside its own crate (paritytech#13431) * Refactors election provider support benchmarks outside its own crate --------- Co-authored-by: command-bot <> --------- Co-authored-by: Kian Paimani <[email protected]> Co-authored-by: parity-processbot <> Co-authored-by: Ross Bulat <[email protected]>
…tech#12588)" (paritytech#13451) This reverts commit 4be5dd2.
* Abstracts elections-phragmen pallet to use NposSolver * Update frame/elections-phragmen/src/lib.rs Co-authored-by: Kian Paimani <[email protected]> * Update frame/elections-phragmen/src/lib.rs Co-authored-by: Kian Paimani <[email protected]> * changes the name of the pallet; adds changelog * update changelog * Adds weight testing * Adds log macro_rules * renames elections-phragment dir to elections * weights rename * fixes typo in cargo toml * pre/post solve weight scafolding * refactor do_post_election * refactors into pre and post election solve for independent benchmarking * deconstructs PreElectionResults struct * updates benchmarking pre and post election solve; mock weights * Update frame/elections/src/lib.rs Co-authored-by: Kian Paimani <[email protected]> * Update frame/elections/src/lib.rs Co-authored-by: Kian Paimani <[email protected]> * addresses PR comments * adds pre_solve and post_sove weights * Adds comments on election pallet id param name change * ".git/.scripts/bench-bot.sh" pallet dev pallet_elections * Finishes pre-post solve weights * Update frame/elections/src/lib.rs Co-authored-by: Kian Paimani <[email protected]> * Update frame/elections/src/lib.rs Co-authored-by: Kian Paimani <[email protected]> * Addresses PR comments: no panic in on_init path; nits * Fixes node build * Implements approval voting to use as a `NposSolver` (paritytech#13367) * Implements the approval voting methods in sp_npos_elections * fmt * remove unecessary file * comment clarification * re-run weights * fix typo * updates MaxVoters in tests for integrity_tests to pass * Refactors election provider support benchmarks outside its own crate (paritytech#13431) * Refactors election provider support benchmarks outside its own crate --------- Co-authored-by: command-bot <> --------- Co-authored-by: Kian Paimani <[email protected]> Co-authored-by: parity-processbot <> Co-authored-by: Ross Bulat <[email protected]>
…tech#12588)" (paritytech#13451) This reverts commit 4be5dd2.
* Abstracts elections-phragmen pallet to use NposSolver * Update frame/elections-phragmen/src/lib.rs Co-authored-by: Kian Paimani <[email protected]> * Update frame/elections-phragmen/src/lib.rs Co-authored-by: Kian Paimani <[email protected]> * changes the name of the pallet; adds changelog * update changelog * Adds weight testing * Adds log macro_rules * renames elections-phragment dir to elections * weights rename * fixes typo in cargo toml * pre/post solve weight scafolding * refactor do_post_election * refactors into pre and post election solve for independent benchmarking * deconstructs PreElectionResults struct * updates benchmarking pre and post election solve; mock weights * Update frame/elections/src/lib.rs Co-authored-by: Kian Paimani <[email protected]> * Update frame/elections/src/lib.rs Co-authored-by: Kian Paimani <[email protected]> * addresses PR comments * adds pre_solve and post_sove weights * Adds comments on election pallet id param name change * ".git/.scripts/bench-bot.sh" pallet dev pallet_elections * Finishes pre-post solve weights * Update frame/elections/src/lib.rs Co-authored-by: Kian Paimani <[email protected]> * Update frame/elections/src/lib.rs Co-authored-by: Kian Paimani <[email protected]> * Addresses PR comments: no panic in on_init path; nits * Fixes node build * Implements approval voting to use as a `NposSolver` (paritytech#13367) * Implements the approval voting methods in sp_npos_elections * fmt * remove unecessary file * comment clarification * re-run weights * fix typo * updates MaxVoters in tests for integrity_tests to pass * Refactors election provider support benchmarks outside its own crate (paritytech#13431) * Refactors election provider support benchmarks outside its own crate --------- Co-authored-by: command-bot <> --------- Co-authored-by: Kian Paimani <[email protected]> Co-authored-by: parity-processbot <> Co-authored-by: Ross Bulat <[email protected]>
…tech#12588)" (paritytech#13451) This reverts commit 4be5dd2.
* Abstracts elections-phragmen pallet to use NposSolver * Update frame/elections-phragmen/src/lib.rs Co-authored-by: Kian Paimani <[email protected]> * Update frame/elections-phragmen/src/lib.rs Co-authored-by: Kian Paimani <[email protected]> * changes the name of the pallet; adds changelog * update changelog * Adds weight testing * Adds log macro_rules * renames elections-phragment dir to elections * weights rename * fixes typo in cargo toml * pre/post solve weight scafolding * refactor do_post_election * refactors into pre and post election solve for independent benchmarking * deconstructs PreElectionResults struct * updates benchmarking pre and post election solve; mock weights * Update frame/elections/src/lib.rs Co-authored-by: Kian Paimani <[email protected]> * Update frame/elections/src/lib.rs Co-authored-by: Kian Paimani <[email protected]> * addresses PR comments * adds pre_solve and post_sove weights * Adds comments on election pallet id param name change * ".git/.scripts/bench-bot.sh" pallet dev pallet_elections * Finishes pre-post solve weights * Update frame/elections/src/lib.rs Co-authored-by: Kian Paimani <[email protected]> * Update frame/elections/src/lib.rs Co-authored-by: Kian Paimani <[email protected]> * Addresses PR comments: no panic in on_init path; nits * Fixes node build * Implements approval voting to use as a `NposSolver` (paritytech#13367) * Implements the approval voting methods in sp_npos_elections * fmt * remove unecessary file * comment clarification * re-run weights * fix typo * updates MaxVoters in tests for integrity_tests to pass * Refactors election provider support benchmarks outside its own crate (paritytech#13431) * Refactors election provider support benchmarks outside its own crate --------- Co-authored-by: command-bot <> --------- Co-authored-by: Kian Paimani <[email protected]> Co-authored-by: parity-processbot <> Co-authored-by: Ross Bulat <[email protected]>
…tech#12588)" (paritytech#13451) This reverts commit 4be5dd2.
This PR refactors the current
elections-phragmen
pallet to use anNposSolver
instead of hardcoding one flavor of phragmen. In addition, it implements an approval voting election scheme where each voter backs a limited set of candidates, without requiring splitting the stake among the selected candidates.When using the
pallet-elections
, one should consider switching to a simplerNposSolver
type like the approvals voting scheme, which is lighter than phragmen and reasonable in most cases. Users of this pallet should keep in mind that the election happens periodicallyon_initialize
, and thus ensure that the election weight fits within a block (there is an integrity test to ensure the runtime configs comply).Note that, although this PR renamed the old
pallet-elections-phragmen
topallet-elections
, the pallet name in the runtimes did not change in order to avoid a runtime upgrade (we could use move_pallet but that's not recommended). Otherwise a runtime upgrade would have been required.Finally, this PR removes the need for a separate benchmarking crate for
elections-provider-support
. This way, it is possible to use the CI bench bot to correctly calculate and commit weights (all changes related to this merged and more info about it in this PR #13431).elections-phragmen
toelections-generic
elections-phragmen
toelections
NposSolver
wrapper (WIP Implements approval voting to use as aNposSolver
#13367)election-provider-support
benchmarking and update pallet and runtime weights with CI bench bot.try with follow-chain on a block that performs a council electionpolkadot companion: paritytech/polkadot#6278
Closes #8250
Follow up of #12563