The recoverTokens() function in SpiceAuction reverts when attempting to recover tokens from the first-ever spice auction. This issue prevents the daoExecutor from recovering tokens, potentially leading to a loss of funds.
The recoverTokens() function is designed to allow the daoExecutor to recover tokens from the contract. However, when attempting to recover tokens from the first-ever spice auction, the function reverts due to a flaw in the logic that handles token recovery. This issue occurs because the initial state does not properly account for the first ever auction, causing the function to fail when it is executed for the first time.
If the daoExecutor is unable to recover tokens from the first-ever spice auction, it can lead to several issues:
Token Lock-up: The tokens intended for recovery may become permanently stuck in the contract.
Financial Loss: The inability to recover tokens can result in financial losses for users and the daoExecutor.
Contract Usability: The contract's functionality can be compromised, making it unreliable and potentially unusable for its intended purpose.
The following code demonstrates the issue by showing the recoverTokens() function reverting when the daoExecutor attempts to recover tokens from the first-ever spice auction. This test can be added to your spiceAuction.t.sol test file and run with forge test --mt testAuctionTokenCannotBeRecoveredForFirstEverSpiceAuction
the test passes showing that it was expecting a revert in the last line of the code
To fix this issue, update the logic in the recoverToken() function to correctly handle the initial state of the first-ever spice auction. Ensure that the function can account for the first auction and recover tokens as expected.
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.