Description: The check logic used to determine if game has ended in both EggHuntGame::endGame
and EggHuntGame::getGameStatus
checks whether block.timestamp
is less than or equal to EggHuntGame::endTime
. This implies that when the current time is exactly the same as the stipulated end time, a player can still search for eggs. However, the expected behaviour is that when the current time reaches the end time, the game should be over — players should no longer be allowed to search for eggs, and game status should indicate that the game time has elapsed.
These can be seen in the code snippet below:
Impact: The intended game rule is violated by allowing players to join the game when the current time is equal to the game's end time. This will allow players to gain an unfair advantage by continuing to search for eggs after the game should have ended. It might also cause confusion for players checking to know if the game has ended.
Proof of Code:
Code:
Recommended Mitigation: The comparison logic in EggHuntGame::searchForEgg
and EggHuntGame::getGameStatus
functions should be updated to use a strict less-than (<)
condition instead of less-than-or-equal (<=)
. This will ensure that when the current time reaches the stipulated end time, the game status will correctly show that the game has ended and players will not be able to search for eggs.
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.