In the current system, when an account is liquidated, only on-chain orders are cleared, leaving off-chain orders active. If a user deposits more funds after liquidation and the market prices align, these off-chain orders might get executed against the user’s intentions. This situation can open unwanted positions, contrary to the user’s wishes, particularly with Take Profit (TP) and Stop Loss (SL) orders.
When an account is liquidated, the existing on-chain market orders are cleared, but the off-chain orders remain active. If the user deposits additional funds into their account and the market conditions match the criteria of these off-chain orders, they can be executed. This unintended execution can lead to undesired trades, such as opening short positions via TP orders and long positions via SL orders, against the user’s intentions.
### Key Points:
1. **Current Behavior**:
- On-chain market orders are cleared during liquidation.
- Off-chain orders remain active and are not invalidated.
2. **Issue**:
- After liquidation, if the user deposits more funds, off-chain orders might execute based on new market conditions.
- This can lead to unintended trades that do not align with the user’s current intentions.
3. **Desired Behavior**:
- Both on-chain and off-chain orders should be cleared during liquidation to prevent unintended trades.
Offchain order aligns with market condition on new deposit
The above order is successfully executed.
This vulnerability can lead to significant unintended trades, affecting the user’s positions. It is classified as a high-severity issue due to the direct involvement of user funds and the potential for executing trades against the user’s intentions.
- Manual Solidity code analysis
- Review of order management logic
**Clear Off-chain Orders During Liquidation**: Ensure that off-chain orders are also cleared when an account is liquidated. This can be achieved by invalidating the off-chain orders by bumping the nonce or similar mechanisms.
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.