You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: Improve migration 121.1 state validation (#26773)
## **Description**
Migration 121.1 has been updated to include more state validation, so
that it does not throw an error in the event that state is corrupted in
some unexpected way. Unexpected corrupted state is now reported to
Sentry as well.
[](https://codespaces.new/MetaMask/metamask-extension/pull/26773?quickstart=1)
## **Related issues**
Related: #26377
## **Manual testing steps**
The unit tests outline the scenarios that the added validation are meant
to cover. Probably not worth anyone's time to manually test those.
To test the migration in general though, here are the steps:
* Create a dev build from v12.1.0
* Install the dev build from the `dist/chrome` directory and proceed
through onboarding
* Run this command in the background console: ```
chrome.storage.local.get( null, (state) => {
state.data.AccountsController.internalAccounts.selectedAccount =
'unknown id';
chrome.storage.local.set(state, () => chrome.runtime.reload()); } ); ```
* The extension should now be in a broken state
* Note that you can use this same script to corrupt state in other ways
to test other scenarios
* Disable the extension
* Switch to this branch and create a dev build
* Enable and reload the extension
* You should see in the console that migration 121.1 has run without
error
* You can run `chrome.storage.local.get(console.log)` to check that the
AccountsController state is now valid
* The extension should no longer be broken
## **Screenshots/Recordings**
N/A
## **Pre-merge author checklist**
- [x] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask
Extension Coding
Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/CODING_GUIDELINES.md).
- [x] I've completed the PR template to the best of my ability
- [x] I’ve included tests if applicable
- [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [x] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.
## **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.
0 commit comments