The startGame()
function of the TwentyOne
contract fails to correctly manage and check contract balances, leading to issues with payouts. Specifically, the contract asserts that the player's balance should be greater than 2 ether after they win the game, but the contract balance is not checked or updated to reflect the payout properly. This can lead to a situation where, even if a player wins, they do not receive their intended funds.
The assertion in the test case assertGt(player2.balance, 2 ether);
fails because the contract doesn't properly manage the balance after the game.
The startGame()
function may accept funds, but it doesn't ensure that the contract holds enough funds to cover payouts. In this scenario, even when a player wins the game, the contract balance is not checked, and the payout is not correctly made to the player.
The error occurs due to an imbalance between the contract's internal state and the external player's balance, causing the assertion to fail.
Player Payout Failure: If a player wins the game, they may not receive their winnings if the contract balance is not properly handled or updated, leading to a failed transaction.
Broken Game Logic: The failure to properly track and manage the contract balance impacts the core functionality of the game, which relies on payouts for correct operation.
Player Experience: Players may be confused or frustrated when they win but do not receive the expected payout, leading to a poor user experience.
Contract Malfunctions: This vulnerability undermines the contract's trustworthiness, as the payout mechanism is not fully reliable.
Manual Review
Implement a require
on the startGame()
` to check that the contract balance is superior to the payout prize.
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.