Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

backport: dex: hotfix for 2025-01-18 chain halt #4996

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

conorsch
Copy link
Contributor

Describe your changes

This PR backports #4993, which was made against the release/v0.81.x branch, to the main branch, so it's included in ongoing development.

## 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)
@conorsch conorsch requested a review from erwanor January 19, 2025 19:03
@conorsch conorsch deployed to smoke-test January 19, 2025 19:03 — with GitHub Actions Active
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants