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

players array can grow too big

Summary

'players' array can grow too big and get impossible to use function enterRaffle()
The same applies for getActivePlayerIndex and _isActivePlayer function which iterates over the array.

Vulnerability Details

function testEnterRaffleRevertCauseOfBigArray() public {
uint totalPlayers = 50;
uint hugeGasAmount = 1_000_000;
address[] memory players = new address[](totalPlayers);
for (uint i = 0; i < totalPlayers; i++) {
players[i] = (address(i));
}
vm.expectRevert();
//"EvmError: OutOfGas"
//Over 1_000_000 of gas will cost us $61 at current price of ETH.
puppyRaffle.enterRaffle{
value: entranceFee * totalPlayers,
gas: hugeGasAmount
}(players);
}

Impact

Medium

Tools Used

Foundry, Manual review

Recommendations

Switch array to mapping.

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!