Includes a new struct for this plus needed methods.
Is used ONLY for provider boost staking
The BTree key is for the RewardEra so staking changes within an era will update that entry.
Checking for whether a stake Provider Boost has been done earlier than the history retention limit (in number of RewardEras) must be left for when rewards are claimed. The record needs to be kept around because it may still be valid for some eras. Examples:
Stake an amount, wait until +1 > history limit then claim.
You have only 1 entry
There is no mechanism to automatically reap it
Need to keep the record around because we should pay out remaining eras.
Stake an amount, change stake every era
No problem because if you are staking/unstaking every era the limit will be hit automatically.
Stake an amount, wait limit/2, unstake full amount, wait until +1 > history limit then claim
Not much different from example 1. As long as there is nonzero stake within the era limit, the chain still needs to pay out those eras.
Say history limit is 10. Stake an amount in era 10.
Unstake everything in era 12, so era 11 is eligible for a reward.
But try to claim in era 22.
you can't since are no valid eras to claim rewards for any more (history limit + 1), however, on this claim attempt since there is no more staking, all boost history storage can be deleted.
Goal
The goal of this PR is to add and use storage for individual staking history so that rewards can be calculated and paid out.
Relates to #1699
Discussion
Checking for whether a
stakeProvider Boost has been done earlier than the history retention limit (in number of RewardEras) must be left for when rewards are claimed. The record needs to be kept around because it may still be valid for some eras. Examples:Checklist