-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature request: Display information with regard to bags list nomination limits #6918
Comments
This is already displayed in |
All in all though, I think the Let me break it down like this. We have 2 user groups, validators and nominators. Each have 2 variables:
With the exception that the validator group has two minimums:
This leaves us with the following 4 boxes to show:
This is how you calculate all of the 4 bits of information needed here: const b = (x: BN): string => api.createType('Balance', x).toHuman()
// a map from all nominators to their total stake.
const assignments: Map<AccountId32, BN> = new Map();
const currentEra = (await api.query.staking.currentEra()).unwrap();
const stakers = await api.query.staking.erasStakers.entries(currentEra);
stakers.map((x) => x[1].others).flat(1).forEach((x) => {
// @ts-ignore
const nominator: AccountId32 = x.who;
// @ts-ignore
const amount: Compact<u128> = x.value;
if (assignments.get(nominator)) {
assignments.set(nominator, amount.toBn().add(assignments.get(nominator)!))
} else {
assignments.set(nominator, amount.toBn())
}
})
// nominator stake
{
const threshold = await api.query.staking.minNominatorBond();
const stakes = Array.from(assignments.values());
stakes.sort((a, b) => a.cmp(b));
const min = stakes[0];
console.log(`nominator stake: threshold: ${b(threshold)} / min: ${b(min)}`)
}
// nominator count
{
const active = Array.from(assignments.keys()).length
const total = await api.query.staking.maxNominatorsCount();
console.log(`nominator count: active: ${active} / total: ${total}`)
}
// validator stake
{
const threshold = await api.query.staking.minValidatorBond();
const stakes = stakers.map((x) => x[1].total.toBn());
stakes.sort((a, b) => a.cmp(b));
const minTotal = stakes[0];
const selfStakes = stakers.map((x) => x[1].own.toBn());
selfStakes.sort((a, b) => a.cmp(b));
const minSelf = selfStakes[0];
console.log(`validator stake: threshold: ${b(threshold)} / minTotal: ${b(minTotal)} / minSelf ${b(minSelf)}`)
}
// validator count
{
const total = await api.query.staking.maxValidatorsCount();
console.log(`validator count: active: ${stakers.length} / total: ${total}`)
} So, these are 4 boxes, each containing a pair of information, and they should go in the header of the "Staking -> Overview" page, in a separate row. Once we have this, we can get rid of the following:
|
@wirednkod @gilescope any of you interested in this? |
A 1st draft of how @kianenigma idea could look can be seen below: More terminology can be found here |
Thank you @wirednkod ! Some feedback:
|
With the coming of bags list to staking in 0.9160 there are two limits with regard to staking that will be essential for users to see:
What is the number of nominators that will be selected from the sorted list to be applied to the election. This number is dynamic and will be:
VoterSnapshotPerBlock - CounterForValidators
VoterSnapshotPerBlock
is the max number of voters, that includes validators, and is currently 22,500Lowest stake in order for your nominations to be applied. It would be the stake of the last account in the ordered list.
Relevant issue for reference:
#6460
The text was updated successfully, but these errors were encountered: