The protocol has no extra ether
to pay out to winners if players win more than they lose. As a consequence, the protocol will not be able to pay winners their rightful prize. This would mean that a winner is not guaranteed their payout, thus severely breaking the protocol's functionality.
Proof of Concept:
Player calls TwentyOne::startGame
and pays the entrance fee of 1 ether.
Player calls TwentyOne::call
and wins the game.
The call
function calls endGame
with the player as the winner.
The transfer in endGame
fails with an EVM::Out of funds
error.
The transaction reverts and player does not get their payout.
Proof of Code:
Place the below code into TwentyOneTest
in TwentyOne.t.sol
Winning players may not get their payout.
Foundry suite
A check that the contract has enough funds for the payout should be made before calculating the winner in the TwentyOne::call
function. If the contract does not have enough funds, that should be handled properly as well.
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.