The Rock Paper Scissors game smart contract does not allow players to update their committed moves, even if the reveal phase hasn't begun. This creates a poor user experience where players cannot correct mistakes in their commitments, potentially leading to unintended game outcomes, timeouts, and lost funds.
In the Rock Paper Scissors game, players follow a commit-reveal pattern where they first commit a hashed move (combining their move with a salt value) and later reveal the actual move with the salt. The issue arises in the commitMove function (lines 317-351), which doesn't allow players to update their commitments once made:
The issue specifically lies in the requirements require(game.commitA == bytes32(0), "Already committed") and require(game.commitB == bytes32(0), "Already committed"), which prevent players from updating their commitments once made, even if:
The reveal phase hasn't started yet
No one has revealed their move yet
The player realized they made a mistake with their salt or move
This creates a situation where a player who makes a mistake in their commitment:
May not be able to provide a valid reveal
Could be penalized by timing out during the reveal phase
Could lose their wagered funds unfairly
This vulnerability has several impacts:
Player Experience Degradation: Players cannot correct legitimate mistakes in their commitments.
Forced Timeouts: Players who commit incorrectly will be forced to time out during the reveal phase.
Unfair Outcomes: A player who knows they made a mistake must either forfeit or rely on the other player also failing to reveal.
Increased Support Burden: Game operators would likely face increased support requests from frustrated players who made commitment mistakes.
Manual code review
User flow analysis
Game theory analysis
Allow Commitment Updates:
Modify the commitMove function to allow players to update their commitments before the reveal phase begins:
Add Explicit Recommit Function:
Alternatively, add a dedicated function for updating commitments:
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.