Mystery Box

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

Gas Costs for claimAllRewards()

Summary

The claimAllRewards function iterates through all rewards in rewardsOwned[msg.sender], which can be expensive in terms of gas fees if a user has many rewards.

Vulnerability Details

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

Impact

Gas costs increase linearly with the number of rewards, which could make the function impractical for users with many rewards.

Tools Used

Recommendations
Consider breaking up the reward claiming process into smaller steps or allowing users to claim rewards incrementally to avoid excessive gas fees.

Updates

Lead Judging Commences

inallhonesty Lead Judge
about 1 year ago

Appeal created

inallhonesty Lead Judge about 1 year 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.

Give us feedback!