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

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

@emostov

Description

@emostov

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Z2-mediumCan be fixed by a coder with good Rust knowledge but little knowledge of the codebase.

    Type

    No type

    Projects

    Status

    ✅ Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions