The resetGame()
function contains a redundant state variable reset that is guaranteed to be unnecessary due to the game's flow control. In resetGame()
:
However, the pot
variable is already guaranteed to be zero when resetGame()
is called due to the following logical flow:
resetGame()
has the gameEndedOnly
modifier, meaning it can only be called after a game has ended
The only way a game can end is through declareWinner()
function
In declareWinner()
the pot is explicitly reset to zero:
Therefore, pot = 0;
in resetGame()
is always redundant since the pot is guaranteed to already be zero.
Unnecessary SSTORE operation costs ~5,000 gas for setting an already-zero value to zero
Remove the redundant pot = 0;
line from the resetGame()
function:
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.