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

fix: Remove old properties from state #29792

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

mcmire
Copy link
Contributor

@mcmire mcmire commented Jan 17, 2025

Description

There are several kinds of errors in Sentry which indicate that there are properties in controller state we are attempting to persist that do not have corresponding metadata. This indicates that these properties were removed at some point from the controller's state but no migration was added that removed them from the persisted wallet state. In many cases, at the time of removal, such a migration was not needed because the controller in question inherited from BaseController v1. We have made a targeted effort over the past few years to migrate all controllers to BaseController v2, however, and so it matters now that every property have corresponding metadata or else are removed from state. We don't want these errors to show up in Sentry because they create noise, so this commit removes these properties from state.

Open in GitHub Codespaces

Related issues

Fixes #28289.
Fixes #28290.
Fixes #28300.
Fixes #28302.
Fixes #28344.
Fixes #28608.
Fixes #29746.

Manual testing steps

These changes should not affect users in any way since the errors we are trying to avoid occur out of band and should not crash anything.

Screenshots/Recordings

Before

After

Pre-merge author checklist

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

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.

delete state.NetworkController.networkConfigurations;
// Removed in 800a9d3a177446ff2d05e3e95ec06b3658474207 with a migration, but
// still persists for some people for some reason
delete state.NetworkController.providerConfig;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I found this error in Sentry: https://metamask.sentry.io/issues/6011869130/events/039861ddb07f4b39b947edba3bbd710e/. I am not sure why it is occurring. We already have a migration that removes this property. So do we need this here? Kind of strange that some people still have this property.

delete state.PreferencesController.infuraBlocked;
// Removed in 4f66dc948fee54b8491227414342ab0d373475f1 with a migration, but
// still persists for some people for some reason
delete state.PreferencesController.useCollectibleDetection;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I found this error in Sentry here: https://metamask.sentry.io/issues/6042074159/events/5711f95785d741739e5d0fa5ad19e7c0/. Again we already have a migration that should be removing this property, so I'm not sure if this is needed?

@mcmire mcmire changed the title Remove old properties from state fix: Remove old properties from state Jan 17, 2025
@metamaskbot
Copy link
Collaborator

Builds ready [f964268]
Page Load Metrics (1736 ± 65 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint29520601647331159
domContentLoaded14912048170913464
load15112063173613665
domInteractive266836126
backgroundConnect66123199
firstReactRender1678432311
getState45116178
initialActions01000
loadScripts10721519125811555
setupStore65615178
uiStartup17082281196214670
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 1.55 KiB (0.03%)
  • ui: 38 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

There are several kinds of errors in Sentry which indicate that there
are properties in controller state we are attempting to persist that do
not have corresponding metadata. This indicates that these properties
were removed at some point from the controller's state but no migration
was added that removed them from the persisted wallet state. In many
cases, at the time of removal, such a migration was not needed because
the controller in question inherited from BaseController v1. However, we
have made a targeted effort over the past few years to migrate all
controllers to BaseController v2, and so it matters now that every
property have corresponding metadata or else are removed from state. We
don't want these errors to show up in Sentry because they create noise,
so this commit removes these properties from state.
@mcmire mcmire force-pushed the remove-old-state-properties branch from f964268 to e69d847 Compare January 17, 2025 21:35
@metamaskbot
Copy link
Collaborator

Builds ready [e69d847]
Page Load Metrics (1768 ± 76 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint34720881641455218
domContentLoaded14992063174015373
load15172095176815976
domInteractive268841178
backgroundConnect4101262914
firstReactRender1696472914
getState46218199
initialActions00000
loadScripts10591516127712359
setupStore687202613
uiStartup175627982058258124
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 1.55 KiB (0.03%)
  • ui: 38 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

@mcmire mcmire marked this pull request as ready for review January 17, 2025 22:12
@metamaskbot
Copy link
Collaborator

Builds ready [f28fa49]
Page Load Metrics (1930 ± 229 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint34536251795649312
domContentLoaded151536041904482231
load157636191930477229
domInteractive25113472311
backgroundConnect77326209
firstReactRender18197464321
getState574232311
initialActions01000
loadScripts109127781434391188
setupStore67115189
uiStartup177944932297621298
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 1.65 KiB (0.03%)
  • ui: 38 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

@mcmire mcmire requested a review from a team January 17, 2025 23:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment