TempleGold

TempleDAO
Foundry
25,000 USDC
View results
Submission Details
Severity: medium
Invalid

"startCooldown can be zero" but if it is zero then it reverts

Summary

In https://github.com/Cyfrin/2024-07-templegold/blob/57a3e597e9199f9e9e0c26aab2123332eb19cc28/protocol/contracts/templegold/SpiceAuction.sol#L97

Comment says that startCooldown can be zero but it reverts if it is zero.

/// @dev startCooldown can be zero
if (
_config.waitPeriod == 0 || _config.minimumDistributedAuctionToken == 0
) {
revert CommonEventsAndErrors.ExpectedNonZero();
}
if (_config.recipient == address(0)) {
revert CommonEventsAndErrors.InvalidAddress();
}

Vulnerability Details

Users who wants to start an auction have to wait for cooldown period. This will make users attend less auctions and lead to waste of time.

Impact

Medium

As a PoC, include the following test in the SpiceAuction.t.sol

function test_setAuctionConfig_waitPeriodCannotBeZero() public {
ISpiceAuction.SpiceAuctionConfig memory config = _getAuctionConfig();
config.waitPeriod = 0;
vm.startPrank(daoExecutor);
vm.expectRevert(CommonEventsAndErrors.ExpectedNonZero.selector);
spice.setAuctionConfig(config);
vm.stopPrank();
}

Tools Used

Manual review

Recommendations

If the comment is true then:

- if (
- _config.waitPeriod == 0 || _config.minimumDistributedAuctionToken == 0
- ) {
- revert CommonEventsAndErrors.ExpectedNonZero();
- }
+ if (_config.minimumDistributedAuctionToken == 0) {
+ revert CommonEventsAndErrors.ExpectedNonZero();
}
if (_config.recipient == address(0)) {
revert CommonEventsAndErrors.InvalidAddress();
}
Updates

Lead Judging Commences

inallhonesty Lead Judge 12 months ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

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