DeFiFoundry
20,000 USDC
View results
Submission Details
Severity: medium
Invalid

Missing Update to `lastClaimedEpoch` in Claim Handling Function

Summary

In the completeClaimRequest and claimReward functions, the userData[msg.sender].lastClaimedEpoch is not updated, which can lead to inconsistencies in tracking user claim history. This oversight affects the correct recording of the user's last claimed epoch, potentially disrupting reward calculations and claim validations.

Vulnerability Details

In the completeClaimRequest and claimReward functions, the userData lastClaimedEpoch is not updated, leading to incomplete and potentially incorrect tracking of user claims. For completeClaimRequest, while the function successfully transfers the reward to the user and deletes the claim receipt, it fails to update the lastClaimedEpoch to the current epoch. Similarly, in the claimReward function, which handles both early and standard claims, the lastClaimedEpoch is not updated even though rewards are adjusted. This oversight can result in discrepancies between the actual claim dates and the recorded epoch, disrupting reward calculations and the validation of subsequent claims. Properly updating lastClaimedEpoch is crucial for accurate tracking of claims and ensuring that reward calculations align with the user's claim history.

totalRewards -= (rewardAmount + penaltyAmount);
userData[msg.sender].unclaimedRewards -= (rewardAmount + penaltyAmount);
[+] should update the userData[msg.sender].lastClaimedEpoch
//INTERACT
fjordToken.safeTransfer(msg.sender, rewardAmount);

Impact

The primary impact of not updating userData' lastClaimedEpoch is:

  1. Inaccurate Claim Tracking: Users may experience inconsistencies in their claim history, which can affect future claims and rewards calculations.

  2. Potential Reward Calculation Issues: The system may incorrectly handle or validate future claims based on outdated or inaccurate epoch information.

Tools Used

Manual Code Review

Recommendations

Ensure that userData[msg.sender].lastClaimedEpoch is updated to the current epoch in both completeClaimRequest and claimReward functions whenever rewards are successfully claimed.

Updates

Lead Judging Commences

inallhonesty Lead Judge
10 months ago
inallhonesty Lead Judge 10 months ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.