-
Notifications
You must be signed in to change notification settings - Fork 307
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
dex: hotfix for 2025-01-18 chain halt (alternative) #4994
Conversation
Commit message and description TK
} | ||
.to_proto(), | ||
); | ||
state.queue_close_position(self.position_id).await?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK.
.ok_or_else(|| anyhow::anyhow!("could not find position {} to close", id))? | ||
.tap(|lp| tracing::trace!(prev_state = ?lp, "retrieved previous lp state")); | ||
|
||
if current_state.state == position::State::Opened { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK. short-circuit on queueing.
); | ||
let mut to_close = self.pending_position_closures(); | ||
to_close.push_back(id); | ||
self.object_put(state_key::pending_position_closures(), to_close); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK. queuing gated on valid state antecedent.
// queue position close you will... | ||
self.record_proto(event::EventQueuePositionClose { position_id: id }.to_proto()); | ||
} else { | ||
tracing::debug!( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK. no-op on contentious state antecedent.
## 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)
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
andPositionWithdraw
actions for the same positionP
, which had been auto-closed by the DEX. InDeliverTx
, thePositionClose
action queued the position for closure by ID, and thePositionWithdraw
action checked that the position state was closed and then updated it to Withdrawn. Later, inEndBlock
, the queued position closure was executed. The position state was not Opened or Closed, triggering an assertion.Why it happened
What this does
Avoid queueing the position for closure unless it is Opened.