Refunded players should no longer participate in the raffle and should no longer be counted as funds available for the prize pool.
refund replaces a refunded player's slot with address(0) but does not reduce players.length. Later, selectWinner calculates totalAmountCollected as players.length * entranceFee, treating refunded slots as paid active entries. When enough players refund, the contract calculates a prize pool larger than the ETH it actually holds, causing winner payout to revert.
Likelihood:
Refunds intentionally leave blank spots in the players array.
selectWinner always uses players.length instead of counting active nonzero players or actual contract balance.
Impact:
Winner selection can revert because the calculated prize pool exceeds the contract balance.
A participant can make the raffle round difficult or impossible to settle after refunds occur.
After three refunds, players.length is still 4, so selectWinner tries to pay 3.2 ETH even though the contract only has 1 ETH.
Track active paid entries separately or calculate rewards from actual available ETH. Also ensure address(0) cannot win.
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.