fix: removes extra domains from SelectedNetworkController domain state#23130
fix: removes extra domains from SelectedNetworkController domain state#23130
SelectedNetworkController domain state#23130Conversation
|
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. |
7041cee to
f9d191b
Compare
There was a problem hiding this comment.
this wasn't being used?
@metamask/selected-network-controller to v8.0.0
b527a23 to
495f622
Compare
app/scripts/metamask-controller.js
Outdated
There was a problem hiding this comment.
this is no longer necessary because SelectedNetworkController no longer keeps track of the globally selectedNetworkClientId
app/scripts/metamask-controller.js
Outdated
There was a problem hiding this comment.
this is no longer necessary because SelectedNetworkController no longer keeps track of the globally selectedNetworkClientId
|
@metamaskbot update-policies |
|
No policy changes |
Builds ready [90af9d5]
Page Load Metrics (1760 ± 88 ms)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
app/scripts/metamask-controller.js
Outdated
There was a problem hiding this comment.
we should probably just remove this redundant perDomainNetwork state from the SelectedNetworkController and just query for the useRequestQueue state on the PreferencesController wherever we need it. But this will require another update to the SelectedNetworkController and should be done in a separate PR.
There was a problem hiding this comment.
This dedupe is happening here btw: MetaMask/core#3989
01ef225 to
a44307e
Compare
| useRequestQueue: true, | ||
| }, | ||
| SelectedNetworkController: { domains: true, perDomainNetwork: false }, | ||
| SelectedNetworkController: { domains: false, perDomainNetwork: true }, |
There was a problem hiding this comment.
We do not want to include domains in our sentry reports since it is potentially sensitive and violates our goal to preserve privacy, but we do want to include the perDomainNetwork toggle since it is not sensitive and potentially useful for diagnosing bugs.
| // When permissions are added for a given origin we need to | ||
| // set the network client id for that origin to the current | ||
| // globally selected network client id. | ||
| if (accounts.length > 0) { | ||
| // TODO add this logic directly in the SelectedNetworkController | ||
| this.selectedNetworkController.setNetworkClientIdForDomain( | ||
| origin, | ||
| this.networkController.state.selectedNetworkClientId, | ||
| ); | ||
| } else { | ||
| // TODO remove domain from selectedNetworkController when permissions are removed | ||
| // Add this logic directly in the SelectedNetworkController | ||
| } |
There was a problem hiding this comment.
There is a WIP PR against the SelectedNetworkController to pull this logic into that controller instead: MetaMask/core#3969
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #23130 +/- ##
===========================================
- Coverage 68.61% 68.59% -0.02%
===========================================
Files 1098 1099 +1
Lines 43101 43141 +40
Branches 11513 11539 +26
===========================================
+ Hits 29571 29589 +18
- Misses 13530 13552 +22 ☔ View full report in Codecov by Sentry. |
Builds ready [a72e1c7]
Page Load Metrics (1254 ± 468 ms)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
@metamask/selected-network-controller to v8.0.0@metamask/selected-network-controller to v8.0.0
@metamask/selected-network-controller to v8.0.0SelectedNetworkController domain state
test/e2e/tests/request-queuing/multiple-networks-dapps-txs.spec.js
Outdated
Show resolved
Hide resolved
test/e2e/tests/request-queuing/multiple-networks-dapps-txs.spec.js
Outdated
Show resolved
Hide resolved
|
The diff looks good! I can re-review when CI passes. It looks like at least one of the CI failures is related to these changes, the e2e test failure. |
Builds ready [a9885a5]
Page Load Metrics (889 ± 433 ms)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
test/e2e/tests/request-queuing/multiple-networks-dapps-txs.spec.js
Outdated
Show resolved
Hide resolved
test/e2e/tests/request-queuing/multiple-networks-dapps-txs.spec.js
Outdated
Show resolved
Hide resolved
Builds ready [bbc2f17]
Page Load Metrics (886 ± 393 ms)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Builds ready [3e67f01]
Page Load Metrics (1340 ± 305 ms)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
@metamask/selected-network-controllerwhich fixes issue where theSelectedNetworkControlleradds any and all domains the user visits to itsdomainsstate whether or not the user has connected to these sites.domainsstate in theSelectedNetworkController. I've created a ticket here to move this logic into theSelectedNetworkControlleritself.useRequestQueuefeature flag with theperDomainNetworkfeature flag. I've created a ticket here to remove the latter state since it is redundant and requires keeping these two booleans in sync.setNetworkClientIdForMetamasksince the latest version of@metamask/selected-network-controllerremoves this method (and themetamaskdomain from thedomainsstate entirely).SelectedNetworkControllerwhen feature flag is on and connected origin is indomainsstate (which can only happen when the dapp is connected) insetupProviderEnginefor RPC middleware stack.addEthereumChainrequest and the user then accepts the subsequentswitchEthereumChaincall that is chained on, thenetworkClientIDset for that dapp in theSelectedNetworkControllerdomains state will not be updated.Manual Testing Steps
well first you need to comment out some code that is causing a separate bug (found on develop) but one that will make manually testing this a nightmare.
settings>experimental>Select networks for each siteand toggle this setting onswitchEthereumChainon one of the connected dapps (they each have UI elements that do this)switchEthereumChainconfirmation back to Ethereum Mainnet before the transaction confirmation is show.