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

Disabling network and account changes after the send flow is initiated #18086

Merged
merged 9 commits into from
Apr 13, 2023

Conversation

NiranjanaBinoy
Copy link
Contributor

@NiranjanaBinoy NiranjanaBinoy commented Mar 9, 2023

Explanation

Fixes #18045
The initial issue was that if the user changes the network while performing a send transaction using ens, the ens gets resolved to the new network's wrong address.

The solution is to disable the ability to change the network and account once the user start a sends transactions.
#18045 (comment)

Screenshots/Screencaps

Before

After

Manual Testing Steps

  1. Start a send transaction.
  2. Click on the network display bar to change the network in the add recipient page; this should be disabled.
  3. Click on the network display bar to change the network in the draft send page, this should also be disabled.

Pre-merge author checklist

  • I've clearly explained:
    • What problem this PR is solving
    • How this problem was solved
    • How reviewers can test my changes
  • Sufficient automated test coverage has been added

Pre-merge reviewer checklist

  • Manual testing (e.g. pull and build branch, run in browser, test code being changed)
  • PR is linked to the appropriate GitHub issue
  • IF this PR fixes a bug in the release milestone, add this PR to the release milestone

If further QA is required (e.g. new feature, complex testing steps, large refactor), add the Extension QA Board label.

In this case, a QA Engineer approval will be be required.

@NiranjanaBinoy NiranjanaBinoy self-assigned this Mar 9, 2023
@NiranjanaBinoy NiranjanaBinoy marked this pull request as ready for review March 9, 2023 19:47
@NiranjanaBinoy NiranjanaBinoy requested a review from a team as a code owner March 9, 2023 19:47
@github-actions
Copy link
Contributor

github-actions bot commented Mar 9, 2023

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.

@NiranjanaBinoy NiranjanaBinoy added team-confirmations-secure-ux-PR PRs from the confirmations team type-bug Sev2-normal Normal severity; minor loss of service or inconvenience. area-transactions labels Mar 9, 2023
@metamaskbot
Copy link
Collaborator

Builds ready [4f9c043]
Page Load Metrics (1808 ± 85 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint1052171362713
domContentLoaded15582219175915474
load15582370180817685
domInteractive15582219175915474
Bundle size diffs
  • background: 0 bytes
  • ui: 96 bytes
  • common: 0 bytes

@codecov
Copy link

codecov bot commented Mar 9, 2023

Codecov Report

Merging #18086 (327597b) into develop (f92e463) will increase coverage by 0.38%.
The diff coverage is 100.00%.

❗ Current head 327597b differs from pull request most recent head 0ec236f. Consider uploading reports for the commit 0ec236f to get more accurate results

@@             Coverage Diff             @@
##           develop   #18086      +/-   ##
===========================================
+ Coverage    65.15%   65.53%   +0.38%     
===========================================
  Files          936      914      -22     
  Lines        35965    35288     -677     
  Branches      9231     8984     -247     
===========================================
- Hits         23432    23124     -308     
+ Misses       12533    12164     -369     
Impacted Files Coverage Δ
.../components/app/app-header/app-header.component.js 97.44% <ø> (+2.56%) ⬆️
ui/pages/routes/routes.component.js 56.39% <100.00%> (+56.39%) ⬆️

... and 288 files with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

jpuri
jpuri previously approved these changes Mar 9, 2023
@jpuri
Copy link
Contributor

jpuri commented Mar 9, 2023

Plz check if it possible to add test coverage, it will be good and codecov will also be green 😄

@metamaskbot
Copy link
Collaborator

Builds ready [2a27b83]
Page Load Metrics (1577 ± 43 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint942181222613
domContentLoaded1444170215468440
load1444174815778943
domInteractive1443170215468440
Bundle size diffs
  • background: 0 bytes
  • ui: 96 bytes
  • common: 0 bytes

@metamaskbot
Copy link
Collaborator

Builds ready [0479804]
Page Load Metrics (1608 ± 52 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint981991212110
domContentLoaded13511760158810852
load13511760160810752
domInteractive13511760158810852
Bundle size diffs
  • background: 0 bytes
  • ui: 96 bytes
  • common: 0 bytes

@NiranjanaBinoy NiranjanaBinoy requested review from jpuri and segun March 18, 2023 01:23
@NiranjanaBinoy NiranjanaBinoy force-pushed the network-change-ens-resolution branch from 69ce715 to f103c7b Compare March 18, 2023 01:40
@NiranjanaBinoy NiranjanaBinoy removed the request for review from pedronfigueiredo March 18, 2023 01:42
@NiranjanaBinoy NiranjanaBinoy force-pushed the network-change-ens-resolution branch from 91b9a85 to 13de2c6 Compare March 20, 2023 13:58
lines: 66.58,
branches: 54.79,
statements: 65.74,
functions: 58.4,
},
transforms: {
branches: 100,
Copy link
Contributor

Choose a reason for hiding this comment

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

🚀

expect(getByTestId('account-menu-icon')).not.toBeDisabled();
});
});
});
Copy link
Contributor

Choose a reason for hiding this comment

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

NIT: test case description can be made more intuitive.

jpuri
jpuri previously approved these changes Mar 20, 2023
Copy link
Contributor

@jpuri jpuri left a comment

Choose a reason for hiding this comment

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

Just a small feedbacks, looks great otherwise 👍

@metamaskbot
Copy link
Collaborator

Builds ready [e275550]
Page Load Metrics (1711 ± 56 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint1093391435024
domContentLoaded15261924169810751
load15431952171111656
domInteractive15261924169810751
Bundle size diffs
  • background: 0 bytes
  • ui: 116 bytes
  • common: 0 bytes

@seaona
Copy link
Contributor

seaona commented Mar 21, 2023

Great job @NiranjanaBinoy I can see how network is disabled while performing a transaction.

I've noticed that the Account is also disabled. Is this the intended behaviour? cc @bschorchit

extension-change-account.mp4

@NiranjanaBinoy
Copy link
Contributor Author

@seaona The account was disabled for the other scenarios where the network drop-down was disabled, so I replicated the same on this.
@bschorchit Should we stick to this behavior or keep the account active while the user is in the Add Reciepent and draft send pages?

@bschorchit
Copy link

I wonder how common is for users to change accounts during this flow. I'm inclined to say we keep the account changing blocked in those screens as well mainly because there's no info on the from account in these screens besides the icon on the top right for the user to review and confirm. And because changing account also creates some bugs (e.g. if you're sending an asset you own on one account but not in another and you change it to that second account). What do you think? Any strong reason to keep it enabled?

Minor detail: Is the difference on how the cursor looks like for hovering over the network dropdown and the account dropdown intentional?

@seaona
Copy link
Contributor

seaona commented Mar 21, 2023

Make sense to me! Thank you @NiranjanaBinoy @bschorchit !! Maybe we could update the PR description/title to reference to the Account Disabling too 👍

@NiranjanaBinoy NiranjanaBinoy changed the title Disabling network change after the send flow is initiated Disabling network change and account change after the send flow is initiated Mar 21, 2023
@NiranjanaBinoy NiranjanaBinoy changed the title Disabling network change and account change after the send flow is initiated Disabling network and account changes after the send flow is initiated Mar 21, 2023
jpuri
jpuri previously approved these changes Mar 22, 2023
Copy link
Contributor

@jpuri jpuri left a comment

Choose a reason for hiding this comment

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

🚀

@segun
Copy link
Contributor

segun commented Mar 22, 2023

Can you please fix the lint failures, then I will approve

@metamaskbot
Copy link
Collaborator

Builds ready [327597b]
Page Load Metrics (2008 ± 100 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint1242321703617
domContentLoaded14812299200220599
load148123002008209100
domInteractive14812299200220599
Bundle size diffs
  • background: 0 bytes
  • ui: 116 bytes
  • common: 0 bytes

jpuri
jpuri previously approved these changes Mar 24, 2023
segun
segun previously approved these changes Apr 11, 2023
@NiranjanaBinoy NiranjanaBinoy dismissed stale reviews from segun and jpuri via 741200c April 11, 2023 17:27
@NiranjanaBinoy NiranjanaBinoy force-pushed the network-change-ens-resolution branch from 327597b to 741200c Compare April 11, 2023 17:27
@NiranjanaBinoy NiranjanaBinoy requested review from segun and jpuri April 11, 2023 17:31
@metamaskbot
Copy link
Collaborator

Builds ready [0ec236f]
Page Load Metrics (1592 ± 34 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint952991194220
domContentLoaded1442174815787838
load1442174815927134
domInteractive1442174815787838
Bundle size diffs
  • background: 0 bytes
  • ui: 116 bytes
  • common: 0 bytes

Copy link
Contributor

@jpuri jpuri left a comment

Choose a reason for hiding this comment

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

LGTM

@NiranjanaBinoy NiranjanaBinoy merged commit 643a89f into develop Apr 13, 2023
@NiranjanaBinoy NiranjanaBinoy deleted the network-change-ens-resolution branch April 13, 2023 16:51
@github-actions github-actions bot locked and limited conversation to collaborators Apr 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-transactions Sev2-normal Normal severity; minor loss of service or inconvenience. team-confirmations-secure-ux-PR PRs from the confirmations team type-bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: ENS resolution address not updated when changing networks
6 participants