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

Update @metamask/eth-ledger-bridge-keyring #21149

Merged
merged 13 commits into from
Nov 22, 2023
Merged

Conversation

mikesposito
Copy link
Member

@mikesposito mikesposito commented Oct 2, 2023

Description

This PR updates the @metamask/eth-ledger-bridge-keyring version to latest (^1.0.0).
This brings a major breaking change: the transport logic (the way Metamask connects to the device) has been split from the keyring logic (the interface supported by our KeyringController).

Due to this, @metamask/eth-ledger-bridge-keyring needs a transport bridge to be passed on construction and successively initialized calling Keyring.init().

As this is a new behavior compared to the usual way we build keyrings, we have to use a different keyring builder factory, specific for this kind of "bridged keyring". That is, a keyring that needs a bridge class instance as a constructor option.

The bridge initialization is, instead, done outside the keyring builder (as it is async).

Note
Test coverage for hardware wallets is insufficient: I did some manual smoke tests with my Ledger Nano X (account unlock, send eth transaction sign), but this likely needs additional QA

Related issues

Manual testing steps

  • Connect a new Ledger hardware wallet
  • Signing transaction should work as before

Screenshots/Recordings

Before

n/a

After

n/a

Pre-merge author checklist

  • I’ve followed MetaMask Coding Standards.
  • I've clearly explained:
    • What problem this PR is solving.
    • How this problem was solved.
    • How reviewers can test my changes.
  • I’ve indicated what issue this PR is linked to: Fixes #???
  • I’ve included tests if applicable.
  • I’ve documented any added code.
  • I’ve applied the right labels on the PR (see labeling guidelines).
  • I’ve properly set the pull request status:
    • In case it's not yet "ready for review", I've set it to "draft".
    • In case it's "ready for review", I've changed it from "draft" to "non-draft".

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.

@github-actions
Copy link
Contributor

github-actions bot commented Oct 2, 2023

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.

@mikesposito mikesposito changed the base branch from develop to chore/update-trezor October 2, 2023 13:38
@mikesposito
Copy link
Member Author

Waiting for #21145

@socket-security
Copy link

socket-security bot commented Oct 2, 2023

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

Packages Version New capabilities Transitives Size Publisher
@metamask/eth-ledger-bridge-keyring 0.15.0...2.0.0 None +0/-1 107 kB metamaskbot

@socket-security
Copy link

socket-security bot commented Oct 2, 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.

@mikesposito mikesposito added needs-qa Label will automate into QA workspace team-wallet-framework labels Oct 2, 2023
@mikesposito mikesposito force-pushed the chore/update-ledger branch 2 times, most recently from 58035d2 to afb031b Compare October 2, 2023 14:48
@metamaskbot
Copy link
Collaborator

Builds ready [afb031b]
Page Load Metrics (957 ± 405 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint90155112168
domContentLoaded76151104199
load872045957844405
domInteractive76151104199
Bundle size diffs [🚀 Bundle size reduced!]
  • background: -21.68 KiB (-0.59%)
  • ui: 0 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

@codecov
Copy link

codecov bot commented Oct 2, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (32b249a) 68.59% compared to head (afb031b) 68.48%.

❗ Current head afb031b differs from pull request most recent head beab905. Consider uploading reports for the commit beab905 to get more accurate results

Additional details and impacted files
@@             Coverage Diff             @@
##           develop   #21149      +/-   ##
===========================================
- Coverage    68.59%   68.48%   -0.11%     
===========================================
  Files         1046     1013      -33     
  Lines        41612    40582    -1030     
  Branches     11110    10846     -264     
===========================================
- Hits         28542    27790     -752     
+ Misses       13070    12792     -278     
Files Coverage Δ
...pp/scripts/lib/hardware-keyring-builder-factory.ts 100.00% <100.00%> (ø)
app/scripts/metamask-controller.js 53.43% <100.00%> (-1.68%) ⬇️

... and 229 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@brad-decker
Copy link
Contributor

I'll also need this one soon. So let me know when i cna review : )

@legobeat
Copy link
Contributor

legobeat commented Oct 31, 2023

Waiting for #21145

Also MetaMask/eth-ledger-bridge-keyring#202 or preferred doing the updates separate?

@mikesposito mikesposito force-pushed the chore/update-trezor branch 2 times, most recently from a5a1c22 to 37b7f33 Compare November 2, 2023 11:10
Base automatically changed from chore/update-trezor to develop November 7, 2023 15:55
brad-decker added a commit that referenced this pull request Nov 7, 2023
## **Description**
This PR updates the `@metamask/eth-trezor-keyring` version to latest
(`^2.0.0`).
This brings a major breaking change: the transport logic (the way
Metamask connects to the device) has been split from the keyring logic
(the interface supported by our KeyringController).

Due to this, `@metamask/eth-trezor-keyring` ([and soon
`@metamask/eth-ledger-bridge-keyring`](#21149))
needs a transport bridge to be passed on construction and successively
initialized calling `Keyring.init()`.

As this is a new behavior compared to the usual way we build keyrings,
we have to use a different keyring builder factory, specific for this
kind of "bridged keyring". That is, a keyring that needs a bridge class
instance as a constructor option.

The bridge initialization is, instead, done outside the keyring builder
(as it is async) by `@metamask/eth-keyring-controller` after the keyring
construction

**Note**
Test coverage for hardware wallets is insufficient: I did some manual
smoke tests with my Trezor Model One (account unlock, send eth
transaction sign), but this likely needs additional QA

## **Manual testing steps**

- Connect a new Trezor hardware wallet 
- Signing transaction should work as before

## **Related issues**

* Fixes #21143 

## **Pre-merge author checklist**

- [x] I’ve followed [MetaMask Coding
Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/CODING_GUIDELINES.md).
- [x] I've clearly explained:
  - [x] What problem this PR is solving.
  - [x] How this problem was solved.
  - [x] How reviewers can test my changes.
- [x] I’ve indicated what issue this PR is linked to: Fixes #???
- [x] I’ve included tests if applicable.
- [x] I’ve documented any added code.
- [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)).
- [x] I’ve properly set the pull request status:
  - [x] In case it's not yet "ready for review", I've set it to "draft".
- [x] In case it's "ready for review", I've changed it from "draft" to
"non-draft".

## **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.

---------

Co-authored-by: MetaMask Bot <[email protected]>
Co-authored-by: Brad Decker <[email protected]>
@metamaskbot metamaskbot added the INVALID-PR-TEMPLATE PR's body doesn't match template label Nov 7, 2023
@brad-decker
Copy link
Contributor

@mikesposito could we update this to upgrade to 2.0.0 that was released recently?

@mikesposito mikesposito marked this pull request as ready for review November 8, 2023 09:51
@mikesposito mikesposito requested review from a team as code owners November 8, 2023 09:51
@mikesposito
Copy link
Member Author

@metamaskbot update-policies

@metamaskbot
Copy link
Collaborator

Policy update failed. You can review the logs or retry the policy update here

brad-decker
brad-decker previously approved these changes Nov 8, 2023
@legobeat
Copy link
Contributor

Sounds like we need to ensure that @metamask/eth-sig-util is bumped to 7.0.1 in yarn.lock, yes?

That would be it yeah, now that it is released.

@legobeat
Copy link
Contributor

legobeat commented Nov 22, 2023

@mikesposito This should be good to go after a rebase on develop and regeneration of LavaMoat policies now that #21928 is merged.

@mikesposito
Copy link
Member Author

@metamaskbot update-policies

@metamaskbot
Copy link
Collaborator

Policies updated

@metamaskbot
Copy link
Collaborator

Builds ready [c671ed8]
Page Load Metrics (298 ± 205 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint821149184
domContentLoaded659876105
load771261298428205
domInteractive659876105
Bundle size diffs [🚀 Bundle size reduced!]
  • background: -35.05 KiB (-0.91%)
  • ui: 0 Bytes (0.00%)
  • common: 132 Bytes (0.00%)

@metamaskbot metamaskbot removed the INVALID-PR-TEMPLATE PR's body doesn't match template label Nov 22, 2023
@mikesposito mikesposito removed the needs-qa Label will automate into QA workspace label Nov 22, 2023
@mikesposito mikesposito merged commit 3713c18 into develop Nov 22, 2023
68 of 70 checks passed
@mikesposito mikesposito deleted the chore/update-ledger branch November 22, 2023 17:25
@github-actions github-actions bot locked and limited conversation to collaborators Nov 22, 2023
@metamaskbot metamaskbot added the release-11.7.0 Issue or pull request that will be included in release 11.7.0 label Nov 22, 2023
@Gudahtt Gudahtt restored the chore/update-ledger branch November 24, 2023 21:41
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
release-11.7.0 Issue or pull request that will be included in release 11.7.0 team-wallet-framework
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update @metamask/eth-ledger-bridge-keyring
7 participants