TwentyOne

First Flight #29
Beginner FriendlyGameFiFoundrySolidity
100 EXP
View results
Submission Details
Severity: low
Invalid

The event information for the bust is not recorded clearly

Summary

The event record is unclear, making it impossible to determine whether the player busted because the card draw caused their total to exceed 21, or if they busted due to their initial hand exceeding 21

Vulnerability Details

https://github.com/Cyfrin/2024-11-TwentyOne/blob/a4429168302722d14a5e5996d25d6fc5be22a899/src/TwentyOne.sol#L114-L116

As we can see, the event record for "Player is bust" is unclear, making it impossible to determine whether the player busted due to the card draw

Impact

This leads to inaccurate game record information, which affects the player's decision-making.

Tools Used

Manual inspection

Recommendations

Enhance the logging to include more detailed error messages, capturing the specific cause of the failure. This will provide clearer insights into what went wrong and help with troubleshooting

The event record is modified as follows:

if (handAfter > 21) {
// emit PlayerLostTheGame("Player is bust", handAfter)
emit PlayerLostTheGame("Player busts after hit", handAfter);
endGame(msg.sender, false);
}
Updates

Lead Judging Commences

inallhonesty Lead Judge 11 months ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.