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: LIVE-8553 polkadot not enough balance error #4034

Closed

Conversation

hzheng-ledger
Copy link
Contributor

@hzheng-ledger hzheng-ledger commented Jul 17, 2023

📝 Description

-. Steps to Reproduce the bug:

An account of Polkadot with available balance between 0-1 DOT and enough bonded balance (or unbonded balance) >1 DOT

Try to send funds (e.g. 0.5 DOT) from this account.

-. Expected behavior:

We should be able to send funds from this account because it is lower than “send max” balance.

-. Actual behavior:

"Not enough balance" error.

In our old code, we had such check that raises the NotEnoughBalance error which is not correct.

if (
      !errors.amount &&
      !t.useAllAmount &&
      a.spendableBalance.lte(EXISTENTIAL_DEPOSIT.plus(EXISTENTIAL_DEPOSIT_RECOMMENDED_MARGIN))
    ) {
      errors.amount = new NotEnoughBalance();
    }

In this PR, I've removed this check and added getTransactionStatus.unit.test.ts to cover this bug.
Also, I've done some refactoring for polkadot family.

❓ Context

✅ Checklist

  • Test coverage
  • Atomic delivery
  • No breaking changes

📸 Demo

🚀 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.

@hzheng-ledger hzheng-ledger requested a review from a team as a code owner July 17, 2023 09:39
@changeset-bot
Copy link

changeset-bot bot commented Jul 17, 2023

🦋 Changeset detected

Latest commit: 2b67b06

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

This PR includes changesets to release 8 packages
Name Type
@ledgerhq/coin-polkadot Patch
@ledgerhq/live-common Patch
@ledgerhq/live-cli Patch
ledger-live-desktop Patch
live-mobile Patch
@ledgerhq/test-utils Patch
dummy-wallet-app Patch
live-common-tools 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

@vercel
Copy link

vercel bot commented Jul 17, 2023

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

Name Status Preview Comments Updated (UTC)
live-common-tools ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 18, 2023 2:36pm
native-ui-storybook ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 18, 2023 2:36pm
2 Ignored Deployments
Name Status Preview Comments Updated (UTC)
ledger-live-github-bot ⬜️ Ignored (Inspect) Visit Preview Jul 18, 2023 2:36pm
react-ui-storybook ⬜️ Ignored (Inspect) Jul 18, 2023 2:36pm

Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

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

  • Description of the PR is not enough, please describe the exact issue and how it is fixed
  • Need to compare with and understand the PR that originally introduced the current code: LIVE-1292 Cover Polkadot existential deposit edge case ledger-live-common#1953
  • Need to make sure this is covered with tests. My suggestion:
    • this can easily be covered with the bridge integration tests
    • add here a raw account that has the correct configuration to reproduce the issue
    • add transaction(s) that reproduce the issue, then make sure the issue doesn't happen anymore

@github-actions github-actions bot added the common Has changes in live-common label Jul 18, 2023
@hzheng-ledger hzheng-ledger changed the title [WIP]Fix: polkadot not enough balance error Fix: LIVE-8553 polkadot not enough balance error Jul 18, 2023
Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

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

LGTM but please run the bot a couple times to be safe. Thanks 🙏

Copy link

Choose a reason for hiding this comment

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

This unit test is literally doing the same that can be done a bit easier as a bridge integration test :)
But I guess the debate is still on, about pros and cons of both...

@github-actions
Copy link

github-actions bot commented Aug 3, 2023

There as been no activity on this PR for the last 14 days. Please consider closing this PR.

@github-actions github-actions bot added the Stale label Aug 3, 2023
@github-actions github-actions bot closed this Aug 10, 2023
@KVNLS KVNLS deleted the bugfix/LIVE-8553-polkadot-balance-error branch April 2, 2024 15:03
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 Stale
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant