-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Store validator self-vote in bags-list, and allow them to be trimmed for election #10821
Conversation
Just noting that in the future if we want to get rid of the nominators map and the validators map, we could instead have the bags list node have a generic field which could be used with some enum like enum StakerType<T: Config> {
Nominator { nominations: Nominations<T> },
Validator { prefs: ValidatorPreferences }
} Then, we would only have to worry about updating the bags list and we can create abstractions for reading nominators vs validators from the bags list, which should be efficient because we can just read from the Node storage map |
frame/staking/src/tests.rs
Outdated
assert_eq!( | ||
Staking::voters(Some(3)) | ||
Staking::voters(Some(2)) |
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 it worth adding a similar test but instead pass Some(1)
, resulting in just in no voters taken?
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.
lgtm but just want to make sure I understand how this test works before approving: https://github.com/paritytech/substrate/pull/10821/files#r804031477
Co-authored-by: Zeke Mostov <[email protected]>
…ate into kiz-validators-in-bags
dear @kianenigma, dear all, hello: Please consider the following concern that raises as part of the Thousands Validator Programme (TVP): In the context of this PR is written
However, please note that the above is not true for most of the validators in the TVP and actually, the opposite applies: most of these validators self-stake all of their available balances in their own validator nodes, instead of having separate self-nomination bonds. The self-stake in Polkadot's TVP participants is certainly not trivial and amounts to more than 5'000 DOTs (and sometimes as high as 10'000 DOTs) which could potentially be excluded from the rewards when the kind W3F/Parity's nominations are received. Thus, I would appreciate if you could elaborate a bit more on the consequences for the validators in the TVP and if this PR is enacted, whether it will be possible to consider also expanding the rights of the self-stakes to nominate other validators. That way we will really be on a level / fair playground. Thanks! |
The interpretation is correct: if a validator self-stake is not active, then it does not contribute to their reward. BUT, and this is a big BUT: it will only be NOT active if it is less than whatever is the minimum nomination threshold. So, if you want to make sure you earn money from your self stake, called So to recap:
As noted, in this case, these stakes WILL be included, as long as they are above the threshold to be an active nominator. |
bot merge |
…for election (paritytech#10821) * Implement the new validator-in-bags-list scenario + migration * Apply suggestions from code review Co-authored-by: Zeke Mostov <[email protected]> * some review comments * guard the migration * some review comments * Fix tests 🤦♂️ * Fix build * fix weight_of_fn * reformat line width * make const * use weight of fn cached * SortedListProvider -> VoterList * Fix all build and docs * check post migration Co-authored-by: Zeke Mostov <[email protected]>
…for election (paritytech#10821) * Implement the new validator-in-bags-list scenario + migration * Apply suggestions from code review Co-authored-by: Zeke Mostov <[email protected]> * some review comments * guard the migration * some review comments * Fix tests 🤦♂️ * Fix build * fix weight_of_fn * reformat line width * make const * use weight of fn cached * SortedListProvider -> VoterList * Fix all build and docs * check post migration Co-authored-by: Zeke Mostov <[email protected]>
…for election (paritytech#10821) * Implement the new validator-in-bags-list scenario + migration * Apply suggestions from code review Co-authored-by: Zeke Mostov <[email protected]> * some review comments * guard the migration * some review comments * Fix tests 🤦♂️ * Fix build * fix weight_of_fn * reformat line width * make const * use weight of fn cached * SortedListProvider -> VoterList * Fix all build and docs * check post migration Co-authored-by: Zeke Mostov <[email protected]>
…for election (paritytech#10821) * Implement the new validator-in-bags-list scenario + migration * Apply suggestions from code review Co-authored-by: Zeke Mostov <[email protected]> * some review comments * guard the migration * some review comments * Fix tests 🤦♂️ * Fix build * fix weight_of_fn * reformat line width * make const * use weight of fn cached * SortedListProvider -> VoterList * Fix all build and docs * check post migration Co-authored-by: Zeke Mostov <[email protected]>
…for election (paritytech#10821) * Implement the new validator-in-bags-list scenario + migration * Apply suggestions from code review Co-authored-by: Zeke Mostov <[email protected]> * some review comments * guard the migration * some review comments * Fix tests 🤦♂️ * Fix build * fix weight_of_fn * reformat line width * make const * use weight of fn cached * SortedListProvider -> VoterList * Fix all build and docs * check post migration Co-authored-by: Zeke Mostov <[email protected]>
Context
Historically, in the staking pallet, we’ve always had the assumption that all validators are implicitly also voting for themselves. We don’t actually make them a nominator though. Instead, once the time for election comes, we inject their self-votes.
In the past, in the days that there wasn’t much pressure on us about how many nominators we can have, we opted for a super simple solution to do this. Namely, when staking wants to create the snapshot of voters, we always first iterate validators and inject their self-vote, and then continue with the actual nominators.
To demonstrate the problem that this causes, consider Polkadot, where around 1k validator candidates exists, around 22k nominators, and the maximum number of voters that we can put in a snapshot is 22,5k.
The issue here is that those 1k validators are essentially filling the first slots of the 22,5k limit, while some random nominators are being left out. This in itself is not an issue. Nomination was never an inclusive operation, and lots of limits are imposed on who can be a nominator. But, the issue here is that those 1k self-votes are not justified to be FIRST in to fill the 22,5k limit. In other words, those 1k validators might have very little amount of self-stake, but a very high amount of self-nomination, and their self-nomination might not be included, while their self-stake is guaranteed to be included.
Solution
Our proposal to solve this issue, and generally both simplify and improve this process is to utilize the bags-list pallet. Currently, bags-list is only tracking the nominator votes. Now, we inject each validator’s self-vote (prospectively) into the bags-list as well. As you see in the PR, this simplifies the code a lot. Moreover, while we still guarantee that all validators (up to the chain limit) can be inlaced in the election, the self-stake of some might be dropped for the election.
In effect this might lead to the new situation where a validator is elected, with a self-stake of 0. In other words, they have some amount bonded (ledger.active), but their self-stake (aka.
exposure.own
) is 0.Follow-ups in other PRs, just writing them down as ideas:
polkadot companion: paritytech/polkadot#5088