The 'enterRaffle' function uses an array to enable players to enter the raffle, it also uses a nested for loop on the array elements to check for duplicate players.
The issue is that the player arrays are growing with time and as time oes on using these for loops to loop over the arrays will lead to unbounded gas consumption potentially making the contract unusale or very expensive.
Likelihood:
As the number of players increase, the players array will increase significantly in length leading to the issue
Impact:
This will eventually lead to increase in the gas consumption and cause the denial of service issue which could shut down the program making it unusable or potentialy more expensive for users that come later to be players
The following Proof of Concept displays the gas price at the start before a multitude of new players are added to the raffle, it then the gas at the end of the addition of the players and calculates the gas used.
Avoid using for loops to add the players or atleast limit for loops
Another additional mitigation would be to limit the number of players if the gas is not affordable
The contest is live. Earn rewards by submitting a finding.
Submissions are being reviewed by our AI judge. Results will be available in a few minutes.
View all submissionsThe contest is complete and the rewards are being distributed.