Unfair reward distribution for new stakers.
The current implementation of reward distribution allows new stakers to receive an unfair share of rewards accumulated before their stake. This occurs because the _checkEpochRollover() function distributes rewards based on the total staked amount at the time of distribution, without considering the duration of each stake.
The issue stems from using a single point-in-time measurement (totalStaked
at epoch end) to distribute rewards that have accumulated over the entire epoch. This approach fails to account for the dynamic nature of staking throughout the epoch.
For instance:
User A stakes 1000 tokens at the beginning of an epoch.
Near the end of the epoch, User B stakes 10000 tokens.
Epoch rollover occurs.
Rewards are distributed based on the total stake of 11000 tokens, with User B receiving a disproportionate share despite only staking for a short period.
Users who stake just before an epoch rollover can receive the same rewards per token as users who have been staking for the entire previous epoch. This creates an unfair advantage for new stakers and diminishes the rewards for long-term stakers.
Manual review
Implement a pro-rata reward distribution system that accounts for the duration of each stake within an epoch. This could involve tracking the stake start time for each user and calculating rewards based on the proportion of the epoch they were staked.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.