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

Support: FAT-597 quick fix for 0x5515 error #1741

Merged
merged 15 commits into from
Nov 21, 2022

Conversation

alexandremgo
Copy link
Contributor

@alexandremgo alexandremgo commented Nov 2, 2022

📝 Description

A quick fix for all the 0x5515 locked device cases.
Needed because the kind of fix made in this PR will take longer to implement everywhere, and do not work currently on LLD as is.

Edit: i actually had to modify a bit more stuff for 2 reasons:

1. Not all 0x5515 error are thrown during a device action

it turns out there are a lot of scenarios where we could have a 0x5515 error outside the usage of a device action. So the remapping inside renderError in both LLD and LLM would not catch those.

To handle those scenarios: i remapped TransportStatusError + status-code = 0x5515 into a new error LockedDeviceError.

I kept the specific rendering inside the device action renderLockedDeviceError so we have a nicer UI for the user.

But outside a device action the component TranslatedError for both LLM and LLD will display an error, but with an informative message that is associated to the error LockedDeviceError

Because of this mapping to LockedDeviceError, i had to modify a couple of other files that had conditions on StatusCodes.LOCKED_DEVICE:

  • libs/ledger-live-common/src/hw/connectApp.ts
  • libs/ledger-live-common/src/hw/connectManager.ts
  • libs/ledger-live-common/src/hw/getDeviceRunningMode.ts

2. isLocked status in LLD

Because since this PR we now handle LockedDeviceError for connectApp and connectManager, which update the status of isLocked, we need to also handle the cases were isLocked is set during a device action in LLD

❓ Context

  • Impacted projects: LLM
  • Linked resource(s): FAT-597

✅ Checklist

  • Test coverage Not yet QAed
  • Atomic delivery
  • No breaking changes

📸 Demo

📱 LLM

LLM inside a device action

Screenshot_20221102-145543_LL  DEV

LLM outside a device action

LLM_outsideDeviceAction_error

💻 LLD

LLD inside a device action Screenshot 2022-11-02 at 17 18 57
LLD outside a device action LLD_outsideDeviceAction_error

🚀 Expectations to reach

Please make sure you follow these Important Steps.

Pull Requests must pass the CI and be internally validated in order to be merged.

@vercel
Copy link

vercel bot commented Nov 2, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
live-common-tools ✅ Ready (Inspect) Visit Preview Nov 18, 2022 at 8:21AM (UTC)
3 Ignored Deployments
Name Status Preview Updated
ledger-live-github-bot ⬜️ Ignored (Inspect) Nov 18, 2022 at 8:21AM (UTC)
native-ui-storybook ⬜️ Ignored (Inspect) Nov 18, 2022 at 8:21AM (UTC)
react-ui-storybook ⬜️ Ignored (Inspect) Nov 18, 2022 at 8:21AM (UTC)

@changeset-bot
Copy link

changeset-bot bot commented Nov 2, 2022

🦋 Changeset detected

Latest commit: 30ca4d8

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 32 packages
Name Type
live-mobile Patch
@ledgerhq/live-common Patch
@ledgerhq/errors Patch
ledger-live-desktop Patch
@ledgerhq/live-cli Patch
live-common-tools Patch
@ledgerhq/devices Patch
@ledgerhq/hw-app-algorand Patch
@ledgerhq/hw-app-cosmos Patch
@ledgerhq/hw-app-eth Patch
@ledgerhq/hw-app-helium Patch
@ledgerhq/hw-app-polkadot Patch
@ledgerhq/hw-app-solana Patch
@ledgerhq/hw-app-trx Patch
@ledgerhq/hw-transport-http Patch
@ledgerhq/hw-transport-node-ble Patch
@ledgerhq/hw-transport-node-hid-noevents Patch
@ledgerhq/hw-transport-node-hid-singleton Patch
@ledgerhq/hw-transport-node-hid Patch
@ledgerhq/hw-transport-node-speculos-http Patch
@ledgerhq/hw-transport-node-speculos Patch
@ledgerhq/hw-transport-web-ble Patch
@ledgerhq/hw-transport-webhid Patch
@ledgerhq/hw-transport-webusb Patch
@ledgerhq/hw-transport Patch
@ledgerhq/react-native-hid Patch
@ledgerhq/react-native-hw-transport-ble Patch
@ledgerhq/hw-app-btc Patch
@ledgerhq/hw-app-str Patch
@ledgerhq/hw-app-tezos Patch
@ledgerhq/hw-app-xrp Patch
@ledgerhq/hw-transport-mocker Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions bot added mobile Has changes in LLM translations Translation files have been touched labels Nov 2, 2022
@codecov
Copy link

codecov bot commented Nov 2, 2022

Codecov Report

Base: 87.12% // Head: 46.97% // Decreases project coverage by -40.14% ⚠️

Coverage data is based on head (24cf60b) compared to base (6326ea5).
Patch coverage: 27.27% of modified lines in pull request are covered.

❗ Current head 24cf60b differs from pull request most recent head 30ca4d8. Consider uploading reports for the commit 30ca4d8 to get more accurate results

Additional details and impacted files
@@             Coverage Diff              @@
##           develop    #1741       +/-   ##
============================================
- Coverage    87.12%   46.97%   -40.15%     
============================================
  Files           12      690      +678     
  Lines          233    30462    +30229     
  Branches        45     8044     +7999     
============================================
+ Hits           203    14311    +14108     
- Misses          30    14920    +14890     
- Partials         0     1231     +1231     
Flag Coverage Δ
test 46.97% <27.27%> (-40.15%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
libs/ledger-live-common/src/api/socket.ts 8.00% <0.00%> (ø)
libs/ledgerjs/packages/errors/src/index.ts 75.32% <16.66%> (ø)
.../ledger-live-common/src/hw/getDeviceRunningMode.ts 94.73% <100.00%> (ø)
libs/ledgerjs/packages/cryptoassets/data/erc20.js
libs/ledgerjs/packages/cryptoassets/data/bep20.js
libs/ledgerjs/packages/cryptoassets/data/asa.js
libs/ledgerjs/packages/cryptoassets/src/fiats.ts
...dgerjs/packages/cryptoassets/data/polygon-erc20.js
...ibs/ledgerjs/packages/cryptoassets/data/stellar.js
libs/ledgerjs/packages/cryptoassets/src/tokens.ts
... and 695 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@github-actions
Copy link
Contributor

github-actions bot commented Nov 2, 2022

@alexandremgo

Screenshots: ✅

There are no changes in the screenshots for this PR. If this is expected, you are good to go.

Copy link
Contributor

@juan-cortes juan-cortes 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

@juan-cortes juan-cortes left a comment

Choose a reason for hiding this comment

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

lgtm

@alexandremgo alexandremgo force-pushed the support/FAT-597-quickfix-5515-error branch from 1aec02e to 30ca4d8 Compare November 18, 2022 08:20
@alexandremgo alexandremgo merged commit 77056e3 into develop Nov 21, 2022
@alexandremgo alexandremgo deleted the support/FAT-597-quickfix-5515-error branch November 21, 2022 07:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
common Has changes in live-common desktop Has changes in LLD ledgerjs Has changes in the ledgerjs open source libs mobile Has changes in LLM translations Translation files have been touched
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants