-
Notifications
You must be signed in to change notification settings - Fork 182
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
State corruption in swapper when multiple trades are in flight #7161
Comments
I did try to reproduce but it's super hard and cost really much, I'm not even sure that this is a Also I couldn't reproduce using an EVM tx as well as a thorchain Native to Native swap at the same time, might be only scoped to thorchain swaps We might go further by using something like AVAX => BCH as it would cost less |
Note for grooming: we may want to use this as an opportunity to discuss handling pending Txs in the app, e.g initiating a THOR Tx but leaving the swapper, or quitting the app/leaving the swapper mid multi-hop Txs - somehow related to #7255 |
Note for assignee taking this task: The solution will be to:
|
Overview
The swapper is getting state updates from other trades when there is more than 1 trade currently in flight, resulting in corrupted state and incorrect states in the UI, as well as incorrect tx links.
References and additional details
Performing RUNE -> BTC trade immediately followed by BTC -> RUNE trade results in the execution polling both txs and shoving state from both into the same UI - note state flip-flopping between inbound and outbound and incorrect tx links:
Screen.Recording.2024-06-18.at.10.31.43.AM.mov
On completion the status corrects itself and the bogus tx link is removed:
the correct tx link:
https://viewblock.io/thorchain/tx/6c99c929485f1fc19494319fabccdc89eee841f0c8c682a0bf6f04a5395352fb
the bogus one:
https://viewblock.io/thorchain/tx/73D82DFCBB714CF911C321D51582D7517368E26EC80D5117184D2A158346B73C
See
src/components/MultiHopTrade/components/MultiHopTradeConfirm/hooks/useTradeExecution.tsx
- polling is supposed to be canceled on unmont, so that is either broken or the component isn't actually unmounted when going back to tradeinput page:Acceptance Criteria
A given trade should only receive status updates for itself. Other trade polling should be unmounted or cancelled.
Need By Date
No response
Screenshots/Mockups
No response
Estimated effort
No response
The text was updated successfully, but these errors were encountered: