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: cherry pick accounts controller migration improvements #26778

Merged

Conversation

owencraston
Copy link
Contributor

@owencraston owencraston commented Aug 29, 2024

Description

This PR cherry picks two improvements to the latest accounts controller migrations into the latest release.

Open in GitHub Codespaces

Related issues

Fixes: #26377

Manual testing steps

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.

This PR renames migration 126 to 121.1. The reason for this renaming is that commit 759b92e is being cherry-picked into version 12.1.1.

Between version 12.1.1 and the develop branch, there are missing migrations. To avoid skipping these migrations in subsequent releases, we need to rename migration 126 to 121.1.
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.

@owencraston owencraston changed the title fix: rename migration 126 to 121.1 (#26742) fix: Accounts controller migration improvements Aug 29, 2024
## **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.


[![Open in GitHub
Codespaces](https://github.com/codespaces/badge.svg)](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.
@owencraston owencraston marked this pull request as ready for review August 29, 2024 21:10
@owencraston owencraston requested a review from a team as a code owner August 29, 2024 21:10
@owencraston owencraston changed the title fix: Accounts controller migration improvements fix: cherry pick accounts controller migration improvements Aug 29, 2024
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.

Mostly looks good, but one extra migration was added that we should remove

@chloeYue chloeYue merged commit 1a5a9c0 into Version-v12.1.1 Aug 30, 2024
65 of 66 checks passed
@chloeYue chloeYue deleted the fix/cherry-pick-accounts-migration-improvements branch August 30, 2024 09:48
@github-actions github-actions bot locked and limited conversation to collaborators Aug 30, 2024
@metamaskbot
Copy link
Collaborator

Builds ready [11b2115]
Page Load Metrics (146 ± 152 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint672961095225
domContentLoaded993282010
load411513146316152
domInteractive992282010

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants