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

Sensible way of selecting Prime member #5346

Merged
merged 6 commits into from
Mar 23, 2020
Merged

Sensible way of selecting Prime member #5346

merged 6 commits into from
Mar 23, 2020

Conversation

gavofyork
Copy link
Member

@gavofyork gavofyork commented Mar 21, 2020

Fixes #5290

This just uses Borda count for now.

This also combines the StakeOf and VotesOf items which were inexplicably separated, thus causing two trie ops when one was required.

@gavofyork gavofyork added the A0-please_review Pull request needs code review. label Mar 21, 2020
@gavofyork gavofyork added this to the Polkadot milestone Mar 21, 2020
Co-Authored-By: Marcio Diaz <marcio.diaz@gmail.com>
Copy link
Contributor

@marcio-diaz marcio-diaz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Maybe add one more test for preference voting.

Copy link
Contributor

@kianenigma kianenigma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removing the stake_of is also a good idea. It still exists in equlize though which we don't use.

@gavofyork
Copy link
Member Author

gavofyork commented Mar 23, 2020

@kianenigma Yeah it would be good to remove that when you get a chance - the staking code is made dramatically slower because of it as we don't cache on read - only on write, so every time you call stake_of you're almost certainly going to the trie, doing a bunch of codec manipulation, blake2 hashing and rocksdb i/o. This is slow.

@gavofyork gavofyork merged commit 8854e6a into master Mar 23, 2020
@gavofyork gavofyork deleted the gav-prime-election branch March 23, 2020 10:52
bkchr pushed a commit that referenced this pull request Mar 24, 2020
* Calculate prime votes only during the election

* Migration

* Fix build, enable migration

* Fix tests

* Bump runtime version

* Update frame/elections-phragmen/src/lib.rs

Co-Authored-By: Marcio Diaz <marcio.diaz@gmail.com>

Co-authored-by: Marcio Diaz <marcio.diaz@gmail.com>
rakanalh pushed a commit to rakanalh/substrate that referenced this pull request Mar 25, 2020
* Calculate prime votes only during the election

* Migration

* Fix build, enable migration

* Fix tests

* Bump runtime version

* Update frame/elections-phragmen/src/lib.rs

Co-Authored-By: Marcio Diaz <marcio.diaz@gmail.com>

Co-authored-by: Marcio Diaz <marcio.diaz@gmail.com>
@kianenigma kianenigma mentioned this pull request Mar 30, 2020
3 tasks
@apopiak apopiak added runtime-migration and removed A0-please_review Pull request needs code review. labels Jun 5, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Prime member selection in Phragmen Elections
5 participants