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

fix: force thorchain swapper to wait for outbound tx confirmations on-chain #6143

Merged
merged 2 commits into from
Feb 7, 2024

Conversation

woodenfurniture
Copy link
Contributor

@woodenfurniture woodenfurniture commented Feb 7, 2024

Description

Prevents thor trades from being displayed as complete until the outbound tx is confirmated on-chain.

Pull Request Type

  • 🐛 Bug fix (Non-breaking Change: Fixes an issue)
  • 🛠️ Chore (Non-breaking Change: Doc updates, pkg upgrades, typos, etc..)
  • 💅 New Feature (Breaking/Non-breaking Change)

Issue (if applicable)

closes #6086

Risk

High Risk PRs Require 2 approvals

Low risk, trade confirmation is already somewhat broken in that it completes early.

What protocols, transaction types or contract interactions might be affected by this PR?

Testing

Check that thorchain trades only show as completed in the UI when they are in fact complete, not "pending outbound". Specifically thorchain trades that have an outbound tx, e.g RUNE -> something, or BTC -> AVAX. Not something -> RUNE.

NOTE: dont use viewblock to test this, use our app tx history

App can show as complete, while viewblock shows Pending: Outbound. This is because they index the blockchain slower than us:

image
image
image

And sure enough after giving them a moment to catch up, it's confirmed there too
image

Note @shapeshift/operations - we can also use THORNode /tx/ endpoint to test that the outbound Tx has been signed

Engineering

Operations

Screenshots (if applicable)

Outbound tx hash first seen, 0 confirmations. :
image

Trade continues to wait, with buy tx hash rendered and clickable. After some time, a confirmation is seen:
image

Trade is now shown as complete, in app and in viewblock for both txs:
image
image
image

@woodenfurniture
Copy link
Contributor Author

Current dependencies on/for this PR:

This stack of pull requests is managed by Graphite.

@woodenfurniture woodenfurniture marked this pull request as ready for review February 7, 2024 02:01
@woodenfurniture woodenfurniture requested a review from a team as a code owner February 7, 2024 02:01
@gomesalexandre gomesalexandre self-requested a review February 7, 2024 10:16
Copy link
Contributor

@gomesalexandre gomesalexandre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First pass, this looks good to me at a conceptual level pending runtime testing

Copy link
Contributor

@gomesalexandre gomesalexandre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Runtime testing:

Swap to RUNE

image
  • Confirmed this is still happy and completes pretty much instantly after inbound is seen since inner swaps to RUNE are effectively instant and do not trigger L1 outbounds

Swaps to EVM chain

  • isEvmCoinAsset now properly returns true for EVM chains 🎉
image
  • outbound confirmations are properly detected
image
  • trade properly goes to confirmed state after on-chain confirmation
image

Swaps to UTXOs

  • Trade is properly detected as complete after on-chain confirmation
image

Swap to ATOM

image

Note, I wasn't able to get to a confirmed state after outbound signed and on-chain confirmation, but logic is the same here, the issue here is there's a transient issue with unchained:

image

@gomesalexandre gomesalexandre merged commit d4e0d05 into develop Feb 7, 2024
4 checks passed
@gomesalexandre gomesalexandre deleted the patient-thorchain-trades branch February 7, 2024 11:28
0xApotheosis added a commit that referenced this pull request Feb 7, 2024
* feat: hide virtual pools in Thorchain LP "Available Pools" view

* feat: thorchain LP halted pool tag

* fix: force thorchain swapper to wait for outbound tx confirmations on-chain (#6143)

* fix: import

---------

Co-authored-by: woody <125113430+woodenfurniture@users.noreply.github.com>
Co-authored-by: Apotheosis <97164662+0xApotheosis@users.noreply.github.com>
This was referenced Feb 8, 2024
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.

Streaming swaps completion state errors
2 participants