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

Migrate to new controller packages #16547

Merged
merged 23 commits into from
Nov 24, 2022
Merged

Conversation

mcmire
Copy link
Contributor

@mcmire mcmire commented Nov 16, 2022

Explanation

@metamask/controllers is deprecated, and most of the controllers that lived here are now located in their own package. This commit replaces @metamask/controllers in package.json with references to these packages and updates import lines to match.

Manual Testing Steps

This is a behind-the-scenes change, and there should be no changes to existing functionality — everything should work as it does currently. I'm not sure what the best protocol to test these sorts of changes is (maybe run through the most common scenarios? test-dapp?)

Note that before this PR gets merged, preview versions of the new packages, which live on GitHub Packages, will be used. Without specially configuring NPM, these packages will not be accessible locally, and therefore you will not be able to run yarn setup. To get this working:

  • Go into the token settings for your GitHub account and, if you have not already done so, create a classic personal access token. Make sure to store your token somewhere apart from GitHub as you won't be able to see it there.
  • Back in extension, create a file .npmrc in the root directory with the following content (note: this file is gitignored, so don't worry about it ending up in the repo):
    @metamask:registry=https://npm.pkg.github.com
    
    //npm.pkg.github.com/:_authToken=<insert your personal access token here>
    

Now you should be able to run yarn setup, then yarn start, and load the extension locally.

Pre-merge author checklist

  • I've clearly explained:
    • What problem this PR is solving
    • How this problem was solved
    • How reviewers can test my changes
  • Sufficient automated test coverage has been added

Pre-merge reviewer checklist

  • Manual testing (e.g. pull and build branch, run in browser, test code being changed)
  • PR is linked to the appropriate GitHub issue
  • IF this PR fixes a bug in the release milestone, add this PR to the release milestone

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.

`@metamask/controllers` is deprecated, and most of the controllers that
lived here are now located in their own package ([1]). This commit
replaces `@metamask/controllers` in `package.json` with references to
these packages and updates `import` lines to match.

[1]: MetaMask/core#831
@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.


# Test @metamask package publishing
.npmrc
Copy link
Contributor Author

@mcmire mcmire Nov 17, 2022

Choose a reason for hiding this comment

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

This is a temporary change and I can bring this out into a separate PR. For now, I've explained how this is used in the PR description. We want to gitignore it because if it's used for testing we don't want people's access tokens to end up in the repo.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well, I guess if we have the CircleCI config in this branch, we can have this here too since they're related.

package.json Outdated
@@ -110,24 +110,35 @@
"@keystonehq/bc-ur-registry-eth": "^0.12.1",
"@keystonehq/metamask-airgapped-keyring": "^0.6.1",
"@material-ui/core": "^4.11.0",
"@metamask/address-book-controller": "1.0.0-f2fa748",
Copy link
Contributor Author

@mcmire mcmire Nov 17, 2022

Choose a reason for hiding this comment

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

The versions we are using here look a bit funky, but they're autogenerated based on this PR and are temporary until we are able to QA the new packages in both extension and mobile. Once we've done that, and before merging this PR, I'll replace them with "1.0.0".

@@ -27,6 +27,9 @@ export const GAS_LIMITS = {
* These are already declared in @metamask/controllers but importing them from
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'm not sure if this comment will be true after this change. If there's no reason why it wouldn't be I can remove the TODO here and we can revisit this later.

Copy link
Contributor

Choose a reason for hiding this comment

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

Nice catch

@Gudahtt Gudahtt force-pushed the migrate-to-new-controller-packages branch from 8fe18a4 to cd9ea6e Compare November 17, 2022 03:23
@metamaskbot
Copy link
Collaborator

Builds ready [15b5841]
Page Load Metrics (2588 ± 272 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint1022718359613294
domContentLoaded178542432580567272
load179742442588567272
domInteractive178542432580567272
Bundle size diffs [🚀 Bundle size reduced!]
  • background: 1249579 bytes
  • ui: 2901 bytes
  • common: -1402960 bytes

highlights:

storybook

@mcmire mcmire added the DO-NOT-MERGE Pull requests that should not be merged label Nov 17, 2022
@mcmire mcmire marked this pull request as ready for review November 17, 2022 19:20
@mcmire mcmire requested review from a team and kumavis as code owners November 17, 2022 19:20
@mcmire mcmire requested a review from danjm November 17, 2022 19:20
@mcmire
Copy link
Contributor Author

mcmire commented Nov 17, 2022

Marking as DO-NOT-MERGE as we need to release 1.0.0 versions of these packages, but before we can do that we need to ensure that mobile also works with these changes. Open for review though, do your worst :)

@mcmire
Copy link
Contributor Author

mcmire commented Nov 18, 2022

Moving this back to draft so that we can continue to access the preview versions of the aforementioned packages within the GitHub Package Registry, but please feel free to review this!

@metamaskbot
Copy link
Collaborator

Builds ready [ea58338]
Page Load Metrics (2001 ± 101 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint881698189348167
domContentLoaded15852235197819895
load158623062001209101
domInteractive15852235197819895
Bundle size diffs [🚀 Bundle size reduced!]
  • background: 1250563 bytes
  • ui: 3146 bytes
  • common: -1402729 bytes

highlights:

storybook

@metamaskbot
Copy link
Collaborator

Builds ready [2f7761c]
Page Load Metrics (2060 ± 126 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint91127111105
domContentLoaded162124602035261125
load166225282060262126
domInteractive162124602035261125
Bundle size diffs [🚀 Bundle size reduced!]
  • background: 1251104 bytes
  • ui: 5364 bytes
  • common: -1402597 bytes

highlights:

storybook

@Gudahtt Gudahtt marked this pull request as ready for review November 22, 2022 16:18
@Gudahtt Gudahtt removed the DO-NOT-MERGE Pull requests that should not be merged label Nov 22, 2022
@Gudahtt
Copy link
Member

Gudahtt commented Nov 22, 2022

The controller packages have been published! This is now ready for review.

@metamaskbot
Copy link
Collaborator

Builds ready [ca210aa]
Page Load Metrics (2202 ± 147 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint1051761342110
domContentLoaded172026532186306147
load172027012202306147
domInteractive172026532186306147
Bundle size diffs [🚀 Bundle size reduced!]
  • background: 1252646 bytes
  • ui: 5364 bytes
  • common: -1402597 bytes

highlights:

storybook

brad-decker
brad-decker previously approved these changes Nov 22, 2022
Copy link
Contributor

@brad-decker brad-decker left a comment

Choose a reason for hiding this comment

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

LGTM. Built locally with no issues.

@adonesky1
Copy link
Contributor

adonesky1 commented Nov 22, 2022

Not having trouble building, but am poking around and am currently seeing an issue with manually adding an NFT (this feature is behind a flag). Currently digging to see what is the cause of the issue.

nevermind! Build fluke. Got it working.

adonesky1
adonesky1 previously approved these changes Nov 22, 2022
Copy link
Contributor

@adonesky1 adonesky1 left a comment

Choose a reason for hiding this comment

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

Code changes LGTM. I tested some common user flows, but might be worth giving this a more thorough QA treatment before merge?

package.json Outdated Show resolved Hide resolved
@seaona
Copy link
Contributor

seaona commented Nov 24, 2022

The PR looks good. I confirm it fixes the issues with 0 decimal tokens. I've QAd on Chrome, as on FireFox the extension is crashing (due to the FireFox bug spot a week ago, now fixed on develop).

I only found this issue, but I cannot ensure it is due to this PR, nor how to reproduce it consistently.
#16675

…troller-packages

* origin/develop: (21 commits)
  Simplify MV3 initialization (#16559)
  Fix #15050 - MV3: Keep the user logged in when service worker restarts (#15558)
  Integrating snow into metamask (#15580)
  fix infura rpc detection (#16585)
  Remove callback from being saved in controller state (#16627)
  Icon house keeping updates (#16621)
  Fix bundle size diff message (#16576)
  avatar base component housekeeping (#16583)
  Disabled save button on add contact form if input fields are empty (#16233)
  Fix E2E chunking (#16653)
  fixed console warning for labelProps (#16629)
  Adding `FormTextField` component (#16497)
  Fix/16620/button href prop (#16633)
  Update to correct version
  Beta Changelog
  Fix version number
  Ensure prod beta build is created when merging to master (#16557)
  Beta: Update long logo to new imagery (#16505)
  BETA - Add beta banner to all screens (#16307)
  BETA - Update logo imagery (#16304)
  ...
@Gudahtt Gudahtt dismissed stale reviews from adonesky1 and brad-decker via ab9bb42 November 24, 2022 15:03
@metamaskbot
Copy link
Collaborator

Builds ready [ec2be79]
Page Load Metrics (2159 ± 113 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint104180129199
domContentLoaded169027092133226109
load169027962159235113
domInteractive169027092133226109
Bundle size diffs [🚀 Bundle size reduced!]
  • background: 1240998 bytes
  • ui: 34 bytes
  • common: -1403248 bytes

highlights:

storybook

@Gudahtt
Copy link
Member

Gudahtt commented Nov 24, 2022

Thanks @seaona ! I took a look at that issue, and it looks like it's functioning as expected, but with incorrect logging.

I have brought this branch up-to-date with develop, so it should now work on Firefox in dev mode as well.

@seaona
Copy link
Contributor

seaona commented Nov 24, 2022

thank you @Gudahtt !! I've pulled the last changes and looking good on FF too

@Gudahtt Gudahtt merged commit 51cffa1 into develop Nov 24, 2022
@Gudahtt Gudahtt deleted the migrate-to-new-controller-packages branch November 24, 2022 19:59
@github-actions github-actions bot locked and limited conversation to collaborators Nov 24, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
needs-qa Label will automate into QA workspace type-refactor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants