The setEggFindThreshold function in the EggHuntGame contract allows the owner to set the egg-finding threshold to zero, which would make it impossible for any player to find eggs during the game. This effectively creates a Denial of Service (DoS) condition for the core functionality of the game.
In the EggHuntGame contract, the setEggFindThreshold function allows the owner to adjust the probability of finding eggs:
The function only checks that the threshold is less than or equal to 100, but does not prevent it from being set to zero. If eggFindThreshold is set to zero, it would likely be used in a comparison with a random number to determine if a player finds an egg. With a threshold of zero, this comparison would always fail, making it impossible for any player to find eggs.
Players would be unable to find any eggs and recources (gas) would be wasted.
Manual review
Implement a lower bound check in the setEggFindThreshold function to ensure the threshold is always greater than zero:
Strategy to save gas and minimize transaction costs
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.