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: Multichain: UX: Check for transactions on all networks and QueuedRequestCount #25614

Merged
merged 2 commits into from
Jul 2, 2024

Conversation

darkwing
Copy link
Contributor

@darkwing darkwing commented Jul 1, 2024

Description

There's a case where there could be a race condition between the QueuedRequestController's network switching and the Routes' network switching. The root issue is that the use of getUnapprovedTransactions only gets transactions on the current chain, thus triggering Routes to switch networks once the last transaction of the current chain is done, but there could be more transactions on other chains which we should allow QRC to handle network switching for.

Thus, this PR lets QRC control network switching until there are absolutely no transactions or queued requests left.

This PR includes an **E2E** for the scenario where there are multiple queued transactions but since this is a race issue, it's difficult to reproduce in a provable E2E

Open in GitHub Codespaces

Related issues

Possibly related: #25596

Manual testing steps

  1. Open Tab 1, connect to Uniswap on Ethereum Mainnet
  2. Open Tab 2, connect to PancakeSwap on BNB Chain
  3. Open Tab 3, connect to Test Dapp on Sepolia
  4. Initiate a swap on Tab 1 and Tab 2 BUT DO NOT CONFIRM IT, JUST MOVE ON TO THE NEXT TAB
  5. Initiate a send on Tab 3 BUT DO NOT CONFIRM IT
  6. On the confirmation screen, you should still see the first confirmation from Tab 1 (Uniswap) on Ethereum Mainnet; confirm or reject it. See the confirmation window close
  7. A new confirmation popup should come up with the PancakeSwap/ Tab 2 confirmation on BNB chain; confirm or reject it. See the confirmation window close
  8. See one last confirmation screen pop up for the Tab 3 / Test Dapp send on Sepolia. Confirm or reject it.

Create transactions on different networks, reject and/or confirm them, click around between popup and notification window, ensure nothing unexpected occurs

Screenshots/Recordings

Before

After

Pre-merge author checklist

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

@darkwing darkwing requested a review from a team as a code owner July 1, 2024 18:04
Copy link
Contributor

github-actions bot commented Jul 1, 2024

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@metamaskbot
Copy link
Collaborator

Builds ready [ca54b8e]
Page Load Metrics (227 ± 217 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint753861166632
domContentLoaded1194332110
load451667227453217
domInteractive1194332110
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 0 Bytes (0.00%)
  • ui: 0 Bytes (0.00%)
  • common: 597 Bytes (0.01%)

Copy link

codecov bot commented Jul 1, 2024

Codecov Report

Attention: Patch coverage is 90.00000% with 2 lines in your changes missing coverage. Please review.

Project coverage is 69.60%. Comparing base (fe12ae4) to head (9d1458a).
Report is 19 commits behind head on develop.

Files Patch % Lines
ui/pages/routes/routes.component.js 0.00% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop   #25614      +/-   ##
===========================================
+ Coverage    69.60%   69.60%   +0.01%     
===========================================
  Files         1364     1364              
  Lines        48172    48183      +11     
  Branches     13291    13293       +2     
===========================================
+ Hits         33526    33537      +11     
  Misses       14646    14646              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -1778,7 +1779,9 @@ export function getShowRecoveryPhraseReminder(state) {
* @returns Number of unapproved transactions
*/
export function getNumberOfAllUnapprovedTransactionsAndMessages(state) {
Copy link
Contributor

Choose a reason for hiding this comment

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

can we also rename this variable to numberOfAllUnapprovedTransactionsAndMessages?

adonesky1
adonesky1 previously approved these changes Jul 1, 2024
Copy link
Contributor

@adonesky1 adonesky1 left a comment

Choose a reason for hiding this comment

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

LGTM

@jiexi
Copy link
Contributor

jiexi commented Jul 1, 2024

LGTM after the one comment

jiexi
jiexi previously approved these changes Jul 1, 2024
adonesky1
adonesky1 previously approved these changes Jul 2, 2024
salimtb
salimtb previously approved these changes Jul 2, 2024
@metamaskbot
Copy link
Collaborator

Builds ready [008fee2]
Page Load Metrics (77 ± 12 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint791781062211
domContentLoaded9115342311
load51155772412
domInteractive9115342311
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 0 Bytes (0.00%)
  • ui: 0 Bytes (0.00%)
  • common: 588 Bytes (0.01%)

@@ -1778,7 +1779,9 @@ export function getShowRecoveryPhraseReminder(state) {
* @returns Number of unapproved transactions
*/
export function getNumberOfAllUnapprovedTransactionsAndMessages(state) {
Copy link
Member

@Gudahtt Gudahtt Jul 2, 2024

Choose a reason for hiding this comment

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

I see that this selector is used for the routes page prop unapprovedTransactions. This prop name was already confusing before now for a few reasons: it's just the count, not the transactions themselves, and it's not just transactions (it includes non-transaction confirmations).

But it's slightly more confusing now that we're including unapproved confirmations across all chains. Perhaps we should take this opportunity to make the prop name more clear? e.g. something like totalUnapprovedConfirmationCount

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated!

@darkwing darkwing dismissed stale reviews from adonesky1, salimtb, and jiexi via 9d1458a July 2, 2024 15:47
@darkwing darkwing force-pushed the multichain-all-transactions-check branch from 008fee2 to 9d1458a Compare July 2, 2024 15:47
Copy link

sonarcloud bot commented Jul 2, 2024

@metamaskbot
Copy link
Collaborator

Builds ready [9d1458a]
Page Load Metrics (144 ± 167 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint6311594157
domContentLoaded95526136
load401656144347167
domInteractive95526136
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 0 Bytes (0.00%)
  • ui: 40 Bytes (0.00%)
  • common: 597 Bytes (0.01%)

@darkwing darkwing merged commit ce3c57c into develop Jul 2, 2024
73 checks passed
@darkwing darkwing deleted the multichain-all-transactions-check branch July 2, 2024 19:50
@github-actions github-actions bot locked and limited conversation to collaborators Jul 2, 2024
@metamaskbot metamaskbot added release-12.2.0 Issue or pull request that will be included in release 12.2.0 release-12.0.0 Issue or pull request that will be included in release 12.0.0 and removed release-12.2.0 Issue or pull request that will be included in release 12.2.0 labels Jul 2, 2024
@metamaskbot
Copy link
Collaborator

Missing release label release-12.0.0 on PR. Adding release label release-12.0.0 on PR and removing other release labels(release-12.2.0), as PR was cherry-picked in branch 12.0.0.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
release-12.0.0 Issue or pull request that will be included in release 12.0.0 team-wallet-ux
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

6 participants