Trick or Treat

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

Denial of Service in the constructor.

Summary:

The more people enter the treat array, the more gas it will cost. Resulting in a potential Denial of Service.

Vulnerability Details:

When the constructor needs to loop through the array it costs gas, the longer the array, the more gas it costs.

Impact:

New users won't be able to enter the treat list.

Tools Used: Manual review

Recommendations:

Remove the Loop from the Constructor: Avoid using a loop in the constructor by initializing treats after deployment. This method will reduce deployment gas costs and prevent the risk of gas exhaustion.

Use a Batch Addition Function: Implement a function to add treats in batches after deployment. Instead of adding all treats at once in the constructor, create a function to add them in smaller chunks, which is less likely to hit gas limits.

Limit the Array Size on Deployment: If batch initialization or incremental addition is not desired, limit the maximum length of the treats array passed to the constructor. By keeping the array size small, you can avoid gas limit issues.

Updates

Appeal created

bube Lead Judge 10 months ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

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