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: block tracker stops polling when switching away from the network #29045

Merged
merged 11 commits into from
Dec 18, 2024

Conversation

mikesposito
Copy link
Member

@mikesposito mikesposito commented Dec 10, 2024

Description

This PR bumps @metamask/network-controller and @metamask/eth-json-rpc-middleware by a patch version to fix an issue related to @metamask/eth-block-tracker, used to listen to new blocks emitted by networks.

Open in GitHub Codespaces

Related issues

Fixes: #17040

Manual testing steps

This only applies to views that show a single chain: since now the wallet home shows all networks, requests will be fired regardless of the globally selected network. To test this, the chain filter in the home should be set to a specific chain, instead of all

  1. Add a local ganache network
  2. Turn off the local ganache server
  3. Observe requests failing when navigating to the home of the wallet (while showing all networks)
  4. Filter a single chain which is not the local one (e.g. mainnet)
  5. Polling to localhost should stop

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.

Copy link

socket-security bot commented Dec 10, 2024

Removed dependencies detected. Learn more about Socket for GitHub ↗︎

🚮 Removed packages: npm/@metamask/network-controller@22.1.0

View full report↗︎

@mikesposito mikesposito changed the title Mikesposito/deps/network controller fix: block tracker stops polling when switching away from the network Dec 10, 2024
@mikesposito mikesposito marked this pull request as ready for review December 10, 2024 10:02
@metamaskbot
Copy link
Collaborator

Builds ready [b7f5958]
Page Load Metrics (1889 ± 103 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint15812384188520799
domContentLoaded15722354186020397
load158224491889215103
domInteractive248037168
backgroundConnect993312411
firstReactRender158526209
getState763931497837
initialActions01000
loadScripts11911833146418388
setupStore77612157
uiStartup186828742236270130
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 0 Bytes (0.00%)
  • ui: 0 Bytes (0.00%)
  • common: 2.94 KiB (0.04%)

package.json Outdated Show resolved Hide resolved
Copy link

socket-security bot commented Dec 10, 2024

👍 Dependency issues cleared. Learn more about Socket for GitHub ↗︎

This PR previously contained dependency changes with security issues that have been resolved, removed, or ignored.

View full report↗︎

@mikesposito
Copy link
Member Author

@SocketSecurity ignore npm/reselect@3.0.1

This package version was published 8 years ago, and is not being changed in this PR

@mikesposito mikesposito requested a review from Gudahtt December 10, 2024 13:38
@metamaskbot
Copy link
Collaborator

Builds ready [45b2aa5]
Page Load Metrics (1957 ± 96 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint18324791860430207
domContentLoaded16282448193720297
load16482474195720196
domInteractive2310237178
backgroundConnect76020168
firstReactRender1694272210
getState1013581606833
initialActions00000
loadScripts12631980152517483
setupStore713821
uiStartup186529022331294141
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 0 Bytes (0.00%)
  • ui: 0 Bytes (0.00%)
  • common: 2.94 KiB (0.04%)

Gudahtt
Gudahtt previously approved these changes Dec 10, 2024
Copy link
Member

@Gudahtt Gudahtt left a comment

Choose a reason for hiding this comment

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

LGTM!

mcmire
mcmire previously approved these changes Dec 11, 2024
Copy link
Contributor

@mcmire mcmire left a comment

Choose a reason for hiding this comment

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

I have confirmed that requests no longer occur via the block tracker for a failing network when switching away.

@mikesposito mikesposito dismissed stale reviews from mcmire and Gudahtt via c20642f December 12, 2024 09:54
@mikesposito
Copy link
Member Author

Resolved conflicts

@metamaskbot
Copy link
Collaborator

Builds ready [c20642f]
Page Load Metrics (1628 ± 66 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint14081954162913665
domContentLoaded13951919160513264
load14051952162813866
domInteractive23111422211
backgroundConnect87326199
firstReactRender1678462512
getState438873
initialActions01000
loadScripts9641464118411756
setupStore643984
uiStartup16432185183314369
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: 0 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

mcmire
mcmire previously approved these changes Dec 16, 2024
@Gudahtt Gudahtt force-pushed the mikesposito/deps/network-controller branch from 4ad13db to d470307 Compare December 17, 2024 16:37
@Gudahtt
Copy link
Member

Gudahtt commented Dec 17, 2024

Ah sorry, I pushed a commit to fix the lock file but then realized immediately after that the branch was outdated, so I removed it again. Sorry for that.

The branch needs an update, but in addition to that, there's a bunch of changes in the lockfile that don't seem to be necessary. I'd recommend resetting the lockfile from main (git checkout origin/main yarn.lock && yarn && yarn dedupe) to get rid of those.

@metamaskbot
Copy link
Collaborator

Builds ready [521ab4e]
Page Load Metrics (1661 ± 43 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint1430177016588541
domContentLoaded1423176216357938
load1431177416618943
domInteractive21100412210
backgroundConnect975302110
firstReactRender15104443215
getState4401084
initialActions01000
loadScripts1027133212117737
setupStore677252613
uiStartup163325131971233112
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: 0 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

@mikesposito mikesposito requested a review from mcmire December 18, 2024 13:39
@metamaskbot
Copy link
Collaborator

Builds ready [f1e746b]
Page Load Metrics (1840 ± 91 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint38322191769371178
domContentLoaded14802191182218991
load14852198184018991
domInteractive277948189
backgroundConnect86026189
firstReactRender1798602814
getState55514136
initialActions00000
loadScripts10541696135617484
setupStore683242512
uiStartup180529902197291140
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: 0 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

Copy link
Member

@Gudahtt Gudahtt left a comment

Choose a reason for hiding this comment

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

LGTM!

@mikesposito mikesposito added this pull request to the merge queue Dec 18, 2024
Merged via the queue into main with commit f8a1d4f Dec 18, 2024
77 checks passed
@mikesposito mikesposito deleted the mikesposito/deps/network-controller branch December 18, 2024 18:24
@github-actions github-actions bot locked and limited conversation to collaborators Dec 18, 2024
@metamaskbot metamaskbot added the release-12.11.0 Issue or pull request that will be included in release 12.11.0 label Dec 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
release-12.11.0 Issue or pull request that will be included in release 12.11.0 team-wallet-framework
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: MM is sending RPC requests to another custom network, aside from the one that's currently selected
5 participants