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

Abstracts elections-phragmen pallet to use NposSolver (v2) #13453

Open
wants to merge 91 commits into
base: master
Choose a base branch
from

Conversation

gpestana
Copy link
Contributor

This PR refactors the current elections-phragmen pallet to use an NposSolver 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 simpler NposSolver 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 periodically on_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 to pallet-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).

polkadot companion: paritytech/polkadot#6278

gpestana and others added 30 commits October 31, 2022 09:28
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
@paritytech-cicd-pr
Copy link

The CI pipeline was cancelled due to failure one of the required jobs.
Job name: test-linux-stable
Logs: https://gitlab.parity.io/parity/mirrors/substrate/-/jobs/2624761

@gpestana
Copy link
Contributor Author

gpestana commented May 1, 2023

bot bench $ pallet dev pallet-elections

@command-bot
Copy link

command-bot bot commented May 1, 2023

@gpestana https://gitlab.parity.io/parity/mirrors/substrate/-/jobs/2756664 was started for your command "$PIPELINE_SCRIPTS_DIR/commands/bench/bench.sh" pallet dev pallet-elections. Check out https://gitlab.parity.io/parity/mirrors/substrate/-/pipelines?page=1&scope=all&username=group_605_bot to know what else is being executed currently.

Comment bot cancel 5-d57a451a-08d1-438a-83fa-24d33d047ba7 to cancel this command or bot cancel to cancel all commands in this pull request.

@command-bot
Copy link

command-bot bot commented May 1, 2023

@gpestana Command "$PIPELINE_SCRIPTS_DIR/commands/bench/bench.sh" pallet dev pallet-elections has finished. Result: https://gitlab.parity.io/parity/mirrors/substrate/-/jobs/2756664 has finished. If any artifacts were generated, you can download them from https://gitlab.parity.io/parity/mirrors/substrate/-/jobs/2756664/artifacts/download.

@gpestana
Copy link
Contributor Author

gpestana commented May 1, 2023

bot bench $ pallet dev frame-election-provider-support

@command-bot
Copy link

command-bot bot commented May 1, 2023

@gpestana https://gitlab.parity.io/parity/mirrors/substrate/-/jobs/2756843 was started for your command "$PIPELINE_SCRIPTS_DIR/commands/bench/bench.sh" pallet dev frame-election-provider-support. Check out https://gitlab.parity.io/parity/mirrors/substrate/-/pipelines?page=1&scope=all&username=group_605_bot to know what else is being executed currently.

Comment bot cancel 7-00bffb62-38d7-4fd8-9483-7e47e57b0164 to cancel this command or bot cancel to cancel all commands in this pull request.

@command-bot
Copy link

command-bot bot commented May 1, 2023

@gpestana Command "$PIPELINE_SCRIPTS_DIR/commands/bench/bench.sh" pallet dev frame-election-provider-support has finished. Result: https://gitlab.parity.io/parity/mirrors/substrate/-/jobs/2756843 has finished. If any artifacts were generated, you can download them from https://gitlab.parity.io/parity/mirrors/substrate/-/jobs/2756843/artifacts/download.

@stale
Copy link

stale bot commented May 31, 2023

Hey, is anyone still working on this? Due to the inactivity this issue has been automatically marked as stale. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the A3-stale label May 31, 2023
@gpestana
Copy link
Contributor Author

gpestana commented Jun 1, 2023

Yes, we are still interested in merging this PR but are waiting for the opengov v1 to be completely deprecated and for the monorepo so that the merge is easier. Meanwhile, I will fix the conflicts.

@stale stale bot removed the A3-stale label Jun 1, 2023
@stale
Copy link

stale bot commented Jul 1, 2023

Hey, is anyone still working on this? Due to the inactivity this issue has been automatically marked as stale. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the A3-stale label Jul 1, 2023
@gpestana gpestana requested review from a team July 1, 2023 20:10
@stale stale bot removed A3-stale labels Jul 1, 2023
@stale
Copy link

stale bot commented Aug 4, 2023

Hey, is anyone still working on this? Due to the inactivity this issue has been automatically marked as stale. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the A3-stale label Aug 4, 2023
@gpestana
Copy link
Contributor Author

gpestana commented Aug 9, 2023

will work on this PR this week.

@stale stale bot removed the A3-stale label Aug 9, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A0-please_review Pull request needs code review. B1-note_worthy Changes should be noted in the release notes C1-low PR touches the given topic and has a low impact on builders. D1-audited 👍 PR contains changes to fund-managing logic that has been properly reviewed and externally audited T0-node This PR/Issue is related to the topic “node”.
Projects
Status: ✂️ In progress.
Development

Successfully merging this pull request may close these issues.

None yet

4 participants