The gameActive
variable is set to false
only when the owner call the EggHuntGame::endGame
function. But this variable is not taken into account in the EggHuntGame::getTimeRemaining
function returning an incorrect time remaining.
The function EggHuntGame::getTimeRemaining
calculates the time remaining of the game based on block.timestamp
and does not take into account the gameActive
variable.
For example, if the owner starts a 10 min game and when 5 mins have passed he decides to call the EggHuntGame::endGame
function, the game should be considered finished, but the EggHuntGame::getTimeRemaining
function will say that there are still 5 mins left.
Incorrect return of the seconds remaining in the game.
Foundry
Manual Review
Start a 10 minutes game.
Let pass 5 mins.
As the owner, end the game.
Call the EggHuntGame::getTimeRemaining
function and check the seconds remaining are 0.
Copy this test on EggHuntGameTest.t.sol
and see that it fails.
Take into account the gameActive
variable.
Incorrect values reported when a game is ended early
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.