Skip to content

fix: bump SelectedNetworkController to fix issue where selected network domain is incorrectly set#25106

Merged
adonesky1 merged 9 commits intodevelopfrom
ad/chore/update-selected-network-controller
Jun 12, 2024
Merged

fix: bump SelectedNetworkController to fix issue where selected network domain is incorrectly set#25106
adonesky1 merged 9 commits intodevelopfrom
ad/chore/update-selected-network-controller

Conversation

@adonesky1
Copy link
Copy Markdown
Contributor

@adonesky1 adonesky1 commented Jun 6, 2024

Description

Pulls this fix which adds a guard to the setNetworkClientIdForDomain method on the SelectedNetworkController to no longer add domains to domains state (nor create a selected network proxy for them) unless the useRequestQueuePreference flag is true

Bumping the @metamask/selected-network-controller version required bumping peer dependencies:

  • @metamask/network-controller to v19.0.0
    • An existing patch was repointed to this version.
  • @metamask/permission-controller to v10.0.0
    - This required bumping its own peerDep @metamask/approval-controller to v7.0.0

Open in GitHub Codespaces

Related issues

See: https://consensys.slack.com/archives/C1L7H42BT/p1717512150509719

Manual testing steps

  1. Open settings -> experimental and toggle of the Select networks for each site setting
  2. Go to any site
  3. Open the console and execute:
await window.ethereum.request({
  "method": "eth_chainId",
  "params": []
});
  1. See that it matches the globally selected network
  2. Manually change the network with the network switcher
  3. Go back to the site and execute the same eth_chainId script
  4. See that the result has changed to the chainId you switched to
  5. Now execute
await window.ethereum.request({
  "method": "wallet_requestPermissions",
  "params": [
    {
      "eth_accounts": {}
    }
  ]
});

and connect an account to the site
9. Repeat steps 1 - 7
10. The eth_chainId results should still match the globally selected network

Screenshots/Recordings

Before

Screen.Recording.2024-06-06.at.12.16.28.PM.mov

After

Screen.Recording.2024-06-06.at.11.35.35.AM.mov

Pre-merge author checklist

  • I’ve followed MetaMask Coding Standards.
  • 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 format if applicable
  • I’ve applied the right labels on the PR (see labeling guidelines). 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.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Jun 6, 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.

@adonesky1 adonesky1 force-pushed the ad/chore/update-selected-network-controller branch from 0d425cb to dd9b20b Compare June 6, 2024 15:59
@adonesky1
Copy link
Copy Markdown
Contributor Author

@metamaskbot update-policies

@socket-security
Copy link
Copy Markdown

socket-security bot commented Jun 6, 2024

New and removed dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher
npm/@metamask/permission-controller@10.0.0 None +3 1.11 MB metamaskbot
npm/@metamask/selected-network-controller@15.0.2 None +6 686 kB

🚮 Removed packages: npm/@metamask/network-controller@18.1.2, npm/@metamask/permission-controller@9.1.0

View full report↗︎

@adonesky1 adonesky1 changed the title Ad/chore/update selected network controller fix: bump SelectedNetworkController to fix issue where selected network domain is incorrectly set Jun 6, 2024
@metamaskbot
Copy link
Copy Markdown
Collaborator

Policies updated

@adonesky1 adonesky1 added the team-wallet-api-platform-deprecated DEPRECATED: please use "team-wallet-integrations" instead label Jun 6, 2024
@adonesky1 adonesky1 marked this pull request as ready for review June 6, 2024 17:32
@adonesky1 adonesky1 requested review from a team as code owners June 6, 2024 17:32
@adonesky1
Copy link
Copy Markdown
Contributor Author

@metamaskbot update-policies

@metamaskbot
Copy link
Copy Markdown
Collaborator

Policies updated

@adonesky1 adonesky1 force-pushed the ad/chore/update-selected-network-controller branch from c6c2a49 to 2267ae3 Compare June 12, 2024 19:38
@socket-security
Copy link
Copy Markdown

socket-security bot commented Jun 12, 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↗︎

@adonesky1
Copy link
Copy Markdown
Contributor Author

@metamaskbot update-policies

@metamaskbot
Copy link
Copy Markdown
Collaborator

Policies updated

@codecov
Copy link
Copy Markdown

codecov bot commented Jun 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 65.62%. Comparing base (e407384) to head (21820a9).
Report is 1 commits behind head on develop.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop   #25106   +/-   ##
========================================
  Coverage    65.62%   65.62%           
========================================
  Files         1372     1372           
  Lines        54512    54512           
  Branches     14281    14281           
========================================
  Hits         35769    35769           
  Misses       18743    18743           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@adonesky1 adonesky1 requested a review from Gudahtt June 12, 2024 20:55
@metamaskbot
Copy link
Copy Markdown
Collaborator

Builds ready [21820a9]
Page Load Metrics (148 ± 200 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint69222923115
domContentLoaded9271352
load421962148416200
domInteractive9271352

@adonesky1 adonesky1 requested review from jiexi, mcmire and shanejonas June 12, 2024 21:46
Copy link
Copy Markdown
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.

LGTM.

@adonesky1 adonesky1 merged commit 92e6b94 into develop Jun 12, 2024
@adonesky1 adonesky1 deleted the ad/chore/update-selected-network-controller branch June 12, 2024 22:46
@github-actions github-actions bot locked and limited conversation to collaborators Jun 12, 2024
@metamaskbot metamaskbot added the release-12.1.0 Issue or pull request that will be included in release 12.1.0 label Jun 12, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-12.1.0 Issue or pull request that will be included in release 12.1.0 team-wallet-api-platform-deprecated DEPRECATED: please use "team-wallet-integrations" instead

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants