Snowman Merkle Airdrop

First Flight #42
Beginner FriendlyFoundrySolidityNFT
100 EXP
View results
Submission Details
Severity: low
Valid

Blocking 'earnSnow()' by Executing 'buySnow()'

Description: Calling 'buySnow()' sets 's_earnTimer', which is used to restrict 'earnSnow()'.

Impact: Any user who buys Snow resets the earn timer for the entire system, blocking legitimate use.

Proof of Concept: Include the following test in the TestSnow.t.sol file:

function testCanEarnSnowAfterBuy() public {
vm.prank(victory);
snow.buySnow{value: FEE}(1);
vm.prank(victory);
vm.expectRevert();
snow.earnSnow();
}

Recommended Mitigation: Remove 's_earnTimer' entirely from 'buySnow()':

function buySnow(uint256 amount) external payable canFarmSnow {
// ...
- s_earnTimer = block.timestamp;
emit SnowBought(msg.sender, amount);
}
Updates

Lead Judging Commences

yeahchibyke Lead Judge 3 months ago
Submission Judgement Published
Validated
Assigned finding tags:

buying of snow resets global timer thus affecting earning of free snow

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.

Support

FAQs

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