Beginner FriendlyFoundryNFT
100 EXP
View results
Submission Details
Severity: medium
Valid

Out of Gas

Summary

Too many loops might result in out of gas error.

Vulnerability Details

In the enter Raffle function

for (uint256 i = 0; i < players.length - 1; i++) {
for (uint256 j = i + 1; j < players.length; j++) {
require(players[i] != players[j], "PuppyRaffle: Duplicate player");
}
}

Nested for loop may result in Out of Gas issue.

Impact

As the number of players increases the number of loop iterations will also increases and hence result in out of gas error.

Tools Used

Foundry
Git
Manual review

Recommendations

Avoid using nested loops.

Updates

Lead Judging Commences

Hamiltonite Lead Judge almost 2 years ago
Submission Judgement Published
Validated
Assigned finding tags:

denial-of-service-in-enter-raffle

Support

FAQs

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