[L-01] Incorrectly displays the remaining time until the end of underlying game
The following function EggHuntGame.sol::getRemainigTime()
gives back information of the remaining time until end of the active game. The implementation checks only the current time against endTime
. The wrong behavior comes when the game owner terminates earlier the game (before the game duration is expired) and only the state variable gameActive
is updated, without resetting endTime
. Missing check in EggHuntGame.sol::getRemainigTime()
for the state gamActive
leads to calculating incorrect remaining time in the game.
Missing check for the state gameActive
within functionEggHuntGame.sol::getRemainigTime()
leads to:
incorrect calculations of remaining time in the game when the game is terminated earlier than the duration is expired
misleading the active players and other potential participant that there is still a running game, when the game is terminated earlier of duration expiration
Manual review
Foundry
Add the following test to EggHuntGameTest.t.sol
.
Update the following check within EggHuntGame.sol::getTimeRemaining()
in order to calculate remaining time in the game correct. This way the calculations will be correct, even the game has been terminated before the durataion is expired.
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.