-
Notifications
You must be signed in to change notification settings - Fork 5k
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
Use @metamask/keyring-controller
#19659
Conversation
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. |
👍 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. |
No top level dependency changes detected. Learn more about Socket for GitHub ↗︎ |
Codecov Report
@@ Coverage Diff @@
## develop #19659 +/- ##
===========================================
- Coverage 69.36% 69.36% -0.00%
===========================================
Files 987 987
Lines 37289 37292 +3
Branches 10011 10011
===========================================
+ Hits 25865 25867 +2
- Misses 11424 11425 +1
|
Builds ready [ed4efdb]
Page Load Metrics (1663 ± 65 ms)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
ed4efdb
to
8d67d4e
Compare
Uhm, it looks like we are adding ~150kb to the background bundle, which isn't great. From the bundle visualizer, looks like |
Builds ready [8d67d4e]
Page Load Metrics (1950 ± 37 ms)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
40b1e8b
to
a73071d
Compare
@metamaskbot update-policies |
Policies updated |
Builds ready [6d13c99]
Page Load Metrics (1605 ± 75 ms)
Bundle size diffs [🚀 Bundle size reduced!]
|
c65c6b9
to
2d584d7
Compare
In the extension we still use |
Builds ready [2d584d7]
Page Load Metrics (1561 ± 33 ms)
Bundle size diffs [🚀 Bundle size reduced!]
|
@metamaskbot update-policies |
No policy changes |
Builds ready [a052202]
Page Load Metrics (1705 ± 83 ms)
Bundle size diffs [🚀 Bundle size reduced!]
|
a052202
to
95313e3
Compare
Builds ready [95313e3]
Page Load Metrics (1588 ± 45 ms)
Bundle size diffs [🚀 Bundle size reduced!]
|
95313e3
to
1567ae0
Compare
@metamaskbot update-policies |
Policies updated |
Builds ready [608b911]
Page Load Metrics (1503 ± 42 ms)
Bundle size diffs [🚀 Bundle size reduced!]
|
@@ -1,10 +1,11 @@ | ||
import type { TxData, TypedTransaction } from '@ethereumjs/tx'; | ||
-import { type MetaMaskKeyring as QRKeyring, type IKeyringState as IQRKeyringState } from '@keystonehq/metamask-airgapped-keyring'; | ||
+import type { MetaMaskKeyring as QRKeyring, IKeyringState as IQRKeyringState } from '@keystonehq/metamask-airgapped-keyring'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Curious why these type imports were changed. Was this unintended? Or did the import { type ___ }
syntax cause problems with the build system?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is intended, but it looks like it breaks only the lint step: https://app.circleci.com/pipelines/github/MetaMask/metamask-extension/51596/workflows/800ab01e-5b6f-44c1-9312-934fdd12c838/jobs/1501250
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah I see. The TypeScript version used here is fairly old, that's probably why.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm. Should we add TypeScript ~4.6.3
as an optional peer dependency to all packages in the core
repo?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe >=4.6.3
instead? But yes that might be a good idea
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
syncIdentities: this.preferencesController.syncAddresses.bind( | ||
this.preferencesController, | ||
), | ||
updateIdentities: this.preferencesController.setAddresses.bind( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed that setAddresses
isn't quite the equivalent of updateIdentities
. updateIdentities
will update selectedAddress
if the referenced account is removed, but setAddresses
will not do that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can handle this in a later PR, but it will come up once we start using the core keyring controller for creating accounts and keyrings
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can do this as part of #18772
Builds ready [16e373d]
Page Load Metrics (1596 ± 48 ms)
Bundle size diffs [🚀 Bundle size reduced!]
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Had one question, but this looks good to me.
@@ -1,10 +1,11 @@ | ||
import type { TxData, TypedTransaction } from '@ethereumjs/tx'; | ||
-import { type MetaMaskKeyring as QRKeyring, type IKeyringState as IQRKeyringState } from '@keystonehq/metamask-airgapped-keyring'; | ||
+import type { MetaMaskKeyring as QRKeyring, IKeyringState as IQRKeyringState } from '@keystonehq/metamask-airgapped-keyring'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm. Should we add TypeScript ~4.6.3
as an optional peer dependency to all packages in the core
repo?
Builds ready [9530eed]
Page Load Metrics (1601 ± 41 ms)
Bundle size diffs [🚀 Bundle size reduced!]
|
Explanation
This PR enables a smooth transition from
@metamask/eth-keyring-controller
to@metamask/keyring-controller
.In order to replace all interactions between the extension client and the
EthKeyringController
withKeyringController
in separate PRs we need to be able to start usingKeyringController
, while being able to keep direct interactions withEthKeyringController
possible.As the instance of
EthKeyringController
managed byKeyringController
is inaccessible, we need a temporary patch to add agetEthKeyringController
method onKeyringController
so that we can keep usingEthKeyringController
inMetamaskController
.Manual Testing Steps
Nothing should be changed in terms of functionality.
Pre-merge author checklist
Pre-merge reviewer checklist
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.