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
Unlimited number of nominators eligible for Rewards payout (rebased) #13497
Closed
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
Ank4n
requested review from
kianenigma,
acatangiu and
andresilva
as code owners
February 28, 2023 22:58
…ard points to claim
Ank4n
force-pushed
the
ankan/paged-rewards-rebased
branch
from
February 28, 2023 22:59
14510a0
to
b4abd8a
Compare
Ank4n
added
A0-please_review
Pull request needs code review.
C3-medium
PR touches the given topic and has a medium impact on builders.
D9-needsaudit 👮
PR contains changes to fund-managing logic that should be properly reviewed and externally audited
B1-note_worthy
Changes should be noted in the release notes
T1-runtime
This PR/Issue is related to the topic “runtime”.
E0-runtime_migration
PR introduces code that might require downstream chains to run a runtime upgrade.
labels
Feb 28, 2023
bot rebase |
Branch is already up-to-date |
Open
2 tasks
louismerlin
removed
the
D9-needsaudit 👮
PR contains changes to fund-managing logic that should be properly reviewed and externally audited
label
May 4, 2023
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.
E0-runtime_migration
PR introduces code that might require downstream chains to run a runtime upgrade.
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.
closes paritytech/polkadot-sdk#439 and paritytech/polkadot-sdk#473.
polkadot companion: paritytech/polkadot#6765.
Context
Rewards payout is processed today in a single block and limited to
MaxNominatorRewardedPerValidator
. This number is currently512
on both Kusama and Polkadot.This PR tries to scale the nominators payout to an unlimited count in a multi-block fashion. Exposures are stored in pages, with each page capped to a certain number. Practically, this number would be the same as
MaxNominatorRewardedPerValidator
or lower.The PR also intends to be mostly backward compatible.
Note about the release
This PR introduces a new storage item
MaxExposurePageCount
which defaults to minimum value of1
when not set. This means functionally, the pallet will continue to work exactly as before after this release. To enable paged rewards payout,MaxExposurePageCount
can be increased to a bigger number by OpenGov for each runtime separately.How payouts would look like after this change
Staking exposes two calls, 1) the existing
payout_stakers
and 2)payout_stakers_by_page
.payout_stakers
This remains backward compatible with no signature change. If for a given era a validator has multiple pages, they can call
payout_stakers
multiple times. The pages are executed in an ascending sequence and the runtime takes care of preventing double claims.payout_stakers_by_page
Very similar to
payout_stakers
but also accepts an extra parampage_index
. An account can choose to payout rewards only for an explicitly passedpage
.Lets look at an example scenario.
Given an active validator on Kusama had 1100 nominators,
MaxExposurePageCount
set to 10 andMaxExposurePageSize
set to 512 for Erae
. In order to pay out rewards to all nominators, the caller would need to callpayout_stakers
3 times.payout_stakers(origin, stash, e)
=> will pay the first 512 nominators.payout_stakers(origin, stash, e)
=> will pay the second set of 512 nominators.payout_stakers(origin, stash, e)
=> will pay the last set of 76 nominators....
payout_stakers(origin, stash, e
) => calling it the 4th time would return an errorInvalidPage
.The above calls can also be replaced by
payout_stakers_by_page
and passing a page explicitly.Important to note
Storage Changes
Added
ErasStakersOverview
ClaimedRewards
ErasStakersPaged
Deprecated
The following can be cleaned up after 84 eras. Tracker issue for cleaning up.
ErasStakers
.ErasStakersClipped
.StakingLedger.claimed_rewards
, renamed toStakingLedger.legacy_claimed_rewards
.Config Changes
MaxNominatorRewardedPerValidator
toMaxExposurePageSize
.MaxExposurePageCount
TODO
MaxNominatorRewardedPerValidator
->MaxExposurePageSize
.Follow up issues