This repository has been 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.6k
Do not include voters that have zero voter weight in the election snapshot #14245
Merged
paritytech-processbot
merged 2 commits into
master
from
gpestana/13938-zero-weight-voters_2
Jul 24, 2023
Merged
Do not include voters that have zero voter weight in the election snapshot #14245
paritytech-processbot
merged 2 commits into
master
from
gpestana/13938-zero-weight-voters_2
Jul 24, 2023
Conversation
This file contains 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
gpestana
added
A0-please_review
Pull request needs code review.
B0-silent
Changes should not be mentioned in any release notes
C1-low
PR touches the given topic and has a low impact on builders.
D3-trivial 🧸
PR contains trivial changes in a runtime directory that do not require an audit
T1-runtime
This PR/Issue is related to the topic “runtime”.
labels
May 27, 2023
Ank4n
reviewed
May 31, 2023
let voters = <Staking as ElectionDataProvider>::electing_voters(None).unwrap(); | ||
// number of returned voters decreases since ledger entry of stash 101 is now | ||
// corrupt. | ||
assert_eq!(voters.len(), 4); |
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.
👍
Ank4n
approved these changes
May 31, 2023
kianenigma
approved these changes
Jun 9, 2023
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.
Vamos 👍
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. |
bot rebase |
Rebased |
bot merge |
paritytech-processbot
bot
deleted the
gpestana/13938-zero-weight-voters_2
branch
July 24, 2023 12:32
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.
B0-silent
Changes should not be mentioned in any release notes
C1-low
PR touches the given topic and has a low impact on builders.
D3-trivial 🧸
PR contains trivial changes in a runtime directory that do not require an audit
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.
In the current staking system, there can be cases when the
ledger.active
balance is 0 (i.e. the voter weight is 0) or below theMinNominatorBond
and those nominators will still be included in the election snapshot. E.g. when nominator has unlocking chunks queued (i.e.ledger.total
balance > 0) and if the nominate has been executed with an older, lowerMinNominatorBond
.This PR ensures that:
voter_weight == 0
(i.e.ledger.active == 0
) are not considered byfn DataProvider::electing_voters
and thus not included in the snapshot.MinActiveStake
can never be zero (although it may be lower thanMinNominatorBond
)MinActiveStake
is zero is if the voters list doesn't have any "valid" nominator (i.e. a voter that is decodable and with active stake > 0).Changes to EPM mock
In addition, this PR removes the automatic self staking in the EPM mock
StakingMock::add_target
implementation to be in sync with theadd_target
in the pallet staking implementation. Not including the voters with stake = 0 in the snapshot surfaced the sync issue between test and prod benchmarking setups.More detailed info: https://hackmd.io/NCe-ZVJ2TOC6Tt78bU15BQ
Closes #13938
New version of previously opened PR