This repository was archived by the owner on Nov 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
[Feature] StakeTracker P2 - TargetList #13195
Closed
ruseinov
wants to merge
59
commits into
ru/feature/stake-tracker-voter
from
ru/feature/stake-tracker-tlist
Closed
[Feature] StakeTracker P2 - TargetList #13195
ruseinov
wants to merge
59
commits into
ru/feature/stake-tracker-voter
from
ru/feature/stake-tracker-tlist
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Contributor
Author
|
bot rebase |
|
Branch is already up-to-date |
Contributor
Author
|
bot rebase |
|
Branch is already up-to-date |
Contributor
Author
|
bot rebase |
…into ru/feature/stake-tracker-tlist
|
Rebased |
…with StakeTracker::TargetList::count
kianenigma
reviewed
Feb 14, 2023
| } | ||
| } | ||
|
|
||
| impl<T: Runtime> OnRuntimeUpgrade for InjectValidatorsApprovalStakeIntoTargetList<T> { |
Contributor
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.
Is this up to date? This is not how this migration should happen.
…into ru/feature/stake-tracker-tlist
Contributor
Author
|
bot rebase |
…into ru/feature/stake-tracker-tlist
|
Rebased |
Contributor
Author
|
bot rebase |
…into ru/feature/stake-tracker-tlist
|
Rebased |
Contributor
Author
|
bot rebase |
…into ru/feature/stake-tracker-tlist
|
Rebased |
Contributor
Author
|
bot rebase |
|
Branch is already up-to-date |
Contributor
Author
|
bot rebase |
…into ru/feature/stake-tracker-tlist
|
Rebased |
|
The CI pipeline was cancelled due to failure one of the required jobs. |
Contributor
|
I will re-open this from a new PR, based on your commits. Thank you Roman for your contribution 💯 |
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
C3-medium
PR touches the given topic and has a medium impact on builders.
T1-runtime
This PR/Issue is related to the topic “runtime”.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Splitting up #12744
The first part: #13079
polkadot companion: paritytech/polkadot#6639
Terminology
approval stake - a sum of all nominator/nomination pool stakes backing this validator + their self stake.
staking event listener - implementor of
OnStakingUpdate, listening to staking events and acting upon them.Goals
The original goal of this series of PR's is to introduce a list of validators sorted by their approval stake, therefore eliminating the need for Max Validator Intentions parameter. This way we'll be able to select look into top x validators in the list to get a set of electable targets.
While doing that we also introduce a concept of EventListeners into Staking, that would allow us to hook into various staking methods acting upon emitted events. In this particular case this allows us to delegate the sorted list maintenance to a 3rd party EventListener.
Technical details
This PR introduces the logic to track validator's approval stake through a staking event listener that is implemented by
pallet-stake-trackerin this pr. Note that as long the staker is in the system, whether or not they decide to continue validating - we have to keep track of their approval stake, as there is no easy way to recalculate that. For this reasonApprovalStakestorage has been introduced forpallet-stake-tracker, this way we don't need to keep inactive validators in theTargetList, therefore preventing it's bloat.We are also introducing a migration that calculates the approval stake for each validator. It's quite costly, because we need to iterate all the validators and nominators, updating the storage as we go. For this reason the migration is going to be spanning several blocks, initialized on
OnRuntimeUpdateand continuedOnInitializeto make sure we have enough weight free for the chain to work without delays. It's quite a tricky change, because we also need to make sure that there are no writes toValidatorsandNominatorsstorage in Staking while it's running.What's missing: