Rock Paper Scissors

First Flight #38
Beginner FriendlySolidity
100 EXP
View results
Submission Details
Severity: low
Invalid

Game might get stuck in limbo if `totalTurns` is too high.

Summary

If totalTurns are high enough to cause any player's score reaching a certain value, game can never be ended.

Vulnerability Details

totalTurns is set as uint256, yet scoreA and scoreB are only uint8. Because of this, if totalTurns are high enough to breach uint8, then the first attempt of breaching it will cause automatic revert (due to built-in safemath - lowest totalTurns that could trigger this is 511 - without a draw, one player's score will try to reach 256 and keep reverting since the value is off-limit), and since a game with non-zero score is also unable to be cancelled, it will simply get stuck.

Impact

Since the game gets stuck in limbo, all the tokens put into the game as bet will be lost. However, realistically, requirements for this sort of bugs to happen is pretty low (since playing a game with more than 500 turns is just too long).

Recommendations

Raise data types of scoreA and scoreB accordingly with totalTurns (namely uint256) to prevent the issue.

Updates

Appeal created

m3dython Lead Judge 5 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity
Assigned finding tags:

Informational

Code suggestions or observations that do not pose a direct security risk.

Support

FAQs

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