Skip to content
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

make network-controller methods overwrite rather than merge provider state #18127

Merged
merged 2 commits into from
Mar 16, 2023

Conversation

adonesky1
Copy link
Contributor

@adonesky1 adonesky1 commented Mar 13, 2023

This changes several places in the NetworkController where we call updateState - which merges partial state - on an ObservableStore instance, to putState - which wholly overwrites state in that store. This pattern of immutable state mutation is safer and avoids confusing state scenarios where, for instance, a rollbackToPreviousProvider call results in a provider state with some of the state of the provider we failed to connect alongside the the details of the provider we rolled back to.

@github-actions
Copy link
Contributor

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.

@metamaskbot
Copy link
Collaborator

Builds ready [8e756f4]
Page Load Metrics (1725 ± 51 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint100168124168
domContentLoaded1571190517019445
load15712015172510651
domInteractive1571190517019445
Bundle size diffs [🚀 Bundle size reduced!]
  • background: -12 bytes
  • ui: 0 bytes
  • common: 0 bytes

@codecov
Copy link

codecov bot commented Mar 13, 2023

Codecov Report

Merging #18127 (5c33af2) into develop (14b1555) will not change coverage.
The diff coverage is 100.00%.

@@           Coverage Diff            @@
##           develop   #18127   +/-   ##
========================================
  Coverage    63.93%   63.93%           
========================================
  Files          908      908           
  Lines        35399    35399           
  Branches      8976     8976           
========================================
  Hits         22632    22632           
  Misses       12767    12767           
Impacted Files Coverage Δ
.../scripts/controllers/network/network-controller.js 87.43% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@metamaskbot
Copy link
Collaborator

Builds ready [5c33af2]
Page Load Metrics (1534 ± 36 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint923211244823
domContentLoaded1413172415247436
load1413172415347436
domInteractive1413172415247436
Bundle size diffs [🚀 Bundle size reduced!]
  • background: -15 bytes
  • ui: 0 bytes
  • common: 0 bytes

@adonesky1 adonesky1 marked this pull request as ready for review March 13, 2023 21:46
@adonesky1 adonesky1 requested a review from a team as a code owner March 13, 2023 21:46
Copy link
Member

@Gudahtt Gudahtt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Copy link
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 d45c4ed into develop Mar 16, 2023
@adonesky1 adonesky1 deleted the network-controller-provider-overwrite branch March 16, 2023 20:53
@github-actions github-actions bot locked and limited conversation to collaborators Mar 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants