The staking mechanism within Staking.sol
incorrectly calculates rewards based on the duration since the soulmates were paired, rather than from when the users actually began staking their tokens. This misalignment can lead to users receiving rewards for a period during which their tokens were not actively staked, contrary to the intended functionality of rewarding users based on the time their capital is locked in the staking contract.
Staking::claimRewards
determines the amount of rewards a user is eligible for based on the time elapsed since the soulmates were paired (as indicated by the timestamp of pairing). This approach does not account for the actual commencement of staking, potentially granting rewards for a period prior to the staking action. The provided test code demonstrates that rewards can be claimed immediately after depositing tokens into the staking contract, without a requisite waiting period reflective of actual staking duration:
This flaw impacts the staking system in several ways:
Unwarranted Rewards: Users can claim rewards not duly earned through staking, undermining the fairness and integrity of the rewards distribution mechanism.
Resource Drain: The premature or unwarranted distribution of rewards can lead to a faster depletion of the rewards pool, affecting the sustainability of the staking program.
Incentive Structure Distortion: The misalignment between staking period and rewards calculation can distort the intended incentive structure, potentially rewarding short-term interactions over genuine long-term participation.
Manual review.
The Staking contract should be amended to calculate rewards based on the actual period tokens have been staked. This involves tracking the timestamp at which each user's tokens are deposited into the staking contract and using this timestamp to calculate rewards.
Note that the suggestion above has a limitation: it does not account for multiple deposits made by the same user at different times. To address this and accurately calculate rewards for each deposit, a more nuanced approach is required. This can involve tracking each deposit individually along with its timestamp.
High severity, this allows users to claim additional rewards without committing to intended weekly staking period via multi-deposit/deposit right before claiming rewards.
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.