The RockPaperScissors contract implements timeout mechanisms for both the join phase and reveal phase, but critically lacks a timeout mechanism for the commit phase. This fundamental oversight allows malicious players to permanently block games by simply refusing to commit their moves, resulting in locked funds and unresolvable game states.
While the contract properly handles timeouts for other game phases with functions like timeoutJoin
and timeoutReveal
, there is no equivalent mechanism to handle situations where players refuse to commit their moves:
This vulnerability is especially problematic in multi-round games, as a player who realizes they are at a disadvantage can exploit this to prevent the game from reaching its natural conclusion.
This vulnerability results in several critical issues:
Fund Lockup: Players' bets can be permanently locked in the contract with no mechanism to recover them
Denial of Service: Games can be intentionally stalled by uncooperative players
Griefing Attacks: Players who realize they are likely to lose can hold games hostage
Economic Damage: The inability to complete games or recover funds discourages participation
Manual review
Consider this scenario in a 5-round game:
Player A has won 1 round
Player B has won 2 rounds
Player A realizes that even winning the remaining rounds would only result in a tie at best
Player A simply refuses to submit a commit for the next round
The game is permanently stuck in the commit phase
No timeout function can be called
Both players' bets remain locked in the contract indefinitely
Unlike the reveal phase, where timeouts can be triggered to resolve the game, the commit phase provides no resolution mechanism.
Implement a comprehensive commit phase timeout system:
Add a commit deadline to the Game struct:
Set the commit deadline when appropriate:
Implement a timeout function for the commit phase:
Add a helper function to check if commit timeout is possible:
Protocol does not provide a way for Player B to exit a game and reclaim their stake if Player A stops participating
Protocol does not provide a way for Player B to exit a game and reclaim their stake if Player A stops participating
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.