-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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 switch-ethereum-chain handler by passing configuration id to setA… #18483
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. |
Builds ready [a81dff7]
Page Load Metrics (1707 ± 87 ms)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Codecov Report
@@ Coverage Diff @@
## develop #18483 +/- ##
========================================
Coverage 65.15% 65.15%
========================================
Files 936 936
Lines 35965 35965
Branches 9231 9231
========================================
Hits 23432 23432
Misses 12533 12533
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
@@ -115,7 +115,7 @@ async function switchEthereumChainHandler( | |||
) { | |||
setProviderType(approvedRequestData.type); | |||
} else { | |||
await setActiveNetwork(approvedRequestData); | |||
await setActiveNetwork(approvedRequestData.id); |
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.
Codecov says Added line #L118 was not covered by tests
but it looks like it should be covered looking at the test. Is it just codecov who doesn't handle e2e here?
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.
yeah, codecov can't measure e2e tests
Builds ready [d426fc7]
Page Load Metrics (1460 ± 31 ms)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Builds ready [8e6eb11]
Page Load Metrics (1719 ± 67 ms)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Co-authored-by: legobeat <109787230+legobeat@users.noreply.github.com>
This reverts commit be533ff.
reverted the last commit because it broke lint (no arrow functions in |
Builds ready [90bf073]
Page Load Metrics (1666 ± 61 ms)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Fixes #18453
Explanation
In a previous commit, we updated
setActiveNetwork
in the network controller to receive a network configuration id instead of a whole network object. However, the parameter passed tosetActiveNetwork
in theswitch-ethereum-chain.js
handler was still passed the object, not the id. See 23ca4460cf#diff-93f17dab5026baf840aec766ac5b6ebcd35d5bb0abb45e2c3f41791423f2a488R117This PR corrects that, and adds an e2e test for the
wallet_switchEthereumChain
functionality, which would have caught this bug.It is worth noting that the bug this PR fixes would not occur if you switched to the network immediately after adding it, because the correct parameter is passed to the
setActiveNetwork
call inadd-ethereum-chain.js
which happens after prompting the user to switch networks (23ca4460cf#diff-b3485a1ea9943fd380364f73a53295289f2ccd3817423d4f245b5102f8620b3cR170)Manual Testing Steps
$(yarn bin ganache) --port 8546 --chain.chainId 1338
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.