-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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: issue where provider engine needs to rerun after permissions are granted to ensure correct proxies are assigned #23525
fix: issue where provider engine needs to rerun after permissions are granted to ensure correct proxies are assigned #23525
Conversation
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. |
d1d17de
to
8c41fcd
Compare
dd8e36a
to
389e639
Compare
New and removed dependencies detected. Learn more about Socket for GitHub ↗︎
🚮 Removed packages: npm/@metamask/network-controller@18.0.1, npm/@metamask/queued-request-controller@0.6.1, npm/@metamask/selected-network-controller@9.0.0 |
@metamaskbot update-policies |
Policies updated |
👍 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. |
0e89e61
to
265e11f
Compare
@metamaskbot update-policies |
Policies updated |
1d15a0c
to
e39883f
Compare
e39883f
to
c12992a
Compare
@metamaskbot update-policies |
No policy changes |
c12992a
to
90ee937
Compare
@metamaskbot update-policies |
No policy changes |
Builds ready [a45f7e8]
Page Load Metrics (580 ± 419 ms)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
@@ -109,15 +109,13 @@ describe('Request Queuing for Multiple Dapps and Txs on different networks.', fu | |||
|
|||
// Dapp one send tx | |||
await driver.switchToWindowWithUrl(DAPP_URL); | |||
await driver.executeScript(`window.location.reload()`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
its no longer required to reload the page after connecting to ensure that the proxies are correctly synced
Builds ready [292a4fe]
Page Load Metrics (726 ± 542 ms)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Builds ready [2577090]
Page Load Metrics (1281 ± 573 ms)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Builds ready [61586c9]
Page Load Metrics (1318 ± 648 ms)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! One more pending suggestion (re: improving types), but overall this looks great
Builds ready [9592db0]
Page Load Metrics (1286 ± 641 ms)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Co-authored-by: Mark Stacey <markjstacey@gmail.com>
Builds ready [77f8100]
Page Load Metrics (954 ± 571 ms)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Description
When the "Selected networks for each site" toggle is enabled, the wallet API should use an origin-specific chain for all interactions. However this doesn't work correctly if the connection status has changed since the last refresh. If you grant permissions to a site or revoke them (i.e. connect to or disconnect from a site), the site does not work as expected until after the site is refreshed.
Expected behavior
The wallet API should always use the dapp-selected chain for sites with permissions, and should use the globally-selected chain for sites without permissions. This should apply even if the permissions have changed since the page loaded.
Solution
This PR introduces changes made to
@metamask/selected-network-controller
to resolve the issue described above:This domainProxyMap param now passed into
SelectedNetworkController
allows the client to handle pruning inactive proxies while the SelectedNetworkController handles adding entries - it can't handle removal, as it doesn't know which connections are active.The extension passes in an instance of a newly created
WeakStringMap
class which allows for garbage collection of its data once no longer referenced.Related issues
Fixes: #23509
Manual testing steps
The problem presented itself in two scenarios: when granting site permissions, and when revoking all site permissions.
When granting permissions:
When revoking permissions:
Screenshots/Recordings
Before
This recording shows both reproduction use cases (granting permissions, then revoking)
queue-selected-chain-bug-2024-03-14_19.49.19.webm
After
Screen.Recording.2024-04-08.at.11.33.40.AM.mov
Pre-merge author checklist
Pre-merge reviewer checklist