The getGameStatus() function in the EggHuntGame contract contains a conditional branch that can never be executed, leading to dead code in the contract.
Specifically, the condition block.timestamp < startTime within the gameActive == true block is logically unreachable:
This condition is unreachable because in the startGame() function, gameActive is set to true at the same time as startTime is set to the current block.timestamp:
Dead code increases contract size unnecessarily
Potential confusion for developers maintaining the code
Slight increase in deployment gas costs
By analyzing the contract logic, we can see that:
gameActive is initially false
gameActive is set to true only in the startGame() function
In that same function, startTime is set to the current block.timestamp
Therefore, when gameActive is true, block.timestamp cannot be less than startTime
Manual review
Remove the unreachable condition and simplify the function:
This change makes the code more concise and easier to understand while maintaining the same functionality.
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.