Description:
The contract's design allows players to win Ether rewards based on the outcome of their game. However, this reward system is dependent on the contract's available balance. If a single player continuously plays the game and wins repeatedly, the contract may run out of funds. In such a scenario, the game would no longer be playable, as rewards cannot be issued to the player, effectively halting the game's functionality. This issue stems from the lack of a mechanism to replenish the contract's funds dynamically or to cap payouts when funds are low.
Impact:
Once the contract balance is exhausted, it can no longer issue rewards, leading to a denial of service for the player.
Proof of Concept:
Place this in the TwentyOne.t.sol test suite.
The following logs would be outputted::
Proving that the contract may run out of funds.
Tools Used:
Manual Review and foundry.
Recommended Mitigation:
Introduce a house edge or a small fee for each game played to sustain the contract balance over time.
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.