In SpiceAuction
, removeAuctionConfig
is used to remove auction config for last epoch
. But it doesn't delete the first added config
until it's started and starting an auction requires config.minimumDistributedAuctionToken
to be added in the contract.
The function removeAuctionConfig
has following check to ensure that it doesn't delete the config
when _currentEpchId == 0
. https://github.com/Cyfrin/2024-07-templegold/blob/main/protocol/contracts/templegold/SpiceAuction.sol#L112-L113
However, the config
will be added from index 1
in auctionConfigs
array.
Due to this, to remove the auctionConfigs[1]
, it will need to be started first by calling startAuction
and sending auctionTokens
more than config.minimumDistributedAuctionToken
in the SpiceAuction
contract. Once the auction is started but in cooldown(not active yet),daoExecutor
will be able to remove
that auction by calling removeAuctionConfig
which will remove the auctionConfig
. However, if cooldown
can be 0
, it may be the case that deletion of first added auction config won't be possible.
TLDR: removeAuctionConfig
gives a way to remove the auctionConfig
which is next to the _currentEpochId
but it will not be usable in case of first added auction config.
Steps to Reproduce:
1) daoExecutor
adds the first config by calling setAuctionConfig
.
2) daoExecutor
wants to remove the config added in step 1 and calls removeAuctionConfig
but it reverts.
3) daoExecutor
needs to start the auction by sending funds greater than config.minimumDistributedAuctionToken
4) daoExecutor
now calls removeAuctionConfig
again to remove the config set in step 1.
It should be clear that step 4 would only work if config.cooldown
is non-zero. In other case, it won't be possible to delete the added config by daoExecutor
.
removeAuctionConfig
function doesn't work as intended and it may require some extra steps along with sending the funds to start an auction to remove the added config
Manual review
The project will need to remove the following check from 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.