-
Notifications
You must be signed in to change notification settings - Fork 5.2k
fix: account tracker controller with useMultiPolling #28277
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: account tracker controller with useMultiPolling #28277
Conversation
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. |
a59f0d7
to
3068288
Compare
privacy-snapshot.json
Outdated
@@ -29,6 +29,8 @@ | |||
"github.com", | |||
"goerli.infura.io", | |||
"lattice.gridplus.io", | |||
"linea-mainnet.infura.io", |
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.
Does this mean we have additional RPC requests that we should be mocking in e2e tests?
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.
Yes
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.
Are these still needed after mocks have been added?
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.
good point actually i dnt think they are needed anymore; pushing now
<!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once. --> ## **Description** There is a race condition in our testing setup, which causes that the expected fixtures state, not being there when we start the test. This has been surfaced in [this branch](#28277), where the account tracker multi polling is being added. The problem is that if we don't have the AccountTracker in state when the `resetState` function is called (at the beginning of wallet loading) the balance will remain loading until we refresh the wallet. Edit: performing the load state early in the test setup fixes the issue. [](https://codespaces.new/MetaMask/metamask-extension/pull/28421?quickstart=1) ## **Related issues** Fixes: MetaMask/MetaMask-planning#3627 ## **Manual testing steps** 1. Check all tests continue to pass 2. Check this changes fix this branch ENS test https://github.com/MetaMask/metamask-extension/pull/28402/files#diff-1acb7898d60977530c97169551d22dbe477a4e3aeb74f1f14bf2eea0b4d75d35 . Alternatively, see videos below with before and after behaviours ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** https://github.com/user-attachments/assets/8f50ec04-cf96-478e-9c3c-dce54254a628 ### **After** https://github.com/user-attachments/assets/0f109b1a-9289-48d9-b337-d51890c9d448 ## **Pre-merge author checklist** - [x] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Extension Coding Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/CODING_GUIDELINES.md). - [x] I've completed the PR template to the best of my ability - [x] I’ve included tests if applicable - [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [x] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **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.
<!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once. --> ## **Description** There is a race condition in our testing setup, which causes that the expected fixtures state, not being there when we start the test. This has been surfaced in [this branch](#28277), where the account tracker multi polling is being added. The problem is that if we don't have the AccountTracker in state when the `resetState` function is called (at the beginning of wallet loading) the balance will remain loading until we refresh the wallet. Edit: performing the load state early in the test setup fixes the issue. [](https://codespaces.new/MetaMask/metamask-extension/pull/28421?quickstart=1) ## **Related issues** Fixes: MetaMask/MetaMask-planning#3627 ## **Manual testing steps** 1. Check all tests continue to pass 2. Check this changes fix this branch ENS test https://github.com/MetaMask/metamask-extension/pull/28402/files#diff-1acb7898d60977530c97169551d22dbe477a4e3aeb74f1f14bf2eea0b4d75d35 . Alternatively, see videos below with before and after behaviours ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** https://github.com/user-attachments/assets/8f50ec04-cf96-478e-9c3c-dce54254a628 ### **After** https://github.com/user-attachments/assets/0f109b1a-9289-48d9-b337-d51890c9d448 ## **Pre-merge author checklist** - [x] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Extension Coding Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/CODING_GUIDELINES.md). - [x] I've completed the PR template to the best of my ability - [x] I’ve included tests if applicable - [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [x] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **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.
<!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once. --> ## **Description** List of failing tests: - Malicious Confirmation Signature - Bad Domain @no-mmi displays alert for domain binding and confirms - Malicious Confirmation Signature - Bad Domain @no-mmi initiates and rejects from confirmation screen - Malicious Confirmation Signature - Bad Domain @no-mmi initiates and rejects from alert friction modal - Malicious Confirmation Signature - Bad Domain @no-mmi displays alert for domain binding and confirms - Malicious Confirmation Signature - Bad Domain @no-mmi initiates and rejects from confirmation screen - Malicious Confirmation Signature - Bad Domain @no-mmi initiates and rejects from alert friction modal - smart transactions @no-mmi Completes a Swap - Simple Send Security Alert - Blockaid @no-mmi should not show security alerts for benign requests - Simple Send Security Alert - Blockaid @no-mmi should show security alerts for malicious requests - MultiRpc: should select rpc from modal - MetaMask onboarding @no-mmi doesn't make any network requests to infura before create new wallet onboarding is completed - MetaMask onboarding @no-mmi doesn't make any network requests to infura before onboarding by import is completed - MetaMask onboarding @no-mmi doesn't make any network requests to infura before create new wallet onboarding is completed - MetaMask onboarding @no-mmi doesn't make any network requests to infura before onboarding by import is completed - [](https://codespaces.new/MetaMask/metamask-extension/pull/28402?quickstart=1) ## **Related issues** Fixes: ## **Manual testing steps** 1. Go to this page... 2. 3. ## **Screenshots/Recordings** Swaps https://github.com/user-attachments/assets/656ba20a-bc48-4f57-84d4-8b11e62a25cf ENS https://github.com/user-attachments/assets/aa23bb34-aeb0-48e9-af17-c98a82367437 ## **Pre-merge author checklist** - [ ] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Extension Coding Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/CODING_GUIDELINES.md). - [ ] I've completed the PR template to the best of my ability - [ ] I’ve included tests if applicable - [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [ ] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **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. --------- Co-authored-by: sahar-fehri <[email protected]>
Builds ready [9aff235]
Page Load Metrics (2320 ± 145 ms)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
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.
looks good from the e2e and testing side 🔥 awesome work!!
resolved merge conflicts |
Builds ready [78d0a6b]
Page Load Metrics (1939 ± 62 ms)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Builds ready [22b383a]
Page Load Metrics (1764 ± 65 ms)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
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. tested with and without PORTFOLIO_VIEW
Builds ready [acd5a74]
Page Load Metrics (2181 ± 119 ms)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Builds ready [67ad764]
Page Load Metrics (2106 ± 161 ms)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Description
Adds Multi chain polling for the token account tracker controller.
We will have a separate PR to add the following e2e:
1- polling doesn't start with the wallet locked
2- once we unlock the wallet, polling starts with the wallet networks: we should check that the mocked requests for polling are happening
3- once we add a new account, polling is updated: we should check new requests including the new address happen
Related issues
Fixes:
Related: #28402
Manual testing steps
This should not result in any new visual changes/new errors
Screenshots/Recordings
Before
After
Pre-merge author checklist
Pre-merge reviewer checklist