Rock Paper Scissors

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

Gas Optimization Opportunities in the `RockPaperScissors::_determineWinner()` function

Description: The winner determination logic could be optimized to reduce gas costs.

Impact: Higher than necessary gas costs for turn processing

Proof of Concept:

// Current implementation
if (game.moveA == game.moveB) {
// Tie
} else if ((game.moveA == Move.Rock && game.moveB == Move.Scissors) ||
(game.moveA == Move.Paper && game.moveB == Move.Rock) ||
(game.moveA == Move.Scissors && game.moveB == Move.Paper)) {
// Player A wins
}

Recommended Mitigation: Use bitwise operations or mathematical comparisons instead of multiple conditionals.

Updates

Appeal created

m3dython Lead Judge about 2 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.

Gas Optimization

Support

FAQs

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