the compound function allows the keeper to swap a token for TokenA or TokenB and add it as liquidity to GMX
. However, if the deposit get cancelled, the contract enters a compound_failed
status. leading to a deadlock and preventing further protocol interactions.
-The compound function is invoked by the keeper to swap a token held by the contract (e.g., from an airdrop as sponsor said) for TokenA or TokenB. Initially, it exchanges this token for either tokenA or tokenB and sets the status to compound
. Then, it adds the swapped token as liquidity to GMX
by creating a deposit:
In the event of a successful deposit, the contract will set the status to open
again. However, if the deposit is cancelled, the callback will call processCompoundCancellation()
function and the status will be set to compound_failed
as shown in the following code:
The issue arises when the deposit is cancelled, and the status becomes compound_failed
. In this scenario, only the compound function can be called again and only by the keeper, but the tokens have already been swapped for TokenA or TokenB (Because we successfully create a deposit in GMX
that means the swap was successfull). Consequently, the amountIn
will be zero, and in this case the compound logic will be skipped.
As a result, the status will remain compound_failed
, leading to a deadlock. If keeper continue to call this function, no progress will be made, only gas will be wasted. Furthermore, all interactions with the protocol are impossible since the status is compound_failed
.
strategy vault stuck at compond_failed
status. prevent any interaction with the protocol
keeper may waste a lot of gas trying to handle this situation .
manual review
in the event of a deposit get cancelled when trying to compound. just add liquidity again without the swapping logic.
Impact: Medium Likelihood: Low Impact is not high because keepers can provide small amount of airdrop tokens (probably with the help of the protocol team). Weak medium for now.
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.