TempleGold

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

The `DaiGoldAuction::setAuctionStarter` will cost more gas than necessary when it reverts

Summary

DaiGoldAuction::setAuctionStarter function does not follow CEI (Checks, Effects, Interactions) which could cost more gas than necessary when it reverts

Vulnerability Details

The DaiGoldAuction::setAuctionStarter function effects a state change before checking for the condition

if (!epochs[_currentEpochId].hasEnded()) { revert InvalidOperation(); }

instead of checking for the condition before causing change in the state variable

Impact

Because the DaiGoldAuction::setAuctionStarter function does not follow CEI, the function will cost more gas than necessary when it reverts.

Tools Used

Manual review

Recommendations

The DaiGoldAuction::setAuctionStarter function can be rearranged as follows

function setAuctionStarter(address _starter) external override onlyElevatedAccess {
/// @notice No zero address checks. Zero address is a valid input
- auctionStarter = _starter;
if (!epochs[_currentEpochId].hasEnded()) { revert InvalidOperation(); }
+ auctionStarter = _starter;
emit AuctionStarterSet(_starter);
}
Updates

Lead Judging Commences

inallhonesty Lead Judge about 1 year ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

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