TwentyOne::call function improperly deals with the case when dealerHand == playerHand. In such cases, according to official Blackjack rules, a tie (called a "push") means the player neither wins nor loses their bet; their stake should be returned. Therefore, the code should be modified to handle ties by returning the player’s bet, rather than treating it as a loss.
If a tie occurs it will end up in the final else of this block of code:
which would make the player lose, even though they should get their funds back in such cases. The contract currently also does not support a way to return the players' initial bet of 1 eth, so this needs to be implemented as well.
Medium as the likelyhood of a tie happening is not super high, however its crucial to be fixed as players wont be happy if they should get their money back, but they actually lose them.
Manual Review
Foundry (PoC unit tests can be provided upon request)
ChatGPT
The code should be modified to handle the tie (push) scenario correctly by returning the player's bet without any gain or loss. Correct logic should be something like this:
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.