Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

nomination-pools: Defer first reward claim for 2 eras #10861

Closed
emostov opened this issue Feb 15, 2022 · 4 comments
Closed

nomination-pools: Defer first reward claim for 2 eras #10861

emostov opened this issue Feb 15, 2022 · 4 comments
Labels
Z2-medium Can be fixed by a coder with good Rust knowledge but little knowledge of the codebase.

Comments

@emostov
Copy link
Contributor

emostov commented Feb 15, 2022

When a delegator first joins a nomination pool, we record the reward_pools_total_earnings at the exact point in time. However, at best the reward pool has the rewards up through the previous era. If the delegator joins prior to the snapshot they will benefit from the rewards of the active era despite not contributing to the pool's vote weight. If they join after the snapshot is taken they will benefit from the rewards of the next 2 eras because their vote weight will not be counted until the snapshot in active era + 1.

In order to be fair to current pool members, all new joiners should wait for 1-2 eras to have their reward_pools_total_earnings set. Prior to having it set they should not be able to claim rewards because they have not contributed to the pools vote weight.

One way to achieve this would be to make delegator's reward_pools_total_earnings an enum:

DelegatorRewardPoolState {
 /// The delegator joined in `era` and must wait until `era + 2` to record the reward pool's total earnings
 JoinEra { era: EraIndex }
 RewardPoolsTotalEarnings { earnings: BalanceOf<T> }
}

Then we could expose an extrinsic that allows anyone to flip a delegator from JoinEra to RewardPoolsTotalEarnings if the current era is >= JoinEra::era + 2.

This approach would maintain the nomination pools design goal of being constant complexity relative to delegators. However it would make the UX for new joiners less friendly because they would have to call this second extrinsic with some time delay after initially joining in order to start earning rewards.

Should wait until #10694 is merged to start working on this.

@emostov emostov added Z6-mentor An easy task where a mentor is available. Please indicate in the issue who the mentor could be. Z2-medium Can be fixed by a coder with good Rust knowledge but little knowledge of the codebase. labels Feb 15, 2022
@emostov emostov mentioned this issue Feb 15, 2022
4 tasks
@omadoyeabraham
Copy link
Contributor

@emostov I would like to work on this

@emostov
Copy link
Contributor Author

emostov commented Apr 28, 2022

cc @kianenigma

@kianenigma kianenigma removed the Z6-mentor An easy task where a mentor is available. Please indicate in the issue who the mentor could be. label Apr 29, 2022
@kianenigma
Copy link
Contributor

we're feature freezing pools for now for the initial release, so preferably let's wait out a bit. I will mark it as mentor again once it is ready.

@kianenigma
Copy link
Contributor

This not relevant anymore as of #11669

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Z2-medium Can be fixed by a coder with good Rust knowledge but little knowledge of the codebase.
Projects
Status: Done
Development

No branches or pull requests

3 participants