Beginner FriendlyFoundryNFT
100 EXP
View results
Submission Details
Severity: high
Invalid

Innefficiency: enterRaffle() is O(n^2)

Summary

enterRaffle() stores entries in an array then searches linearly through them to find duplicates.

Vulnerability Details

This kind of pairwise comparison search for duplicates has quadratic complexity and is one of the most
expensive way of searching as it increases exponentially with entries.

Impact

Gas costs will be very high.

Tools Used

  • Foundry

Recommendations

Use a hash-table to store entries. A hash-table can efficiently ensure no duplicates are stored.

Updates

Lead Judging Commences

Hamiltonite Lead Judge over 1 year ago
Submission Judgement Published
Invalidated
Reason: Gas optimizations

Support

FAQs

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