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

Use importAccountWithStrategy from core KeyringController #19815

Merged
merged 4 commits into from
Aug 17, 2023

Conversation

mikesposito
Copy link
Member

@mikesposito mikesposito commented Jun 29, 2023

Explanation

With this PR we start using the importAccountWithStrategy method from core KeyringController instead of calling EthKeyringController directly.

As strategies keys are different on KeyringController, they have been changed on the extension code and tests, to match the new ones.

Screenshots/Screencaps

Before

After

Manual Testing Steps

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.

@socket-security
Copy link

socket-security bot commented Jun 29, 2023

Removed dependencies detected. Learn more about Socket for GitHub ↗︎

🚮 Removed packages: [email protected]

@metamaskbot
Copy link
Collaborator

Builds ready [66e876e]
Page Load Metrics (1752 ± 68 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint101157124168
domContentLoaded14861997171414168
load15201998175214268
domInteractive14861997171414168
Bundle size diffs [🚀 Bundle size reduced!]
  • background: 108549 bytes
  • ui: 115007 bytes
  • common: -114929 bytes

@codecov
Copy link

codecov bot commented Jun 29, 2023

Codecov Report

Merging #19815 (b5730db) into develop (9e302ea) will decrease coverage by 0.03%.
The diff coverage is 14.29%.

@@             Coverage Diff             @@
##           develop   #19815      +/-   ##
===========================================
- Coverage    68.66%   68.63%   -0.03%     
===========================================
  Files          990      989       -1     
  Lines        38274    38227      -47     
  Branches     10260    10256       -4     
===========================================
- Hits         26279    26235      -44     
+ Misses       11995    11992       -3     
Files Changed Coverage Δ
app/scripts/metamask-controller.js 64.39% <0.00%> (-0.16%) ⬇️
...onents/multichain/import-account/import-account.js 21.74% <0.00%> (ø)
...omponents/multichain/import-account/private-key.js 46.15% <0.00%> (ø)
ui/components/multichain/import-account/json.js 75.00% <100.00%> (ø)

@mikesposito mikesposito force-pushed the refactor/use-core-keyring-controller branch 5 times, most recently from c65c6b9 to 2d584d7 Compare July 19, 2023 09:37
@mikesposito
Copy link
Member Author

Depends on #19659

@mikesposito mikesposito force-pushed the refactor/use-core-keyring-controller branch 2 times, most recently from 95313e3 to 1567ae0 Compare July 24, 2023 10:32
Base automatically changed from refactor/use-core-keyring-controller to develop July 24, 2023 18:44
@mikesposito mikesposito force-pushed the refactor/use-importaccount-from-kc branch from 66e876e to 63f2266 Compare July 25, 2023 08:31
@mikesposito
Copy link
Member Author

@metamaskbot update-policies

@mikesposito mikesposito force-pushed the refactor/use-importaccount-from-kc branch from 63f2266 to 7c6a29c Compare July 25, 2023 08:51
@mikesposito mikesposito marked this pull request as ready for review July 25, 2023 08:53
@mikesposito mikesposito requested review from a team as code owners July 25, 2023 08:53
@metamaskbot
Copy link
Collaborator

Policies updated

@metamaskbot
Copy link
Collaborator

Builds ready [b593868]
Page Load Metrics (1560 ± 53 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint1021911402512
domContentLoaded13561838156011053
load13561838156011053
domInteractive13561838156011053
Bundle size diffs [🚀 Bundle size reduced!]
  • background: -44.74 KiB (-1.04%)
  • ui: 118.52 KiB (1.56%)
  • common: -118.43 KiB (-2.99%)

mcmire
mcmire previously approved these changes Jul 31, 2023
Copy link
Contributor

@mcmire mcmire left a comment

Choose a reason for hiding this comment

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

Looks good!

@mikesposito mikesposito force-pushed the refactor/use-importaccount-from-kc branch from b593868 to ba0ecc6 Compare August 1, 2023 11:05
@mikesposito
Copy link
Member Author

@metamaskbot update-policies

@mikesposito mikesposito requested a review from mcmire August 1, 2023 11:06
@metamaskbot
Copy link
Collaborator

Policies updated

mcmire
mcmire previously approved these changes Aug 1, 2023
@mikesposito mikesposito force-pushed the refactor/use-importaccount-from-kc branch from 79d7255 to af5ae69 Compare August 2, 2023 12:01
@mikesposito
Copy link
Member Author

Rebased and resolved yarn.lock conflicts

@mikesposito mikesposito requested a review from mcmire August 2, 2023 12:01
@metamaskbot
Copy link
Collaborator

Builds ready [af5ae69]
Page Load Metrics (2687 ± 163 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint2034053136230
domContentLoaded200832872684339163
load200832882687338163
domInteractive200832872684339163
Bundle size diffs [🚀 Bundle size reduced!]
  • background: -44.62 KiB (-1.15%)
  • ui: 118.52 KiB (1.54%)
  • common: -118.44 KiB (-3.18%)

@metamaskbot
Copy link
Collaborator

Builds ready [ec16bf0]
Page Load Metrics (1601 ± 42 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint1172091402110
domContentLoaded1470182016018742
load1470182016018742
domInteractive1470182016018742
Bundle size diffs [🚀 Bundle size reduced!]
  • background: -44.62 KiB (-1.14%)
  • ui: 118.52 KiB (1.54%)
  • common: -118.44 KiB (-3.18%)

cryptodev-2s
cryptodev-2s previously approved these changes Aug 14, 2023
Copy link
Contributor

@cryptodev-2s cryptodev-2s left a comment

Choose a reason for hiding this comment

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

LGTM!

@mcmire
Copy link
Contributor

mcmire commented Aug 14, 2023

@mikesposito Looks like there are conflicts again :(

@mikesposito
Copy link
Member Author

@metamaskbot update-policies

@metamaskbot
Copy link
Collaborator

Policies updated

@metamaskbot
Copy link
Collaborator

Builds ready [72e8f62]
Page Load Metrics (1572 ± 42 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint109156133147
domContentLoaded1415181315728842
load1415181315728842
domInteractive1415181315728842
Bundle size diffs [🚀 Bundle size reduced!]
  • background: -44.63 KiB (-1.14%)
  • ui: 118.52 KiB (1.54%)
  • common: -118.44 KiB (-3.18%)

@mikesposito mikesposito force-pushed the refactor/use-importaccount-from-kc branch from 72e8f62 to b5730db Compare August 16, 2023 12:16
@metamaskbot
Copy link
Collaborator

Builds ready [b5730db]
Page Load Metrics (1485 ± 42 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint1071991262110
domContentLoaded1350166014858842
load1350166014858742
domInteractive1350166014858842
Bundle size diffs [🚀 Bundle size reduced!]
  • background: -44.63 KiB (-1.14%)
  • ui: 118.52 KiB (1.54%)
  • common: -118.44 KiB (-3.18%)

Copy link
Contributor

@cryptodev-2s cryptodev-2s left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Contributor

@mcmire mcmire left a comment

Choose a reason for hiding this comment

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

One nit, but looks good regardless.

@@ -172,14 +172,14 @@ describe('MetaMaskController', function () {

await metamaskController.createNewVaultAndKeychain('test@123');
await Promise.all([
metamaskController.importAccountWithStrategy('Private Key', [
metamaskController.importAccountWithStrategy('privateKey', [
Copy link
Contributor

@mcmire mcmire Aug 16, 2023

Choose a reason for hiding this comment

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

Nit: It might be nice if we can import an enum and use that here (and other places) so we can see the significance of this value. Not a big deal if that's not doable though.

@mikesposito mikesposito merged commit 3aa5b7d into develop Aug 17, 2023
@mikesposito mikesposito deleted the refactor/use-importaccount-from-kc branch August 17, 2023 07:11
@github-actions github-actions bot locked and limited conversation to collaborators Aug 17, 2023
@metamaskbot metamaskbot added the release-10.36.0 Issue or pull request that will be included in release 10.36.0 label Aug 17, 2023
@Gudahtt Gudahtt added release-11.1.0 Issue or pull request that will be included in release 11.1.0 and removed release-10.36.0 Issue or pull request that will be included in release 10.36.0 labels Sep 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
release-11.1.0 Issue or pull request that will be included in release 11.1.0 team-wallet-framework
Projects
None yet
5 participants