-
Notifications
You must be signed in to change notification settings - Fork 80
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(swap): ensure long running cross chain swaps eventually shows completed status #5704
Conversation
transactionHash: transaction.transactionHash || '', | ||
block: '', | ||
fees: [], | ||
...transaction, // in case the transaction already has the above (e.g. cross chain swaps), use the real values |
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.
this small change ensures the received pending cross chain swaps can display the fees in the tx details
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.
can we cover this new behavior with a test to ensure new TX data overrides old data?
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #5704 +/- ##
========================================
Coverage 86.92% 86.92%
========================================
Files 782 782
Lines 32315 32315
Branches 5339 5633 +294
========================================
+ Hits 28090 28091 +1
+ Misses 4175 3984 -191
- Partials 50 240 +190
... and 78 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
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.
LGTM, just small comments
src/transactions/feed/queryHelper.ts
Outdated
) | ||
transactionsWithoutDuplicatedHash.sort((a, b) => { | ||
const transactionsByTxHash: { [txHash: string]: TokenTransaction } = {} | ||
existingTxs.forEach((transaction) => { |
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.
nit: can do
[...existingTxs, ...incomingTxs].forEach((transaction) => {
transactionsByTxHash[transaction.transactionHash] = transaction
})
to save some space
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.
TY, updated!
transactionHash: transaction.transactionHash || '', | ||
block: '', | ||
fees: [], | ||
...transaction, // in case the transaction already has the above (e.g. cross chain swaps), use the real values |
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.
can we cover this new behavior with a test to ensure new TX data overrides old data?
Description
This PR fixes a bug where pending cross chains swaps remain pending forever. The root cause is the query helper reconciles already received transactions with newly received transactions by preferring the already received transaction. This means that previously received pending swaps are not updated when the same transactions is received again with the completed status.
This is a bug that affects not only cross chain swaps (we should always prefer the newest information in case other fields in the transaction have changed.
Test plan
Cross chains swaps can be settled correctly
Related issues
n/a
Backwards compatibility
Y
Network scalability
If a new NetworkId and/or Network are added in the future, the changes in this PR will: