Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
dex: hotfix for 2025-01-18 chain halt (alternative) (#4994)
## Describe your changes This commit fixes the chain halt that occurred on 2025-01-18 at block 3093519. ### What happened (short version): A transaction was submitted that contained both `PositionClose` and `PositionWithdraw` actions for the same position `P`, which had been auto-closed by the DEX. In `DeliverTx`, the `PositionClose` action queued the position for closure by ID, and the `PositionWithdraw` action checked that the position state was closed and then updated it to Withdrawn. Later, in `EndBlock`, the queued position closure was executed. The position state was not Opened or Closed, triggering an assertion. ### Why it happened - Mempool tx checking does not execute end block so this didn't get filtered out - The position closure method allows the position closure to be a no-op, but only for positions in the closed state - Because the position was withdrawn, the state was unexpected ### What this does Avoid queueing the position for closure unless it is Opened. (cherry picked from commit f7f780d)
- Loading branch information