Rock Paper Scissors

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

[L-1] Gas Inefficiency: commitMove Can Be Called Even After Both Players Have Committed

Description

In commitMove, a player can still call the function even when both players have already committed their moves. For example:

require(game.moveA == Move.None && game.moveB == Move.None, "Moves already committed for this turn");

This allows players to waste gas by calling the function when no valid action will be taken, especially if they've already submitted a commit and there's no check preventing further calls.

Impact

  • Unnecessary gas consumption

  • Potential for spam transactions with no effect

  • Increased operational cost without value

Recommended Mitigation:

Add early require checks to ensure a player cannot commit again once they've already submitted a move for the current turn.

Updates

Appeal created

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

Gas optimization

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

Gas optimization

Support

FAQs

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