-
Notifications
You must be signed in to change notification settings - Fork 357
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(llm): improve typing of ReceiveFunds/02-SelectAccount and fix crash case #7148
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 5 Ignored Deployments
|
4e4e6a5
to
1749a31
Compare
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.
When I look at the Sentry error, the error happens in live-wallet/lib/accountName.js
Could make the function resilient, please?
const getDefaultAccountName = (account) => {
if (account.type === "Account") {
return (0, exports.getDefaultAccountNameForCurrencyIndex)(account);
}
return account.token.name;
};
Here we are not sure that we can access account.token.name.
Could you add the unit test to simulate the issue we had, please?
@KVNLS the error is not in live-wallet, it's a misusage of the the
if type properly respected, should not fail. Sorry, the rootcause wasn't fully clear, so I have updated the PR description with all details of why the error happened and the fact it was hidden by I didn't had enough time to make a proper end to end test on mobile and I suggest we proceed to taking this fix in the hotfix first, because properly testing the receive flow will take some time, there are many different cases I could see in the code (at least we had two cases to cover the two sides of this || , in this PR fix, I actually converged to just use the item's name) |
* chore(hotfix) 🚀 entering hotfix mode * Polkadot generic app support (#6326) * getAddress support * fix: add metadata support * fix: get polkadot app version * fix: refactoring * fix: refactoring * fix: refactoring * fix: refactoring * fix: small refactoring * fix: update doc * feat: add Polkadot coin configuration Signed-off-by: Stéphane Prohaszka <[email protected]> * polkadot config location * fix: polkadot transaction craft * remove useless code * fix: refactoring * fix: runtime upgrade transaction * fix: update doc * fix: unit tests * fix: update changelog * fix: update pnpm-lock * fix: update polkadot integration test APDU --------- Signed-off-by: Stéphane Prohaszka <[email protected]> Co-authored-by: hzheng-ledger <[email protected]> Co-authored-by: Stéphane Prohaszka <[email protected]> Co-authored-by: lvndry <[email protected]> * chore(hotfix): 🔥 hotfix prerelease [LLD(2.82.1-hotfix.0), LLM(3.45.1-hotfix.0)] * fix(llm): improve typing of ReceiveFunds/02-SelectAccount and fix crash case (#7148) * chore(hotfix): 🔥 hotfix prerelease [LLD(2.82.1-hotfix.0), LLM(3.45.1-hotfix.1)] * chore(hotfix): 🔥 hotfix release [skip ci] * fix: update pnpm-lock --------- Signed-off-by: Stéphane Prohaszka <[email protected]> Co-authored-by: live-github-bot[bot] <105061298+live-github-bot[bot]@users.noreply.github.com> Co-authored-by: Hedi EDELBLOUTE <[email protected]> Co-authored-by: hzheng-ledger <[email protected]> Co-authored-by: Stéphane Prohaszka <[email protected]> Co-authored-by: lvndry <[email protected]> Co-authored-by: @greweb <[email protected]>
* chore(hotfix) 🚀 entering hotfix mode * Polkadot generic app support (#6326) * getAddress support * fix: add metadata support * fix: get polkadot app version * fix: refactoring * fix: refactoring * fix: refactoring * fix: refactoring * fix: small refactoring * fix: update doc * feat: add Polkadot coin configuration Signed-off-by: Stéphane Prohaszka <[email protected]> * polkadot config location * fix: polkadot transaction craft * remove useless code * fix: refactoring * fix: runtime upgrade transaction * fix: update doc * fix: unit tests * fix: update changelog * fix: update pnpm-lock * fix: update polkadot integration test APDU --------- Signed-off-by: Stéphane Prohaszka <[email protected]> Co-authored-by: hzheng-ledger <[email protected]> Co-authored-by: Stéphane Prohaszka <[email protected]> Co-authored-by: lvndry <[email protected]> * chore(hotfix): 🔥 hotfix prerelease [LLD(2.82.1-hotfix.0), LLM(3.45.1-hotfix.0)] * fix(llm): improve typing of ReceiveFunds/02-SelectAccount and fix crash case (#7148) * chore(hotfix): 🔥 hotfix prerelease [LLD(2.82.1-hotfix.0), LLM(3.45.1-hotfix.1)] * chore(hotfix): 🔥 hotfix release [skip ci] * chore: add changeset * fix: move polkdot getcrypto call outside of currency config fn --------- Signed-off-by: Stéphane Prohaszka <[email protected]> Co-authored-by: live-github-bot[bot] <105061298+live-github-bot[bot]@users.noreply.github.com> Co-authored-by: Hedi EDELBLOUTE <[email protected]> Co-authored-by: hzheng-ledger <[email protected]> Co-authored-by: Stéphane Prohaszka <[email protected]> Co-authored-by: lvndry <[email protected]> Co-authored-by: @greweb <[email protected]>
* chore(hotfix) 🚀 entering hotfix mode * Polkadot generic app support (#6326) * getAddress support * fix: add metadata support * fix: get polkadot app version * fix: refactoring * fix: refactoring * fix: refactoring * fix: refactoring * fix: small refactoring * fix: update doc * feat: add Polkadot coin configuration Signed-off-by: Stéphane Prohaszka <[email protected]> * polkadot config location * fix: polkadot transaction craft * remove useless code * fix: refactoring * fix: runtime upgrade transaction * fix: update doc * fix: unit tests * fix: update changelog * fix: update pnpm-lock * fix: update polkadot integration test APDU --------- Signed-off-by: Stéphane Prohaszka <[email protected]> Co-authored-by: hzheng-ledger <[email protected]> Co-authored-by: Stéphane Prohaszka <[email protected]> Co-authored-by: lvndry <[email protected]> * chore(hotfix): 🔥 hotfix prerelease [LLD(2.82.1-hotfix.0), LLM(3.45.1-hotfix.0)] * fix(llm): improve typing of ReceiveFunds/02-SelectAccount and fix crash case (#7148) * chore(hotfix): 🔥 hotfix prerelease [LLD(2.82.1-hotfix.0), LLM(3.45.1-hotfix.1)] * chore(hotfix): 🔥 hotfix release [skip ci] * chore: add changeset * fix: move polkdot getcrypto call outside of currency config fn --------- Signed-off-by: Stéphane Prohaszka <[email protected]> Co-authored-by: live-github-bot[bot] <105061298+live-github-bot[bot]@users.noreply.github.com> Co-authored-by: Hedi EDELBLOUTE <[email protected]> Co-authored-by: hzheng-ledger <[email protected]> Co-authored-by: Stéphane Prohaszka <[email protected]> Co-authored-by: lvndry <[email protected]> Co-authored-by: @greweb <[email protected]>
✅ Checklist
npx changeset
was attached.📝 Description
Root cause: the rework of #6534
as seen here, we did a mistake on LLM ReceiveFunds/02-SelectAccount file where we passed a
Currency
instead of anAccount
on the getDefaultAccountName function.unfortunately the bad typing was hiding the issue: bad casting using
item.parentAccount as Account
which hides the problem. because actually .parentAccount is aAccount | undefined
. since we didn't have the | undefined part, TypeScript will infer the code as aAccount
and not as anAccount | Currency
that is actually the type of the previously bad code here.the fix:
❓ Context
🧐 Checklist for the PR Reviewers