metamask-extension
metamask-extension copied to clipboard
Replace useSafeGasEstimatePolling with usePolling
Description
Related issues
Fixes:
Manual testing steps
- Go to this page...
Screenshots/Recordings
Before
After
Pre-merge author checklist
- [ ] I’ve followed MetaMask Coding Standards.
- [ ] I've clearly explained what problem this PR is solving and how it is solved.
- [ ] I've linked related issues
- [ ] I've included manual testing steps
- [ ] I've included screenshots/recordings if applicable
- [ ] I’ve included tests if applicable
- [ ] I’ve documented my code using JSDoc format if applicable
- [ ] I’ve applied the right labels on the PR (see labeling guidelines). Not required for external contributors.
- [ ] I’ve properly set the pull request status:
- [ ] In case it's not yet "ready for review", I've set it to "draft".
- [ ] 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.
Codecov Report
Attention: Patch coverage is 94.78261%
with 6 lines
in your changes are missing coverage. Please review.
Project coverage is 68.77%. Comparing base (
6c810aa
) to head (d7b1e5e
).
Additional details and impacted files
@@ Coverage Diff @@
## develop #23010 +/- ##
===========================================
+ Coverage 68.70% 68.77% +0.07%
===========================================
Files 1120 1120
Lines 43509 43527 +18
Branches 11636 11654 +18
===========================================
+ Hits 29891 29933 +42
+ Misses 13618 13594 -24
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
No dependency changes detected. Learn more about Socket for GitHub ↗︎
👍 No dependency changes detected in pull request
Builds ready [45f960e]
- 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 (1208 ± 399 ms)
Platform | Page | Metric | Min (ms) | Max (ms) | Average (ms) | StandardDeviation (ms) | MarginOfError (ms) |
---|---|---|---|---|---|---|---|
Chrome | Home | firstPaint | 66 | 215 | 127 | 41 | 20 |
domContentLoaded | 10 | 106 | 36 | 28 | 13 | ||
load | 57 | 2135 | 1208 | 832 | 399 | ||
domInteractive | 10 | 105 | 36 | 28 | 13 |
Bundle size diffs [🚨 Warning! Bundle size has increased!]
- background: 278 Bytes (0.01%)
- ui: 2.08 KiB (0.03%)
- common: 0 Bytes (0.00%)
Builds ready [7d1eca7]
- 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 (1240 ± 465 ms)
Platform | Page | Metric | Min (ms) | Max (ms) | Average (ms) | StandardDeviation (ms) | MarginOfError (ms) |
---|---|---|---|---|---|---|---|
Chrome | Home | firstPaint | 61 | 235 | 131 | 53 | 25 |
domContentLoaded | 9 | 77 | 33 | 22 | 11 | ||
load | 46 | 2318 | 1240 | 969 | 465 | ||
domInteractive | 9 | 76 | 33 | 22 | 11 |
Bundle size diffs [🚨 Warning! Bundle size has increased!]
- background: 278 Bytes (0.01%)
- ui: 2.08 KiB (0.03%)
- common: 0 Bytes (0.00%)
Builds ready [3f6f272]
- 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 (1324 ± 439 ms)
Platform | Page | Metric | Min (ms) | Max (ms) | Average (ms) | StandardDeviation (ms) | MarginOfError (ms) |
---|---|---|---|---|---|---|---|
Chrome | Home | firstPaint | 60 | 256 | 136 | 40 | 19 |
domContentLoaded | 10 | 73 | 33 | 19 | 9 | ||
load | 48 | 2449 | 1324 | 913 | 439 | ||
domInteractive | 10 | 73 | 33 | 19 | 9 |
Bundle size diffs [🚨 Warning! Bundle size has increased!]
- background: 278 Bytes (0.01%)
- ui: 2.08 KiB (0.03%)
- common: 0 Bytes (0.00%)
Overall no issues with behavior from my first pass. Although there are styling issues that came up on a certain network.
Network name: Ganache 8545 1337 New RPC URL: HTTP://127.0.0.1:8545 Chain ID: 1337 Currency symbol: g-eth
I will update this same comment with the findings during the testing phase.
QA Findings
1. Unresponsive network handling behaviour
Whenever I am on a network which is unresponsive, I see errors on
-
StaticIntervalPollingController
-
PollingBlockTracker
- RPC errors
Could those be handled somehow? This way we would avoid having too much noise in Sentry. Then, after I switch to another responsive network, I continue to see errors and requests being made in the old network.
https://github.com/MetaMask/metamask-extension/assets/54408225/aab0c11e-abc8-4920-861e-29600013a964
https://github.com/MetaMask/metamask-extension/assets/54408225/c520e259-ef0d-4a93-8fa1-f08885e47666
2. Can't perform a React state update on an unmounted component
I've encountered the following warning . Can't perform a React state update on an unmounted component. This is a no-op, but it indicates a memory leak in your application
for 2 actions:
- When trying to Edit the gas, I saw this one in
useGasFeeEstimates
:
- When clicking Edit transaction, I saw this one in
gasTiming.component
:
https://github.com/MetaMask/metamask-extension/assets/54408225/59757ce5-66fb-48e0-9683-0c3e2303a083
3. Performance Degradation
Not sure if it's exclusive to this PR, since I've seen this in other builds recently. However, thought it is worth mentioning (might be related to the issue 2?). When starting a transaction, I'm experiencing a significant performance degradation and I see these warnings on the background console. This one seems particularly related to gas:
These seem more generic. Though not sure if somehow related to the multichain work
4. Couldn't find networkClientId for chainId
I have encountered the background error: Couldn't find networkClientId for chainId
but still not sure yet how to repro. I was using a local network.
Item 2: Can't perform a React state update on an unmounted component. This is a no-op, but it indicates a memory leak in your application
should be addressed by https://github.com/MetaMask/metamask-extension/pull/23010/commits/d0d702f3f21b4be3ea6fa596205495eca65d1f05
Builds ready [d0d702f]
- 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 (1379 ± 373 ms)
Platform | Page | Metric | Min (ms) | Max (ms) | Average (ms) | StandardDeviation (ms) | MarginOfError (ms) |
---|---|---|---|---|---|---|---|
Chrome | Home | firstPaint | 67 | 220 | 142 | 42 | 20 |
domContentLoaded | 9 | 103 | 45 | 26 | 13 | ||
load | 54 | 2385 | 1379 | 778 | 373 | ||
domInteractive | 9 | 103 | 45 | 26 | 12 |
Bundle size diffs [🚨 Warning! Bundle size has increased!]
- background: 278 Bytes (0.01%)
- ui: 2.11 KiB (0.03%)
- common: 0 Bytes (0.00%)
- Unresponsive network handling behaviour Whenever I am on a network which is unresponsive, I see errors on
- StaticIntervalPollingController
- PollingBlockTracker
- RPC errors
Could those be handled somehow? This way we would avoid having too much noise in Sentry.
So on this branch I'm only seeing the errors for PollingBlockTracker (which are expected though should probably be formatted better) since polling for new block info is indeed failing.
I'm also seeing these errors on develop
if you stop a local testnet while its selected. So I'd say we should handle them in a separate PR if at all.
Then, after I switch to another responsive network, I continue to see errors and requests being made in the old network.
I wasn't able to reproduce this on this branch 🤔 Could you describe any other steps you took before you saw this happening? I'm assuming you just started a local testnet and then turned it off and then looked for errors and then switched networks to sepolia?
Item 3: Seems like this is caused by having a very large state in MetaMask, likely from having many transactions in state and/or a slow machine. IMO not related to these particular set of changes.
Item 4: This is a DetectTokensController issue that I've brought to the attention of the appropriate individuals.
That should be all the items. Thank you for this thoroughly detailed list, @seaona!
:green_circle: 1. Unresponsive network handling behaviour --> out of scope
I wasn't able to reproduce this on this branch 🤔 Could you describe any other steps you took before you saw this happening? I'm assuming you just started a local testnet and then turned it off and then looked for errors and then switched networks to sepolia?
I am able to repro, I see errors both from StaticIntervalPollingController
and PolliognBlockTracker
after I switch networks. However, as you pointed then those seem to be independent from this PR, so it can be left out of scope if that sounds good. I marked is as green, but feel free to disagree
Steps:
- Add ganache (server is on)
- Perform a tx
- Switch to sepolia
- See errors continue --only stopped if I reload the wallet with the reload button from the Extension Chrome page
:yellow_circle: 2. Can't perform a React state update on an unmounted component
- :green_circle: I see the
useGasFeeEstimates
fixed - :yellow_circle: I still see the
gas-timing-component
when editing a transaction
https://github.com/MetaMask/metamask-extension/assets/54408225/30035069-b128-46e4-9d6a-1ec8baa935f8
:green_circle: 3. Performance Degradation
It seems that this might be also out of scope of this PR. I've seen that this happened to other branches with multichain flag enabled. Another QA engineer from Confirmations (@sleepytanya ) also experienced this in other branches.
:green_circle: 4. Couldn't find networkClientId for chainId
This is out of scope as per this comment:
Item 4: This is a DetectTokensController issue that I've brought to the attention of the appropriate individuals.
- Can't perform a React state update on an unmounted component
- I still see the gas-timing-component when editing a transaction
This is a bug that currently exists in develop. I have manually checked on develop to confirm. We will address as part of this PR though https://github.com/MetaMask/metamask-extension/pull/23010/commits/1080c91aa5f0077229bf270b5b2916b61899d305
I am able to repro, I see errors both from StaticIntervalPollingController and PolliognBlockTracker after I switch networks.
Steps:
Add ganache (server is on) Perform a tx Switch to sepolia
I agree this is should be addressed separately but I'm confused why I'm not seeing the errors you describe. I followed the steps above and this is what I'm seeing:
https://github.com/MetaMask/metamask-extension/assets/34557516/546a8592-3237-44d1-af49-27d02e8d6a20
Builds ready [37ef9ac]
- 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 (857 ± 451 ms)
Platform | Page | Metric | Min (ms) | Max (ms) | Average (ms) | StandardDeviation (ms) | MarginOfError (ms) |
---|---|---|---|---|---|---|---|
Chrome | Home | firstPaint | 86 | 238 | 136 | 43 | 20 |
domContentLoaded | 15 | 86 | 34 | 19 | 9 | ||
load | 77 | 2761 | 857 | 939 | 451 | ||
domInteractive | 15 | 85 | 34 | 19 | 9 |
Bundle size diffs [🚨 Warning! Bundle size has increased!]
- background: 278 Bytes (0.01%)
- ui: 2.14 KiB (0.03%)
- common: 0 Bytes (0.00%)
Builds ready [974acba]
- 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 (1093 ± 393 ms)
Platform | Page | Metric | Min (ms) | Max (ms) | Average (ms) | StandardDeviation (ms) | MarginOfError (ms) |
---|---|---|---|---|---|---|---|
Chrome | Home | firstPaint | 84 | 211 | 133 | 33 | 16 |
domContentLoaded | 10 | 71 | 32 | 16 | 8 | ||
load | 80 | 2007 | 1093 | 818 | 393 | ||
domInteractive | 9 | 71 | 32 | 16 | 8 |
Bundle size diffs [🚨 Warning! Bundle size has increased!]
- background: 278 Bytes (0.01%)
- ui: 2.14 KiB (0.03%)
- common: 0 Bytes (0.00%)
Builds ready [d7b1e5e]
- 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 (1058 ± 431 ms)
Platform | Page | Metric | Min (ms) | Max (ms) | Average (ms) | StandardDeviation (ms) | MarginOfError (ms) |
---|---|---|---|---|---|---|---|
Chrome | Home | firstPaint | 75 | 293 | 138 | 56 | 27 |
domContentLoaded | 10 | 74 | 27 | 15 | 7 | ||
load | 58 | 2408 | 1058 | 897 | 431 | ||
domInteractive | 10 | 74 | 27 | 15 | 7 |
Bundle size diffs [🚨 Warning! Bundle size has increased!]
- background: 278 Bytes (0.01%)
- ui: 2.14 KiB (0.03%)
- common: 0 Bytes (0.00%)