Root: The buySnow
function accepts amount = 0
without reverting, proceeding with state updates and events;
Impact: Wastes gas and allows unintended state manipulation without token minting.
The buySnow
function processes amount = 0
, triggering _mint(msg.sender, 0)
or a zero WETH transfer, updating s_earnTimer
and emitting SnowBought without minting tokens.
This violates the intent of a purchase function, leading to unnecessary gas costs and potential abuse.
Likelihood:
When a user or attacker calls buySnow(0)
within the farming period.
During normal operation with invalid inputs.
Impact:
Incurs gas costs without value (low).
Potential state manipulation (e.g., s_earnTimer) for abuse (medium).
Zero Amount Test: Calling buySnow(0) succeeds without reverting.
And when we hide the expectEmit line for it to pass and run forge test --mt testBuySnowZeroAmount -vv
we get:
Result: Jerry's tokens after zero mint: 0, Earn timer updated: true, showing state change without minting.
Add a check to revert for amount = 0.
When buySnow is successfully called, the global timer is reset. This inadvertently affects the earning of snow as that particular action also depends on the global timer.
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.