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

Players may pay high gas fee when enter the raffle

Summary

Players may pay high gas fee when enter the raffle.

Vulnerability Details

In enterRaffle, it uses a nested loop to check whether a player has entered the raffle or not.

// Check for duplicates
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");
}
}

If the players.length is too large, the player may pay a high gas fee, or the cost reaches the block gas limit leading to the player not entering the raffle.

Impact

The player may pay a high gas fee or not enter the raffle.

Tools Used

Manual review.

Recommendations

Use a mapping to record whether the player has entered or not.

Updates

Lead Judging Commences

Hamiltonite Lead Judge about 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.

Give us feedback!