Claiming rewards from a future not yet existing epoch prevents claiming rewards for those epochs later on
Summary
If a user claims rewards for a future epoch, all epochs are marked as claimed up until that future epoch. This prevents the user from claiming rewards for those epochs later, leading to a loss of rewards.
Vulnerability Detail
Already claimed rewards are tracked in the isEpochClaimed mapping and checked in the RewardsManager.claimRewards function to prevent claiming rewards multiple times. However, the current implementation does not prevent a user from accidentally claiming rewards for a future epoch. This would iterate through all epochs up until the future epoch and mark them all as claimed. This prevents the user from claiming rewards for those epochs later on, leading to a loss of rewards.
Impact
If a user accidentally claims rewards for a future epoch, the rewards are lost and unclaimable.
berndartmueller
medium
Claiming rewards from a future not yet existing epoch prevents claiming rewards for those epochs later on
Summary
If a user claims rewards for a future epoch, all epochs are marked as claimed up until that future epoch. This prevents the user from claiming rewards for those epochs later, leading to a loss of rewards.
Vulnerability Detail
Already claimed rewards are tracked in the
isEpochClaimed
mapping and checked in theRewardsManager.claimRewards
function to prevent claiming rewards multiple times. However, the current implementation does not prevent a user from accidentally claiming rewards for a future epoch. This would iterate through all epochs up until the future epoch and mark them all as claimed. This prevents the user from claiming rewards for those epochs later on, leading to a loss of rewards.Impact
If a user accidentally claims rewards for a future epoch, the rewards are lost and unclaimable.
Code Snippet
contracts/src/RewardsManager.sol#L112
contracts/src/RewardsManager.sol#L298
Tool used
Manual Review
Recommendation
Consider adding a check to the
RewardsManager.claimRewards
function to prevent claiming rewards for future epochs.