Mystery Box

First Flight #25
Beginner FriendlyFoundry
100 EXP
View results
Submission Details
Severity: low
Valid

Gas Limit Issues in claimAllRewards()

Summary

The claimAllRewards() function may run out of gas if a user has a large number of rewards, preventing them from claiming all their rewards in a single transaction.

Vulnerability Details

The claimAllRewards() function loops through all rewards a user has, which may exceed the block gas limit for users with many rewards:

for (uint256 i = 0; i < rewardsOwned[msg.sender].length; i++) {
totalValue += rewardsOwned[msg.sender][i].value;
}

This could cause the transaction to fail, leaving users unable to claim their rewards.

Impact

Users with many rewards may not be able to claim all of their rewards in one transaction due to gas limits, leading to user frustration and unclaimed rewards.

Tools Used

Manual code review

Recommendations

Implement a batched reward claiming system where users can claim rewards in smaller batches across multiple transactions to avoid gas limit issues.

Updates

Appeal created

inallhonesty Lead Judge 11 months ago
Submission Judgement Published
Validated
Assigned finding tags:

Gas Limit Exhaustion in `claimAllRewards` Function

Support

FAQs

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