TempleGold

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

The `DaiGoldAuction::startAuction` function uses the `storage` keyword to read data from the blockchain with no intention to make state changes within the function call which will cost more gas than necessary

Summary

DaiGoldAuction::startAuction function uses storage instead of memory which will cost more gas than necessary

Vulnerability Details

The DaiGoldAuction::startAuction function uses the storage keyword to read data from the blockchain

AuctionConfig storage config = auctionConfig;

and did not cause any changes to the state variable within that function.

Impact

Because the DaiGoldAuction::startAuction function uses the storage keyword to read data from the blockchain without causing any changes to the state variable within that function, it attracts unnecessary gas. It would be cheaper to use the memory keyword in this scenaro since the function is not causing any state changes to the auctionConfig variable.

Tools Used

Manual review

Recommendations

The section of DaiGoldAuction::startAuction function that reads the auctionConfig variable from the blockchain can be rearranged as follows

if (!prevAuctionInfo.hasEnded()) { revert CannotStartAuction(); }
- AuctionConfig storage config = auctionConfig;
+ AuctionConfig memory config = auctionConfig;
/// @notice last auction end time plus wait period
if (_currentEpochId > 0 && (prevAuctionInfo.endTime + config.auctionsTimeDiff > block.timestamp)) {
revert CannotStartAuction();
}
Updates

Lead Judging Commences

inallhonesty Lead Judge 12 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

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