The endGame()
function in EggHuntGame.sol
does not enforce that the configured game duration (endTime
) has passed. This allows the game owner to end the game early at any time, potentially breaking game fairness and player trust.
The startGame(duration)
function sets startTime
and calculates endTime
based on the duration provided by the owner. However, the endGame()
function can be called at any time, regardless of whether the game duration has completed.
Since there is no check like require(block.timestamp >= endTime)
, the owner can prematurely end the game and prevent other players from continuing their egg hunts.
This breaks the implied game rules and could be exploited in a scenario where rewards are distributed based on egg counts or other performance metrics.
Fairness Violation: Players expect the game to run for its full duration.
Potential Abuse: Malicious owner can end the game early to benefit specific participants.
Reduced Trust: Players may lose confidence if game behaviour is inconsistent with stated rules.
Manual Code Review
Foundry Test Suite
Add a timestamp check to ensure the game cannot be ended before its configured end time:
Owner is trusted and is not expected to interact in ways that would compromise security
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.