The joinGameWithToken function in the RockPaperScissors contract contains a misleading error message that contradicts the actual requirement being checked. The function verifies that game.bet == 0 to ensure the game being joined is a token-based game rather than an ETH-based game, but the error message incorrectly states "This game requires ETH bet" when the exact opposite is true.
The issue is found in the joinGameWithToken function:
The function is designed to allow users to join token-based games, where the bet amount (game.bet) should be 0. However, the error message indicates the opposite requirement, stating "This game requires ETH bet" when the check fails.
User Experience: Users may be confused by the error message, as it contradicts what they're trying to do.
Integration: Developers integrating with this contract might misinterpret the requirements based on the error message.
Debugging: The misleading message could complicate debugging efforts during development or maintenance.
The issue is especially problematic because the error message directly contradicts the check's purpose, potentially causing confusion rather than providing helpful guidance.
Manual code review
Replace the misleading error message with an accurate description:
Code suggestions or observations that do not pose a direct security risk.
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.