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

fix: temporary workaround for thorchain and cosmos ledger app check missing in hdwallet #6850

Closed
wants to merge 3 commits into from

Conversation

woodenfurniture
Copy link
Contributor

@woodenfurniture woodenfurniture commented May 8, 2024

Description

When attempting to manage accounts for thorchain or cosmos, the app crashes due to missing support for validateCurrentApp on these chains. When calling validateCurrentApp, the promise is rejected with Unable to find associated app name for coin: ${coin} because support for these chains is actually missing from hdwallet.

This issue never presented in web previously because we never attempt to validate the correct app being open on ledger, and instead swallow errors (hence the requirement for the new throwOnReject flag added in this PR.

The workaround here is to bypass this check and allow the user to attempt to proceed, then display an error toast if account fetching fails.

We'll have to follow up with a fix in hdwallet and remove this temporary patch.

Pull Request Type

  • 🐛 Bug fix (Non-breaking Change: Fixes an issue)
  • 🛠️ Chore (Non-breaking Change: Doc updates, pkg upgrades, typos, etc..)
  • 💅 New Feature (Breaking/Non-breaking Change)

Issue (if applicable)

progresses #6806 - will not be closed until hdwallet is updated to support these chains and the patch removed from web.

Risk

High Risk PRs Require 2 approvals

Low risk

What protocols, transaction types or contract interactions might be affected by this PR?

Testing

Attempt to manage thorchain or cosmos accounts without the corresponding ledger app being open on the device. A toast should appear with an appropriate error message.

Managing an account with the corresponding ledger app open should not show error toast, but should behave normally.

Engineering

Operations

Screenshots (if applicable)

Screen.Recording.2024-05-08.at.1.55.23.PM.mov

@woodenfurniture woodenfurniture requested a review from a team as a code owner May 8, 2024 03:41
}),
),
)

const fulfilledAccountIdsAndMetadata = settledAccountIdsAndMetadata.reduce<AccountMetadataById[]>(
(acc, result) => {
if (isRejected(result)) {
console.error(result.reason)
if (throwOnReject) {
Copy link
Contributor

Choose a reason for hiding this comment

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

🧠

},
"errors": {
"accountMetadataFailedToFetch": {
"title": "Account Metadata Fetch Failed",
Copy link
Contributor

Choose a reason for hiding this comment

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

This seems like quite a low-level messaging, but given the root cause is eventually going to get fixed, fine with that!

Copy link
Contributor

@gomesalexandre gomesalexandre left a comment

Choose a reason for hiding this comment

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

Tested locally, confirmed this is happy, though with an issue related to one of the two hard things in software engineering.

Not sure if we want to get this in in this state though however - if this is eventually going to get fixed upstream, it may not worth the effort to fix the caching bug and rather fix the root cause in hdwallet instead?

  • Confirmed it's impossible to currently continue with the wrong app on Ledger ✅
image

There's a double toast, although this is eventually going to be removed

  • The toast(s) only appear once 🚫
Screen.Recording.2024-05-08.at.14.02.48.mov
  • Connecting the correct app is still happy ❓

Though on a second try, similarly to the toasts that never appear again, caching means auto-fetching is borked. If hard refreshing the app and trying with the correct app on the first try, this is happy.

Screen.Recording.2024-05-08.at.14.04.03.mov

@woodenfurniture
Copy link
Contributor Author

woodenfurniture commented May 8, 2024

Tested locally, confirmed this is happy, though with an issue related to one of the two hard things in software engineering.

Not sure if we want to get this in in this state though however - if this is eventually going to get fixed upstream, it may not worth the effort to fix the caching bug and rather fix the root cause in hdwallet instead?

  • Confirmed it's impossible to currently continue with the wrong app on Ledger ✅
image There's a double toast, although this is eventually going to be removed
  • The toast(s) only appear once 🚫

Screen.Recording.2024-05-08.at.14.02.48.mov

  • Connecting the correct app is still happy ❓

Though on a second try, similarly to the toasts that never appear again, caching means auto-fetching is borked. If hard refreshing the app and trying with the correct app on the first try, this is happy.

Screen.Recording.2024-05-08.at.14.04.03.mov

Ok, thanks for the testing ser! New changes pushed:

  • Clear account paging when opening account import for ledger wallets. This fixes the case where it's possible to view accounts from a previous load without the correct ledger app open on the device.
  • The above also fixes the error toast only appearing once.
  • Fixed double toast on error.
  • Moved toast to top-right for consistency with other toasts in account management.

@woodenfurniture woodenfurniture marked this pull request as draft May 9, 2024 07:00
@woodenfurniture
Copy link
Contributor Author

Root cause fixed in hdwallet, can remove the workaround but need to keep paging reset.

@gomesalexandre
Copy link
Contributor

Superseeded by #6866 with pagination hunks applied there

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants