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

Unreachable incorrect check

Summary

The claimReward has an unreachable check. This can cause a false sense of invariant checking.

Vulnerability Details

The claimReceipts[msg.sender].requestEpoch >= currentEpoch - 1 condition can only be reached when claimReceipts[msg.sender].requestEpoch == 0.

function claimReward(bool _isClaimEarly)
external
checkEpochRollover
redeemPendingRewards
returns (uint256 rewardAmount, uint256 penaltyAmount)
{
//CHECK
UserData storage ud = userData[msg.sender];
>> // do not allow to claimReward while user have pending claimReceipt
>> // or user have claimed from the last epoch
if (
>> claimReceipts[msg.sender].requestEpoch > 0
>> || claimReceipts[msg.sender].requestEpoch >= currentEpoch - 1
) revert ClaimTooEarly();
if (ud.unclaimedRewards == 0) revert NothingToClaim();
//EFFECT
if (!_isClaimEarly) {
claimReceipts[msg.sender] =
>> ClaimReceipt({ requestEpoch: currentEpoch, amount: ud.unclaimedRewards });
emit ClaimReceiptCreated(msg.sender, currentEpoch);
return (0, 0);
}

Impact

Unexpected behavior

Tools used

Manual Review

Recommendations

Consider removing useless check

Updates

Lead Judging Commences

inallhonesty Lead Judge 10 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

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