metamask-extension
metamask-extension copied to clipboard
Update getMetaMaskIdentities with getInternalAccounts
Description
Currently, MetaMask faces tight coupling between its UI and the keyring-controller. The UI heavily relies on the keyring-controller's state while also amalgamating information from various sources, such as preferences and balances.
However, this approach presents some challenges. The keyring-controller must be aware of the UI's limitations, like the need for instant account list provision to avoid lag. Moreover, it takes on the responsibility of adding metadata to accounts, such as the associated keyring type, required for displaying account details.
To address these issues, the introduction of the accounts-controller comes into play as a new abstraction layer between the UI and the keyring-controller. This separation of responsibilities allows the keyring-controller to focus on two main tasks:
- Routing requests to the appropriate keyring.
- Persisting the state of the keyrings.
This PR replaces the usage of getMetaMaskIdentities with getInternalAccounts
Depends On: https://github.com/MetaMask/metamask-extension/pull/21553
Related issues
Resolves https://github.com/MetaMask/accounts-planning/issues/134
Manual testing steps
- Use a hardware wallet to test all the flows
Screenshots/Recordings
Before
After
Pre-merge author checklist
- [x] I’ve followed MetaMask Coding Standards.
- [x] I've clearly explained:
- [x] What problem this PR is solving.
- [x] How this problem was solved.
- [x] How reviewers can test my changes.
- [x] I’ve indicated what issue this PR is linked to: Fixes #???
- [x] I’ve included tests if applicable.
- [x] I’ve documented any added code.
- [x] I’ve applied the right labels on the PR (see labeling guidelines).
- [x] I’ve properly set the pull request status:
- [x] In case it's not yet "ready for review", I've set it to "draft".
- [x] In case it's "ready for review", I've changed it from "draft" to "non-draft".
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.
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.
This PR has been automatically marked as stale because it has not had recent activity in the last 60 days. It will be closed in 14 days. Thank you for your contributions.
@metamaskbot update-policies
Policies updated
Builds ready [f8dd3c1]
- builds: chrome, firefox
- builds (beta): chrome
- builds (flask): chrome, firefox
- builds (MMI): chrome, firefox
- builds (test): chrome, firefox
- builds (test-flask): chrome, firefox
- build viz: Build System
- mv3: Background Module Init Stats
- mv3: UI Init Stats
- mv3: Module Load Stats
- mv3: Bundle Size Stats
- mv2: E2e Actions Stats
- code coverage: Report
- storybook: Storybook
- typescript migration: Dashboard
- all artifacts
Page Load Metrics (691 ± 13 ms)
| Platform | Page | Metric | Min (ms) | Max (ms) | Average (ms) | StandardDeviation (ms) | MarginOfError (ms) |
|---|---|---|---|---|---|---|---|
| Chrome | Home | firstPaint | 84 | 127 | 97 | 8 | 4 |
| domContentLoaded | 9 | 17 | 14 | 1 | 1 | ||
| load | 659 | 743 | 691 | 26 | 13 | ||
| domInteractive | 9 | 17 | 14 | 1 | 1 |
Bundle size diffs
- background: 0 Bytes (0.00%)
- ui: 1.19 KiB (0.02%)
- common: 0 Bytes (0.00%)
Builds ready [69d2f43]
- builds: chrome, firefox
- builds (beta): chrome
- builds (flask): chrome, firefox
- builds (MMI): chrome, firefox
- builds (test): chrome, firefox
- builds (test-flask): chrome, firefox
- build viz: Build System
- mv3: Background Module Init Stats
- mv3: UI Init Stats
- mv3: Module Load Stats
- mv3: Bundle Size Stats
- mv2: E2e Actions Stats
- code coverage: Report
- storybook: Storybook
- typescript migration: Dashboard
- all artifacts
Page Load Metrics (735 ± 14 ms)
| Platform | Page | Metric | Min (ms) | Max (ms) | Average (ms) | StandardDeviation (ms) | MarginOfError (ms) |
|---|---|---|---|---|---|---|---|
| Chrome | Home | firstPaint | 90 | 126 | 103 | 8 | 4 |
| domContentLoaded | 9 | 17 | 13 | 3 | 1 | ||
| load | 677 | 808 | 735 | 30 | 14 | ||
| domInteractive | 9 | 17 | 13 | 3 | 1 |
Bundle size diffs
- background: 0 Bytes (0.00%)
- ui: 1.19 KiB (0.02%)
- common: 0 Bytes (0.00%)
Builds ready [e8b48f4]
- builds: chrome, firefox
- builds (beta): chrome
- builds (flask): chrome, firefox
- builds (MMI): chrome, firefox
- builds (test): chrome, firefox
- builds (test-flask): chrome, firefox
- build viz: Build System
- mv3: Background Module Init Stats
- mv3: UI Init Stats
- mv3: Module Load Stats
- mv3: Bundle Size Stats
- mv2: E2e Actions Stats
- code coverage: Report
- storybook: Storybook
- typescript migration: Dashboard
- all artifacts
Page Load Metrics (796 ± 20 ms)
| Platform | Page | Metric | Min (ms) | Max (ms) | Average (ms) | StandardDeviation (ms) | MarginOfError (ms) |
|---|---|---|---|---|---|---|---|
| Chrome | Home | firstPaint | 91 | 138 | 114 | 11 | 5 |
| domContentLoaded | 10 | 47 | 18 | 8 | 4 | ||
| load | 709 | 890 | 796 | 41 | 20 | ||
| domInteractive | 10 | 47 | 18 | 8 | 4 |
Bundle size diffs
- background: 0 Bytes (0.00%)
- ui: 1.2 KiB (0.02%)
- common: 0 Bytes (0.00%)
I see that this PR also changes the file ui/pages/snaps/snap-view/snap-settings.js.
This PR is quite big so the chance of being blocked is high, I strongly recommend opening a new PR with just that change to remove that review dependency.
Codecov Report
Attention: Patch coverage is 52.87356% with 41 lines in your changes are missing coverage. Please review.
Project coverage is 68.56%. Comparing base (
f893b45) to head (fb4478e).
:exclamation: Current head fb4478e differs from pull request most recent head 9082b46. Consider uploading reports for the commit 9082b46 to get more accurate results
Additional details and impacted files
@@ Coverage Diff @@
## develop #21709 +/- ##
===========================================
- Coverage 68.60% 68.56% -0.04%
===========================================
Files 1101 1100 -1
Lines 43196 43143 -53
Branches 11564 11531 -33
===========================================
- Hits 29632 29577 -55
- Misses 13564 13566 +2
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Builds ready [6656aec]
- builds: chrome, firefox
- builds (beta): chrome
- builds (flask): chrome, firefox
- builds (MMI): chrome, firefox
- builds (test): chrome, firefox
- builds (test-flask): chrome, firefox
- build viz: Build System
- mv3: Background Module Init Stats
- mv3: UI Init Stats
- mv3: Module Load Stats
- mv3: Bundle Size Stats
- mv2: E2e Actions Stats
- code coverage: Report
- storybook: Storybook
- typescript migration: Dashboard
- all artifacts
Page Load Metrics (781 ± 30 ms)
| Platform | Page | Metric | Min (ms) | Max (ms) | Average (ms) | StandardDeviation (ms) | MarginOfError (ms) |
|---|---|---|---|---|---|---|---|
| Chrome | Home | firstPaint | 84 | 137 | 104 | 13 | 6 |
| domContentLoaded | 11 | 23 | 17 | 3 | 2 | ||
| load | 695 | 977 | 781 | 62 | 30 | ||
| domInteractive | 11 | 23 | 17 | 3 | 2 |
Bundle size diffs
- background: 0 Bytes (0.00%)
- ui: 1.64 KiB (0.02%)
- common: 0 Bytes (0.00%)
I do not have a hardware wallet, but I tested on the E2E test dapp and the SSK with a snap account and EOA all flows and did not notice any bugs or errors in sending or signing.
Builds ready [3d74b68]
- builds: chrome, firefox
- builds (beta): chrome
- builds (flask): chrome, firefox
- builds (MMI): chrome, firefox
- builds (test): chrome, firefox
- builds (test-flask): chrome, firefox
- build viz: Build System
- mv3: Background Module Init Stats
- mv3: UI Init Stats
- mv3: Module Load Stats
- mv3: Bundle Size Stats
- mv2: E2e Actions Stats
- code coverage: Report
- storybook: Storybook
- typescript migration: Dashboard
- all artifacts
Page Load Metrics (990 ± 95 ms)
| Platform | Page | Metric | Min (ms) | Max (ms) | Average (ms) | StandardDeviation (ms) | MarginOfError (ms) |
|---|---|---|---|---|---|---|---|
| Chrome | Home | firstPaint | 88 | 186 | 126 | 29 | 14 |
| domContentLoaded | 9 | 57 | 26 | 12 | 6 | ||
| load | 749 | 1357 | 990 | 199 | 95 | ||
| domInteractive | 9 | 57 | 26 | 12 | 6 |
Bundle size diffs
- background: 0 Bytes (0.00%)
- ui: 1.74 KiB (0.03%)
- common: 0 Bytes (0.00%)
Builds ready [37411e7]
- builds: chrome, firefox
- builds (beta): chrome
- builds (flask): chrome, firefox
- builds (MMI): chrome, firefox
- builds (test): chrome, firefox
- builds (test-flask): chrome, firefox
- build viz: Build System
- mv3: Background Module Init Stats
- mv3: UI Init Stats
- mv3: Module Load Stats
- mv3: Bundle Size Stats
- mv2: E2e Actions Stats
- code coverage: Report
- storybook: Storybook
- typescript migration: Dashboard
- all artifacts
Page Load Metrics (1015 ± 50 ms)
| Platform | Page | Metric | Min (ms) | Max (ms) | Average (ms) | StandardDeviation (ms) | MarginOfError (ms) |
|---|---|---|---|---|---|---|---|
| Chrome | Home | firstPaint | 121 | 305 | 187 | 43 | 21 |
| domContentLoaded | 9 | 90 | 28 | 23 | 11 | ||
| load | 788 | 1298 | 1015 | 104 | 50 | ||
| domInteractive | 9 | 90 | 28 | 23 | 11 |
Bundle size diffs
- background: 0 Bytes (0.00%)
- ui: 1.74 KiB (0.03%)
- common: 0 Bytes (0.00%)
@montelaidev I found a minor bug in the send flow
https://github.com/MetaMask/metamask-extension/assets/17601467/1d4ad918-9b62-4fb1-b1c1-6c56fd602dfd
@montelaidev I found a minor bug in the send flow
Screen.Recording.2024-02-15.at.14.32.29.mov
Looks like its the same bug as this https://github.com/MetaMask/metamask-extension/issues/22933, its due to the petnames overriding the names being passed to the component.
True, let's try to fix it in another PR
Tested on Mac in Sonoma 14.3.1 with Chrome 117.0.5938.92 using Ledger, Lattice, QR, Trezor and Snap accounts. Also spot checked in Firefox 123.0 Lattice, QR, Trezor and Snap accounts (Ledger not supported >v114)
I have encountered a situation where the test dapp can no longer be used to connect an account, after the one that was connected is removed. It initially struck me as similar to what is reported here, but occurs with connecting an account rather than signatures and I want to be confident its not related to the changes in this PR before we merge.
Reproduction steps:
- Import SRP
- Add Hardware wallet (Ledger tested but could not reproduce with a Snap account from SSK v1.1.1)
- Connect to test dapp and open console
- Conduct a V4 typed data signature and verify recovery result
- Return to add hardware flow and forget device
- Go back to test dapp from full screen add hardware
- Then open pop-up again by tapping on fox
- Tap
Connectto connect Account 1 or whatever account is now active after removing Ledger - Note error
Something went wrong, and we were unable to complete this action - Tap
Dismiss - Note console error in test dapp
MetaMask: 'eth_accounts' unexpectedly updated accounts. Please report this bug. Connectbutton in test dapp is no longer responsive, butUse MetaMaskUse Window.EthereumandWallet Connectbuttons do all remain interactive
Recording: https://recordit.co/bm4XY9l9QO
EDIT: Reproduced this with a dist build of 11.11.0 using the test dapp, issue is unrelated to changes in this PR.
Builds ready [f8d99ec]
- builds: chrome, firefox
- builds (beta): chrome
- builds (flask): chrome, firefox
- builds (MMI): chrome, firefox
- builds (test): chrome, firefox
- builds (test-flask): chrome, firefox
- build viz: Build System
- mv3: Background Module Init Stats
- mv3: UI Init Stats
- mv3: Module Load Stats
- mv3: Bundle Size Stats
- mv2: E2e Actions Stats
- code coverage: Report
- storybook: Storybook
- typescript migration: Dashboard
- all artifacts
Page Load Metrics (868 ± 425 ms)
| Platform | Page | Metric | Min (ms) | Max (ms) | Average (ms) | StandardDeviation (ms) | MarginOfError (ms) |
|---|---|---|---|---|---|---|---|
| Chrome | Home | firstPaint | 72 | 191 | 120 | 34 | 16 |
| domContentLoaded | 10 | 62 | 26 | 15 | 7 | ||
| load | 54 | 2169 | 868 | 884 | 425 | ||
| domInteractive | 10 | 62 | 26 | 15 | 7 |
Bundle size diffs
- background: 0 Bytes (0.00%)
- ui: 1.74 KiB (0.02%)
- common: 0 Bytes (0.00%)
Builds ready [fb4478e]
- builds: chrome, firefox
- builds (beta): chrome
- builds (flask): chrome, firefox
- builds (MMI): chrome, firefox
- builds (test): chrome, firefox
- builds (test-flask): chrome, firefox
- build viz: Build System
- mv3: Background Module Init Stats
- mv3: UI Init Stats
- mv3: Module Load Stats
- mv3: Bundle Size Stats
- mv2: E2e Actions Stats
- code coverage: Report
- storybook: Storybook
- typescript migration: Dashboard
- all artifacts
Page Load Metrics (1099 ± 400 ms)
| Platform | Page | Metric | Min (ms) | Max (ms) | Average (ms) | StandardDeviation (ms) | MarginOfError (ms) |
|---|---|---|---|---|---|---|---|
| Chrome | Home | firstPaint | 72 | 269 | 118 | 42 | 20 |
| domContentLoaded | 10 | 67 | 31 | 18 | 8 | ||
| load | 67 | 2039 | 1099 | 833 | 400 | ||
| domInteractive | 10 | 67 | 31 | 18 | 8 |
Bundle size diffs
- background: 0 Bytes (0.00%)
- ui: 1.74 KiB (0.02%)
- common: 0 Bytes (0.00%)
My comments are to be addressed in a future PR.
Builds ready [9082b46]
- builds: chrome, firefox
- builds (beta): chrome
- builds (flask): chrome, firefox
- builds (MMI): chrome, firefox
- builds (test): chrome, firefox
- builds (test-flask): chrome, firefox
- build viz: Build System
- mv3: Background Module Init Stats
- mv3: UI Init Stats
- mv3: Module Load Stats
- mv3: Bundle Size Stats
- mv2: E2e Actions Stats
- code coverage: Report
- storybook: Storybook
- typescript migration: Dashboard
- all artifacts
Page Load Metrics (1074 ± 395 ms)
| Platform | Page | Metric | Min (ms) | Max (ms) | Average (ms) | StandardDeviation (ms) | MarginOfError (ms) |
|---|---|---|---|---|---|---|---|
| Chrome | Home | firstPaint | 69 | 222 | 119 | 39 | 19 |
| domContentLoaded | 9 | 63 | 28 | 16 | 8 | ||
| load | 56 | 1905 | 1074 | 822 | 395 | ||
| domInteractive | 9 | 63 | 28 | 16 | 8 |
Bundle size diffs
- background: 0 Bytes (0.00%)
- ui: 1.74 KiB (0.02%)
- common: 0 Bytes (0.00%)