-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Allow for a dynamic number of nominators #10340
Conversation
For the sake of prosperity, I hereby confirm that commit 2f629a9 which is not properly signed was made by me. |
/// Essentially, draws a line between `(MinBalance, MinQuota)` and `(MaxBalance, MaxQuota)`, Also, | ||
/// values less than `MinBalance` have `MinQuota` and values higher than `MaxBalance` have | ||
/// `MaxQuota`. | ||
pub struct LinearNominationQuota<MinBalance, MaxBalance, const MAX_QUOTA: u32, const MIN_QUOTA: u32>( |
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.
I won't test this further yet because I am not sure if we are going to use it.
/// Whilst doing this, [`size`] will track the entire size of the `Vec<Voter>`, except for the | ||
/// length prefix of the outer `Vec`. To get the final size at any point, use | ||
/// [`final_byte_size_of`]. | ||
pub(crate) struct StaticSizeTracker<AccountId> { |
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.
I would make this fully generic and reusable, but it is not really feasible given the nested vec.
Based on the discussion in the element group, I'd like to summarize my points on this. First, I think reducing the number of nominations per nominator is generally a reasonable approach if we can trade those for increasing the number of total nominators in the short run. But, I think it is crucial to not reduce those too far, because for the following reasons:
Having said that, I think there is still room to reduce the nominations (currently 16 in Polkadot) to free space for more nominators. As mentioned in the group, I'd propose a rule of setting the minimum number of nominations to 6-8 and giving another nomination per 50k DOT in the stash. That would provide sufficient freedom to smaller stakers as well as for larger token holders. This strategy of 6 + 1 every 50k (and cap at 32) would give, based on some recent era data, a maximum of 111801 nominations. If we assume that nominators use their free slots similarly as currently (64%), that would bring down the number of nominations to 72k. If we compare that to the current number of 184954 nominations, that's a good gain. |
I'm not quite sure about the prospect of this, so marking it is on ice for now until I know more, or I will temporarily close it. |
@@ -439,3 +443,173 @@ impl< | |||
sp_npos_elections::phragmms(winners, targets, voters, Balancing::get()) | |||
} | |||
} | |||
|
|||
/// The limits imposed on a snapshot, either voters or targets. | |||
#[derive(Clone, Copy, RuntimeDebug, scale_info::TypeInfo, Encode, Decode)] |
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.
This is a good option to be backported back to master in either case.
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. |
YES |
too stale, giving up for now |
This is back from the grave as per a discussion with @xlc, which led us to re-discover this as a useful feature. I think it is a great feature to add, and we can later let the governance decide what the range of nomination should be. We can and should deploy this initially in a backwards compatible way, i.e. with |
I think the logic and design of the PR look good, but the git history has diverged quite significantly from the current master. My plans to revive this PR are to cut a new branch from master and:
cc @kianenigma |
This pull request has been mentioned on Polkadot Forum. There might be relevant details there: https://forum.polkadot.network/t/the-future-of-polkadot-staking/1848/6 |
This pull request has been mentioned on Polkadot Forum. There might be relevant details there: https://forum.polkadot.network/t/the-future-of-polkadot-staking/1848/7 |
This pull request has been mentioned on Polkadot Forum. There might be relevant details there: https://forum.polkadot.network/t/the-future-of-polkadot-staking/1848/8 |
This PR adds two flexible pieces of logic to
pallet-staking
:The number of votes that each nominator can cast can be configurable now. A simple implementation would use a constant value for this. A fancier implementation would make this a function of the amount of stake.
The amount of voters that is taken for the election snapshot is now dynamic over two axis. A
SnapshotBound
is defined as a cap on both the count and byte-size of the snapshot. The snapshot creation will, if bounded, stop whenever either of the bounds are met.Breaking Changes
MAX_NOMINATIONS
is removed from the API of pallet-staking and is replaced byNominationQuota
. To replicate the same behaviour, usepallet_staking::FixedNomintionQuota<OLD_VALUE>
.VoterSnapshotPerBlock
is removed. Two replacements are introduced,VoterSnapshotBounds
andTargetSnapshotBounds
. To replicate exactly the old behaviour,VoterSnapshotBounds
should beSnapshotBounds::new_count(OLD_VALUE)
andTargetSnapshotBounds
should beSnapshotBounds::new_unbounded()
. Note that this is only safe when the number of validators in staking is well bounded (MaxValidatorsCount
is set to some small value). As seen in this PR (node/runtime/src/lib.rs
), it is recommended to replace this with a small sane bound.