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: account tracker controller with useMultiPolling #28277

Open
wants to merge 16 commits into
base: develop
Choose a base branch
from

Conversation

sahar-fehri
Copy link
Contributor

@sahar-fehri sahar-fehri commented Nov 4, 2024

Description

Adds Multi chain polling for the token account tracker controller.

Open in GitHub Codespaces

Related issues

Fixes:
Related: #28402

Manual testing steps

This should not result in any new visual changes/new errors

  1. Go to this page...

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.

@sahar-fehri sahar-fehri requested a review from a team as a code owner November 4, 2024 17:56
Copy link
Contributor

github-actions bot commented Nov 4, 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.

@sahar-fehri sahar-fehri added the needs-assets-ux-review A shared label between the Assets and UX team to flag PRs ready for consolidated team review. label Nov 4, 2024
@sahar-fehri sahar-fehri marked this pull request as draft November 4, 2024 18:56
@sahar-fehri sahar-fehri force-pushed the feat/multi-chain-for-account-tracker-controller-v2 branch from a59f0d7 to 3068288 Compare November 4, 2024 19:18
@sahar-fehri sahar-fehri marked this pull request as ready for review November 4, 2024 19:19
@sahar-fehri sahar-fehri requested a review from a team as a code owner November 4, 2024 19:52
github-merge-queue bot pushed a commit that referenced this pull request Nov 13, 2024
<!--
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.

[![Open in GitHub
Codespaces](https://github.com/codespaces/badge.svg)](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.
gambinish pushed a commit that referenced this pull request Nov 13, 2024
<!--
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.

[![Open in GitHub
Codespaces](https://github.com/codespaces/badge.svg)](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
- 

[![Open in GitHub
Codespaces](https://github.com/codespaces/badge.svg)](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]>
@metamaskbot
Copy link
Collaborator

Builds ready [9aff235]
Page Load Metrics (2320 ± 145 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint34028932215525252
domContentLoaded180028472288300144
load181128602320303145
domInteractive31168552914
backgroundConnect9133322814
firstReactRender8551217510751
getState477272512
initialActions00000
loadScripts132122071718244117
setupStore67015178
uiStartup202933922718340163
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 142 Bytes (0.00%)
  • ui: 1.35 KiB (0.02%)
  • common: 305 Bytes (0.00%)

@metamaskbot
Copy link
Collaborator

Builds ready [c96cb5e]
Page Load Metrics (1736 ± 82 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint46921781677324156
domContentLoaded15332146170315876
load15472186173617082
domInteractive256942147
backgroundConnect997382110
firstReactRender6412299116
getState4361073
initialActions00000
loadScripts11141564125411857
setupStore65511136
uiStartup17172437192119594
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 142 Bytes (0.00%)
  • ui: 1.46 KiB (0.02%)
  • common: 305 Bytes (0.00%)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-assets-ux-review A shared label between the Assets and UX team to flag PRs ready for consolidated team review. team-assets
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants