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

Remove eth-keyring-controller use from MetamaskController #20504

Merged
merged 12 commits into from
Sep 30, 2023

Conversation

mikesposito
Copy link
Member

@mikesposito mikesposito commented Aug 17, 2023

Explanation

This PR removes the leftover EthKeyringController interactions from MetamaskController.

  • Updated @metamask/signature-controller to ^6.0.0 along with its patch
  • Removed interactions with @metamask/eth-keyring-controller from MetamaskController
    • Now state passed to UI is taken from @metamask/keyring-controller
  • Fixed behaviour for some tests, needed after this refactoring
    • createNewVaultAndKeychain test assertion slightly changed
    • preferencesController.removeAddress mocked to always resolve
  • MetamaskController.getState() returns a flattened state object which now includes coreKeyringController's state, but the vault property is removed

References

Manual Testing Steps

Interactions with keyrings should work as before

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.

@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.

@cryptodev-2s cryptodev-2s force-pushed the refactor/remove-eth-keyring-controller-usage branch from 8b95f54 to d344faf Compare August 28, 2023 13:11
@mikesposito mikesposito changed the title refactor: remove remaining eth-keyring-controller use Remove eth-keyring-controller use from MetamaskController Sep 4, 2023
@mikesposito mikesposito force-pushed the refactor/remove-eth-keyring-controller-usage branch 2 times, most recently from 5a68ad1 to 0a51549 Compare September 12, 2023 13:20
@mikesposito mikesposito force-pushed the refactor/remove-eth-keyring-controller-usage branch 3 times, most recently from c0170e6 to c921094 Compare September 25, 2023 11:20
@socket-security
Copy link

socket-security bot commented Sep 25, 2023

Updated and removed dependencies detected. Learn more about Socket for GitHub ↗︎

Packages Version New capabilities Transitives Size Publisher
@metamask/signature-controller 5.3.0...6.1.1 None +0/-0 93.1 kB

🚮 Removed packages: @metamask/[email protected]

@mikesposito mikesposito force-pushed the refactor/remove-eth-keyring-controller-usage branch 2 times, most recently from a903e51 to ad7f9ac Compare September 26, 2023 18:02
@mikesposito

This comment was marked as resolved.

@metamaskbot

This comment was marked as outdated.

@mikesposito mikesposito force-pushed the refactor/remove-eth-keyring-controller-usage branch from 3d7823d to d1f00a0 Compare September 27, 2023 11:44
Comment on lines +733 to +739
await metamaskController.coreKeyringController.createNewVaultAndRestore(
'password',
TEST_SEED,
);
Copy link
Member Author

Choose a reason for hiding this comment

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

We can't really test anything properly without a vault and an unlocked KeyringController.

@mikesposito mikesposito force-pushed the refactor/remove-eth-keyring-controller-usage branch from 9a19494 to 579f639 Compare September 27, 2023 12:29
@@ -245,7 +245,7 @@
"@metamask/design-tokens": "^1.12.0",
"@metamask/desktop": "^0.3.0",
"@metamask/eth-json-rpc-middleware": "^11.0.0",
"@metamask/eth-keyring-controller": "^10.0.1",
"@metamask/eth-keyring-controller": "^13.0.1",
Copy link
Member Author

Choose a reason for hiding this comment

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

This is kept here for keyringBuilderFactory only

@mikesposito
Copy link
Member Author

@metamaskbot update-policies

@metamaskbot
Copy link
Collaborator

Policies updated

@mikesposito mikesposito force-pushed the refactor/remove-eth-keyring-controller-usage branch 4 times, most recently from 7f27e19 to 351a6cb Compare September 27, 2023 14:03
@mikesposito mikesposito marked this pull request as ready for review September 27, 2023 14:08
@mikesposito mikesposito requested review from a team as code owners September 27, 2023 14:08
@mikesposito mikesposito force-pushed the refactor/remove-eth-keyring-controller-usage branch from 01d1761 to cff1339 Compare September 29, 2023 09:26
@metamaskbot
Copy link
Collaborator

Builds ready [cff1339]
Page Load Metrics (703 ± 360 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint84143101168
domContentLoaded6613789178
load771729703750360
domInteractive6613789178
Bundle size diffs [🚀 Bundle size reduced!]
  • background: -50.34 KiB (-1.35%)
  • ui: 1.22 KiB (0.02%)
  • common: -1.24 KiB (-0.03%)

@socket-security
Copy link

socket-security bot commented Sep 29, 2023

👍 Dependency issues cleared. Learn more about Socket for GitHub ↗︎

This PR previously contained dependency changes with security issues that have been resolved, removed, or ignored.

Ignoring: @metamask/[email protected]

Next steps

Take a deeper look at the dependency

Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support [AT] socket [DOT] dev.

Remove the package

If you happen to install a dependency that Socket reports as Known Malware you should immediately remove it and select a different dependency. For other alert types, you may may wish to investigate alternative packages or consider if there are other ways to mitigate the specific risk posed by the dependency.

Mark a package as acceptable risk

To ignore an alert, reply with a comment starting with @SocketSecurity ignore followed by a space separated list of package-name@version specifiers. e.g. @SocketSecurity ignore [email protected] bar@* or ignore all packages with @SocketSecurity ignore-all

Gudahtt
Gudahtt previously approved these changes Sep 29, 2023
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!

@mikesposito
Copy link
Member Author

@SocketSecurity ignore @metamask/[email protected]

This is our package, 6.1.1 published ~1 hour ago

@mikesposito
Copy link
Member Author

@metamaskbot update-policies

@metamaskbot
Copy link
Collaborator

Policies updated

@metamaskbot
Copy link
Collaborator

Builds ready [9eaabf7]
Page Load Metrics (606 ± 336 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint86128100126
domContentLoaded6812491178
load801663606699336
domInteractive6812491178
Bundle size diffs [🚀 Bundle size reduced!]
  • background: -50.34 KiB (-1.35%)
  • ui: 1.22 KiB (0.02%)
  • common: -1.24 KiB (-0.03%)

@mikesposito mikesposito merged commit 0a215ca into develop Sep 30, 2023
9 checks passed
@mikesposito mikesposito deleted the refactor/remove-eth-keyring-controller-usage branch September 30, 2023 08:02
@github-actions github-actions bot locked and limited conversation to collaborators Sep 30, 2023
@metamaskbot metamaskbot added the release-11.3.0 Issue or pull request that will be included in release 11.3.0 label Sep 30, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
release-11.3.0 Issue or pull request that will be included in release 11.3.0 team-wallet-framework
Projects
None yet
5 participants