https://github.com/Cyfrin/2024-07-templegold/blob/57a3e597e9199f9e9e0c26aab2123332eb19cc28/protocol/contracts/templegold/SpiceAuction.sol#L107
https://github.com/Cyfrin/2024-07-templegold/blob/57a3e597e9199f9e9e0c26aab2123332eb19cc28/protocol/contracts/templegold/SpiceAuction.sol#L160
https://github.com/Cyfrin/2024-07-templegold/blob/57a3e597e9199f9e9e0c26aab2123332eb19cc28/protocol/contracts/templegold/SpiceAuction.sol#L173
SpiceAuction::startAuction()
may revert when totalAuctionTokenAllocation - _claimedAuctionTokens[auctionToken] is larger than balance.
Whenever an auction is started totalAuctionTokenAllocation[auctionToken]
is incremented with the corresponding epochAuctionTokenAmount
. This logic is fine as it is, the problem comes when SpiceAuction::removeAuctionConfig()
is called for a startedAuction in cooldown.
In this method we don't have any handling of totalAuctionTokenAllocation[auctionToken]
rather we just delete the epoch with the info in it. This way totalAuctionTokenAllocation[auctionToken]
remains incremented and whenever we call startAuction()
again if in previous run
we had an increment that made the value of totalAuctionTokenAllocation[auctionToken]
higher that the current balance it may underflow and revert resulting in the DOS of startAuction()
.
High
Manual review
Update in SpiceAuction::removeAuctionConfig() _totalAuctionTokenAllocation[auctionToken] -= info.totalAuctionTokenAmount.
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.