Impact | Likelihood | Overall |
---|---|---|
High | Low | Medium |
The contract provide functionality to pause the vault in some emergency situation. The function doesn't check the state of the vault, because it is "emergency" and so it should be possible to trigger it any time. However, this could result in user loses, if it is called at the wrong time (in between user interactions like deposit or withdraw).
The problem comes from the two way transaction process for GMX vaults and safety checks, which are implemented in the protocol.
For example if a user initiate a deposit transaction with $1000 USDC on vault X, the vault will add those tokens as liquidity to GMX and put the vault in state of "Deposit".
The problem arise from that it is possible to put the vault in state of "Paused", before the callback from GMX router, which would initiate vault tokens being minted and sent to the user. The callback will revert, because the state of the vault is "Paused":
So the result is depositor looses his $1000, which benefit other depositors, whose vault token shares now worth more.
User's funds loss
Manual Review
Maybe consider medium state before "Paused", which would pass the check for processDeposit
and officially pausing it after proceessDeposit.
Note that:
This is a solution if you want to maintain the opportunity to pause the protocol in any state and you should carefully examine all other related to deposit
functions, such as "onCancelation", etc...
Here I provide just a basic example of how it could be achieved, but you should pay attention to the callbacks of deposit
on the other states.
If you don't want to add more complexity, you could just prohibit pause
to be executed, when the vault is in state "Deposit" and wait until it is safe to execute the function.
Example:
emergencyPause
:
processDeposit
:
Impact: High Likelihood: Low/Medium Deposit or withdraw that were in progress will be ignored and cause fund loss. Because emergencyPause is only callable by keepers, Medium is the proper severity.
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.