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

enterRaffle Denial of Service and high gas attack

Summary

enterRaffle function has a double loop through all players causing O(2n+1) complexity. This creates huge gas cost if there are too many players on the round and even prevent the function to run if it hits block gas limits.

Vulnerability Details

Users entering early will have cheaper gas advantage and can enter with multiple wallets to increase the gas limit for further users.

Recommendations

Use mapping to check (roundId to address : boolean) if user has entered the raffle round. This provides single check instead of looping and have the same gas for everyone.

Updates

Lead Judging Commences

Hamiltonite Lead Judge over 1 year 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.