Emergency Pauses will override the current status, and 'forget' about the overridden status once it resumes or shutdowns. This is a problem because actions are a two step process in this protocol.
When the emergency status is triggered, any transaction status will be overwritten, after Paused
is lifted, the Open
status is set again.
This is problematic because in this protocol any kind of transaction is actually not atomic ,they happen in two transactions, this is why this status concept was initially introduced to the protocol. However the emergency related functions completely disrupt this concept and introduce danger to the protocol.
If a user was in the middle of a deposit or withdraw, and some kind of emergency was to happen the user would essentially lose his funds as the process would be interrupted but not reverted.
Here below is a test that shows a concrete example where a user gets interrupted mid action and his funds are essentially eaten by the protocol. His money is lost and the protocol enjoys more lp tokens.
The impact is pretty severe, as a user would mourn his lost(stolen) founds. The necessary checks to finalize any transactions previously initialized won't be accessible anymore since the protocol resume to status Open
, or Closed
if the protocol doesn't resume to normal state at all.
Manual review
In order to solve this issue it would be best to introduce a previousStatus
enum variable that the protocol could refer to so that transactions could resume to this previous status, if processEmergencyResume
was to be triggered.
In the event of a market shut down with the emergencyClose
, it would be best if we let the protocol finish the transaction, it means that in the checks, the Closed
status should be accepted to proceed for further action. For example for the withdraw function it should look like this :
The same fix should be applied any further action related to user withdraws and deposits.
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.