Trick or Treat

First Flight #27
Beginner FriendlyFoundry
100 EXP
View results
Submission Details
Severity: low
Invalid

Costly operations inside loops

Summary


Invoking SSTOREoperations in loops may lead to Out-of-gas errors. Use a local variable to hold the loop computation result.

Vulnerability Details

in TrickOrTreat.sol [Line: 32]

for (uint256 i = 0; i < treats.length; i++) {

Impact

Out-of-gas errors

Tools Used

Personal Knowledge

Recommendations

using a variable out of for loop for getting length of `treats`

uint256 lengthOfTreats=treats.length;
for (uint256 i = 0; i <lengthOfTreats ; i++) {
Updates

Appeal created

bube 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.