Deadlock could potentially occur in announceLeverageClose and announceLeverageAdjust Functions
Summary
In the context of the announceLeverageClose and announceLeverageAdjust functions, a deadlock could potentially occur due to the use of the lock function. The lock function is used to prevent a resource (in this case, a token) from being accessed by other processes while it is being used.
Vulnerability Detail
A user calls the announceLeverageClose or announceLeverageAdjust function, which in turn calls the lock function to lock a token.
If the function fails after the token is locked but before it is released, the token remains locked.
Any subsequent attempts to access the locked token (for example, by calling the announceLeverageClose or announceLeverageAdjust function again) will fail because the token is still locked from the previous call.
This results in a deadlock situation where the token cannot be accessed or unlocked because the process that locked it is waiting for resources to complete.
cheatcode
medium
Deadlock could potentially occur in announceLeverageClose and announceLeverageAdjust Functions
Summary
In the context of the
announceLeverageClose
andannounceLeverageAdjust
functions, a deadlock could potentially occur due to the use of thelock
function. Thelock
function is used to prevent a resource (in this case, a token) from being accessed by other processes while it is being used.Vulnerability Detail
announceLeverageClose
orannounceLeverageAdjust
function, which in turn calls thelock
function to lock a token.announceLeverageClose
orannounceLeverageAdjust
function again) will fail because the token is still locked from the previous call.Impact
DoS
Code Snippet
https://github.com/sherlock-audit/2023-12-flatmoney/blob/main/flatcoin-v1/src/DelayedOrder.sol#L317
Tool used
Manual Review
Recommendation