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

Self-Vote for Staking (among others.) #2078

Merged
merged 65 commits into from
Mar 22, 2019
Merged

Self-Vote for Staking (among others.) #2078

merged 65 commits into from
Mar 22, 2019

Conversation

kianenigma
Copy link
Contributor

@kianenigma kianenigma commented Mar 21, 2019

Treats some leftover review from #1915.

  • Adds an automatic self-vote to each validator. This is an entirely artificial edge in Phragmen and will be removed at the end of the algorithm (meaning that it is NOT counted when slashing/rewarding).
  • Improves the performance by removing a layer of iteration in every inner loop of the main algorithm (--at the expense of storing two sets of indexes in each Edge). This basically makes the complexity of this implementation exactly the same when compared to the reference implementation.
  • Adds the Phragmen equalise() post-processing, the parameters of which are currently configured statically in the code and NOT via a storage item (I think it will be constant --should refactor to a storage item if not). Default parameters, open for suggestion: https://github.com/paritytech/substrate/pull/2078/files#diff-b5a024b4f4ae96b0bfc0681acae56709R896
  • Some other minor fixes.
  • Few more tests to verify the above.

Things that I am not satisfied with

  • How to react to potential overflows.
  • Maybe storing the direct reference of a Candidate in Edge is better (instead of storing the index-- technically same memory footprint though), given that it will probably create a mess of lifetime.

Note: This has #1951 merged into it (hence, ignore all the commits before 531ae73). Either that one will be merged before this or #1951 can be actually closed and continued here (just needs a few more paragraphs of documenting).

@gavofyork gavofyork merged commit 3628a93 into master Mar 22, 2019
@gavofyork gavofyork deleted the kiz-staking-enhance branch March 22, 2019 20:41
MTDK1 pushed a commit to bdevux/substrate that referenced this pull request Apr 12, 2019
* initial doc for the staking module

* Remove md style links.

* Remove todos.

* Add rust code types

* Rename and fix review notes.

* Add new md file

* Final touches.

* Migrate compleatly to rustdoc

* Update link

* Fix heading

* Final touches wrt the new template.

* Remove empty prereq.

* Fix more reviews

* Some final nits.

* Fix some side issues.

* Fix another set of reviews

* Fix + stabilize leftover reivews.

* Remove unused test parameters

* Fix typo.

* Merge redundant loops

* Adds phantom self-vote

* Fix broken tests.

* Refactor some names to match the reference.

* Remove redundant inner loops from election round.

* Introduce phragmen post-processing.

* Some fixes and todos.

* Fix some tests with new phragmen params

* Fix test

* Bump spec

* Fix wasm build

* Fix tests and phragmen fallback. Avoid double-controlling

* Fix and rebuild wasm

* Whitespaces, whitespaces everywhere.

* Rebuild

* Disable post-processing.

* Identify by stash, not controller account.

* Couple of fixes

* Fix first test

* Fix invulnerability_should_work

* Fix a couple more tests

* Fix more tests

* Fix more tests

* Fix more tests

* Fix some tests

* Fix update-ledger.

* Fix update-ledger.

* Fix another test

* Fix another test

* Fix rest of staking tests

* Remove printlns

* Rebuild wasm

* Fix & tests for auth/val syncing

* Fix up threading for tests

* Remove superfluous asserts
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A3-in_progress Pull request is in progress. No review needed at this stage.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants