The claimReceipts
mapping is incorrectly implemented as a simple mapping from user address to a single ClaimReceipt, instead of the intended nested mapping that would allow multiple claim receipts per user, one for each epoch.
Current implementation:
Intended implementation:
This vulnerability severely limits the functionality of the reward claiming system, preventing users from claiming rewards from specific epochs independently and forcing them into an all-or-nothing claiming strategy.
Consider the following scenario:
A user stakes tokens in epochs 1, 2, and 3.
The user wants to claim rewards from epoch 1, but leave rewards from epochs 2 and 3 unclaimed.
Current behavior:
In this implementation, the user can only create a claim receipt for all unclaimed rewards up to the current epoch. They cannot specify which epoch's rewards they want to claim.
Example:
User has 100 tokens of unclaimed rewards from epoch 1, 150 from epoch 2, and 200 from epoch 3.
When they call claimReward
, they are forced to create a claim receipt for all 450 tokens, instead of just the 100 from epoch 1.
The impact of this vulnerability is significant:
Limited User Control: Users cannot selectively claim rewards from specific epochs, reducing their ability to implement sophisticated reward management strategies.
Forced Claiming Patterns: Users are compelled to claim all rewards at once or nothing, leads to all-or-nothing strategy
To address this vulnerability, the following steps are recommended:
Modify the claimReceipts
mapping to allow multiple claim receipts per user:
Update the claimReward
function to accept an epoch parameter, allowing users to specify which epoch they want to claim rewards from:
Modify the reward calculation logic to track rewards on a per-epoch basis:
Update the _redeem
function to calculate and store rewards for each epoch separately.
Implement a new function to allow users to claim rewards from multiple specific epochs in a single transaction:
Adjust all related functions (e.g., completeClaimRequest
) to work with the new epoch-specific claim receipt structure.
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.