The internal function in PerpetualVault.sol _settle() sets _gmxLock = true before calling gmxProxy.settle(orderData). However, there is no mechanism to reset _gmxLock back to false, which can cause the contract to remain locked and prevent further interactions such as deposits, withdrawals, or new trade executions.
_gmxLock is used as a mutex lock to prevent re-entrant or overlapping operations.
In _settle(), it is set to true before calling gmxProxy.settle(orderData).
If _gmxLock is never reset, all functions that check _gmxLock before execution will always revert or fail, effectively locking the contract indefinitely.
This issue can break vault operations by preventing any further trading, withdrawals, or deposits.
Contract Gets Stuck:
_gmxLock remains true, preventing any further trades, withdrawals, or deposits.
The vault becomes non-functional after _settle() is called.
User Funds Become Inaccessible:
Users may not be able to withdraw their funds if _gmxLock prevents further operations.
Operational Failure & Loss of Trading Opportunities:
Automated trading logic relying on _settle() will fail due to the locked state, potentially resulting in missed trading opportunities or financial losses.
Manuel Review
✅ Fix: Ensure _gmxLock is reset after gmxProxy.settle(orderData) is executed.
Modify _settle() as follows:
Alternatively, if settle() is asynchronous, reset _gmxLock in a callback function once settlement is confirmed.
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.