The endGame()
function allows the owner to terminate the game before the scheduled endTime
, disrupting the game's fairness and expected duration.
Location: EggHuntGame.sol
, endGame()
function
Code Snippet:
Issue:
Missing Time Validation: The owner can call endGame()
at any time (even before endTime
), forcibly stopping the game.
Contradicts Game Logic: The searchForEgg()
function checks both gameActive
and block.timestamp <= endTime
. Prematurely setting gameActive = false
blocks players from searching even during the valid game period.
Attack Scenario:
Game is scheduled to run for 24 hours (startTime = T, endTime = T + 86400).
Owner calls endGame()
at T + 12 hours.
gameActive
becomes false
, and players cannot call searchForEgg()
despite 12 hours remaining.
Manual review
Restrict endGame()
to Post-endTime
(If Manual Control is Necessary):
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.