-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Ensure that all networkConfiguration object in networkController state have an id #18513
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. |
This will require #18512 (review) to get the build passing. |
Builds ready [fb3f650]
Page Load Metrics (1591 ± 52 ms)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Builds ready [5ec4489]
Page Load Metrics (1639 ± 39 ms)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Builds ready [7af5ddc]
Page Load Metrics (1603 ± 75 ms)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Builds ready [43d690a]
Page Load Metrics (1953 ± 120 ms)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
It probably does make sense to fix the state here but - just a thought - another lighter weight way to fix this (I think) would be to modify the
|
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
Builds ready [e751c04]
Page Load Metrics (1640 ± 107 ms)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Co-authored-by: Mark Stacey <markjstacey@gmail.com>
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!
Builds ready [83545e3]
Page Load Metrics (1713 ± 77 ms)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Builds ready [affa960]
Page Load Metrics (1610 ± 64 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!
Fixes #18509
Fixes #18453
Explanation
We partially fixed the symptom of 18509 and 18453 with #18483, but that fix was incomplete.
This bug will be experienced by anyone who added a network while on v10.27.0 or earlier, and are now on v10.28.1 or v10.28.2 and trying to confirm a dapp prompted switch to that network. This bug will not affect users who first added the network, via a dapp wallet_addEthereumChain request, while on v10.28.1 . This bug also won't affect users who added the network via the MetaMask UI in v10.28.1
The problem is that migration 82 did not add an
id
property to each network configuration object, but we assume thatid
property exists in theswitch-ethereum-chain.js
handler. If a user adds a network on version v10.27.0 or earlier, and then updates to v10.28.x, migration 82 will create an object withinNetworkController.networkConfigurations
keyed by a random id, but thatid
will not be added to that object itself. Later, when we attempt to switch to the network using that objectsid
property, it fails. It does not fail if the network is added while on v10.28.x, because theupsertNetworkConfiguration
method, which is called when adding a network on v10.28.x, adds anid
property to each network.This PR corrects the problem with a migration that ensures that the each key within
networkConfigurations
is used to set theid
property of the respective object.Before
This video shows what would happen when upgrading from v10.27.0 -> v10.28.2 and then trying to switch to a previously added network:
switchnetworkfail-v10282.mp4
After
This shows switch network working after an upgrade from v10.27.0 to the branch of this PR:
switchnetwork-fix.mp4
Manual Testing Steps
Do as is done in the above "After" video:
Pre-merge author checklist
Pre-merge reviewer checklist
If further QA is required (e.g. new feature, complex testing steps, large refactor), add the
Extension QA Board
label.In this case, a QA Engineer approval will be be required.