Removal of players using refund()
method creates gaps inside the players[]
array.
The main problem is that nested loop performs check of duplicates as follows:
So, if more than 1 player is removed enterRaffle()
will revert and it'll not be possible to add new players. Here is a test:
I created a helper getPlayersLength()
as follows:
It's a view function and doesn't affect the smart contract, but could be useful for testing purposes.
High. The vulnerability can break game workflow.
Manual check.
Avoid loops. Especially nested loops. Instead use mapping(uint256 => address)
for tracking players.
Funds are locked to no one. If someone gets the refund issue, they also got this issue. IMPACT: High Likelihood: High
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.