The issue is that auction config of auctions that started but their cooldown is not reached cannot be removed making the function not do of what it is indented to do.
As we can see one of the intention for removeAuctionConfig function is to be able to remove and delete config for current auction that is started but the cooldown for auction is not reached.
https://github.com/Cyfrin/2024-07-templegold/blob/57a3e597e9199f9e9e0c26aab2123332eb19cc28/protocol/contracts/templegold/SpiceAuction.sol#L116
So the current way that it is done is this:
https://github.com/Cyfrin/2024-07-templegold/blob/57a3e597e9199f9e9e0c26aab2123332eb19cc28/protocol/contracts/templegold/SpiceAuction.sol#L119C1-L127C15
The current removeAuctionConfig check if auction in current epoch is active and if it has ended and revert if true as it should, but it does not check if auction is started but the cooldown was not reached so it can remove the current epoch and configuration as intended by protocol.
It should use EpochLib::hasStarted check to see if auction is started but the cooldown is not reached.
https://github.com/Cyfrin/2024-07-templegold/blob/57a3e597e9199f9e9e0c26aab2123332eb19cc28/protocol/contracts/templegold/EpochLib.sol#L17
The issue is also that also hasStarted has the wrong check.
https://github.com/Cyfrin/2024-07-templegold/blob/57a3e597e9199f9e9e0c26aab2123332eb19cc28/protocol/contracts/templegold/EpochLib.sol#L17
It will return true if startTime is bigger than 0 and if block.timestamp is equal or bigger than startTime.
If we check how startTime is calculated we can see this:
DaiGoldAuction - https://github.com/Cyfrin/2024-07-templegold/blob/57a3e597e9199f9e9e0c26aab2123332eb19cc28/protocol/contracts/templegold/DaiGoldAuction.sol#L122
As we can see in both configuration's start time is sum of block.timestamp + starting coldown of the auction.
In isActive check se can see that auctions is considered active it block.timestamp is between start and end time:
https://github.com/Cyfrin/2024-07-templegold/blob/57a3e597e9199f9e9e0c26aab2123332eb19cc28/protocol/contracts/templegold/EpochLib.sol#L9
So in our hasStarted function it will return true if block.timestamp is bigger or equal of startTime which then it would go inisActive time frame making function hasStarted inaccurate and lose it's purpose (it's purpose is to show us that auction is started but cooldown is not reached)
Auction in SpiceAuction can't be removed as intended which will make protocol not be able to remove auctions and epoch that are started but the cooldown for starting auction's is not reached.
Manual Review.
First change the hasStarted function to correctly checks
Then implement hasStarted check in removeAuctionConfig
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.