Eggstravaganza

First Flight #37
Beginner FriendlySolidity
100 EXP
View results
Submission Details
Severity: low
Valid

Missing check for endTime in endGame() __ EggHuntGame.sol

Summary

The endGame function doesn't check if the gameTime has actually ended.

Vulnerability Details

Currently, the function assumes that the game has ended based on the gameActive flag. However, without verifying that the endTime has been reached, the owner could prematurely end the game.

This could allow:

  • Fewer players to join or participate.

  • Confusion among players who still see the game as ongoing based on the timer.

/// @notice Ends the egg hunt game.
function endGame() external onlyOwner {
require(gameActive, "Game not active");
gameActive = false;
emit GameEnded(block.timestamp);
}

Impact

Game could be ended early

Players may be confused, especially if the time/UI shows the game as ongoing

Tools Used

Manual review

Recommendations

Add a time check to ensure the game duration has completed before allowing it to end:

require(block.timestap >= endTime, "Game time not over yet");
Updates

Lead Judging Commences

m3dython Lead Judge about 2 months ago
Submission Judgement Published
Validated
Assigned finding tags:

Incomplete end game handling

Incorrect values reported when a game is ended early

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.