The setEggFindThreshold function in the EggHuntGame contract lacks validation against zero values, which could accidentally disable the egg-finding mechanism entirely.
The current implementation of the setEggFindThreshold function only validates that the new threshold doesn't exceed 100:
If the owner sets the threshold to 0, it would make it impossible for any player to find eggs. This is because in the searchForEgg function, the random number generation produces values from 0 to 99, and an egg is only found when the random number is less than the threshold. With a threshold of 0, this condition can never be met, effectively breaking the core gameplay mechanism.
LOW severity as it can only be triggered by the contract owner. However, if triggered, it would completely halt egg discovery for all players and waste players gas fees on impossible egg searches.
Manual code review
Implement a minimum threshold check to ensure the game remains playable. Example:
Owner is trusted and is not expected to interact in ways that would compromise security
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.