Skip to content

Conversation

@mchappell
Copy link
Member

@mchappell mchappell commented Dec 10, 2021

This PR shows a more helpful error message when trying to an amount of funds out of the wallet, which would not leave enough funds left to support native tokens in a wallet.

Screenshots

Screenshot 2022-01-18 at 14 32 45

Screenshot 2022-01-18 at 14 33 12


Testing Checklist

Testing Scenarios

Scenario 1: Sending max allowable ADA but not native tokens
Given that I have a wallet with ADA and native tokens
When I attempt to send max allowable ADA to be sent
Then the following message is displayed:

**Insufficient funds to support tokens. A minimum of {adaToRemain} ADA must remain in the wallet after this transaction.
トークンをサポートする資金が不足しています。このトランザクションの後に、ウォレットに{adaToRemain} ADA以上残るようにしてください。**

And Daedalus will not proceed with the transaction

Scenario 2: Sending max allowable ADA and all native tokens
Given that I have a wallet with ADA and native tokens
When I attempt to send max allowable ADA to be sent and all native tokens 
Then the transaction will go through as expected

Scenario 3: Sending (max allowable ADA - 1ADA) and all native tokens (Note: adaToRemain is currently 1ADA)
Given that I have a wallet with ADA and native tokens
When I attempt to send (max allowable ADA to be sent - 1ADA) and all native tokens 
Then the transaction will go through as expected

Scenario 4: Sending (max allowable ADA -  < 1ADA) but not native tokens (Note: adaToRemain is currently 1ADA)
Given that I have a wallet with ADA and native tokens
When I attempt to send (max allowable ADA to be sent - < 1ADA)
Then the following message is displayed:

**Insufficient funds to support tokens. A minimum of {adaToRemain} ADA must remain in the wallet after this transaction.
トークンをサポートする資金が不足しています。このトランザクションの後に、ウォレットに{adaToRemain} ADA以上残るようにしてください。**

And Daedalus will not proceed with the transaction

Scenario 5: Message displayed when API returns 'cannot_cover_fees' error (Note: This also covers scenario 3 and 4 but adding it to cover additional scenarios that we can think of during exploratory testing)
Given I have a wallet with ada and native tokens
When I try to send a large amount of ada but not tokens
When the API returns a 'cannot_cover_fees' error
Then the following message is displayed:

**Insufficient funds to support tokens. A minimum of {adaToRemain} ADA must remain in the wallet after this transaction.
トークンをサポートする資金が不足しています。このトランザクションの後に、ウォレットに{adaToRemain} ADA以上残るようにしてください。**

And Daedalus will not proceed with the transaction

Review Checklist

Basics

  • PR has been assigned and has appropriate labels (feature/bug/chore, release-x.x.x)
  • PR is updated to the most recent version of the target branch (and there are no conflicts)
  • PR has a good description that summarizes all changes
  • PR has default-sized Daedalus window screenshots or animated GIFs of important UI changes:
    • In English
    • In Japanese
  • CHANGELOG entry has been added to the top of the appropriate section (Features, Fixes, Chores) and is linked to the correct PR on GitHub
  • Automated tests: All acceptance and unit tests are passing (yarn test)
  • Manual tests (minimum tests should cover newly added feature/fix): App works correctly in development build (yarn dev)
  • Manual tests (minimum tests should cover newly added feature/fix): App works correctly in production build (yarn package / CI builds)
  • There are no flow errors or warnings (yarn flow:test)
  • There are no lint errors or warnings (yarn lint)
  • There are no prettier errors or warnings (yarn prettier:check)
  • There are no missing translations (running yarn manage:translations produces no changes)
  • Text changes are proofread and approved (Jane Wild / Amy Reeve)
  • Japanese text changes are proofread and approved (Junko Oda)
  • UI changes look good in all themes (Alexander Rukin)
  • Storybook works and no stories are broken (yarn storybook)
  • In case of dependency changes yarn.lock file is updated

Code Quality

  • Important parts of the code are properly commented and documented
  • Code is properly typed with flow
  • React components are split-up enough to avoid unnecessary re-renderings
  • Any code that only works in main process is neatly separated from components

Testing

  • New feature/change is covered by acceptance tests
  • New feature/change is manually tested and approved by QA team
  • All existing acceptance tests are still up-to-date
  • New feature/change is covered by Daedalus Testing scenario
  • All existing Daedalus Testing scenarios are still up-to-date

After Review

  • Merge the PR
  • Delete the source branch
  • Move the ticket to done column on the YouTrack board
  • Update Slack QA thread by marking it with a green checkmark

@mchappell mchappell removed the on-hold label Jan 18, 2022
@miorsufianiohk miorsufianiohk self-requested a review January 21, 2022 10:55
@mchappell mchappell requested review from a team January 21, 2022 12:29
@miorsufianiohk
Copy link

Hi @mchappell ,

On build 20533, I noticed when:

I have ada and native tokens
I only sent ada but leaving ada balance of < 1 ADA

Observation: The error message contained NaN ADA. Please see screenshot

Note: This is new which didn't exist in the last few builds during testing.

@gabriela-ponce
Copy link

@mchappell This looks good overall, but I noticed some strange scenarios:

  • I was able to leave less than 2 ADA on a wallet, and I couldn't move the tokens this wallet had with the remaining balance. Check this video, you can see first an attempt of emptying the wallet (having less than 2 ADA) and the message reads that 2 ADA are required. Then you see the last transaction (made on the same build a few minutes before) where I was able to move almost all the balance from this wallet.

  • On the same wallet (containing the same tokens and more ADA) I got the message that informs that 1 ADA is required (instead of 2). Then when I left 1.9 ADA on the wallet, I was able to move the tokens, but more than 1 ADA was required. Check this video (ignore from 1:02 to 1:44, as I couldn't proceed because of a pending transaction).

@miorsufianiohk
Copy link

Hi @mchappell ,

This is an interim report for build 20898 as test is still ongoing (as discussed) and for ease of reference for everybody

  1. When I typed wrong password, I received the error message that you created for this PR. See video
  2. Also, when I attempted to send all allowable ada with all native tokens, I still got the same error message displayed. See video

@mchappell
Copy link
Member Author

Hi @mchappell ,

This is an interim report for build 20898 as test is still ongoing (as discussed) and for ease of reference for everybody

  1. When I typed wrong password, I received the error message that you created for this PR. See video
  2. Also, when I attempted to send all allowable ada with all native tokens, I still got the same error message displayed. See video

Hey @miorsufianiohk, thanks for testing this

Can you confirm if 1. is a behaviour that exists in develop, if so it's out of scope for this PR but please discuss future improvement with the team
2. This has now been fixed and ready to re-check

Thanks for being really rigorous with this one 👍

Comment on lines 214 to 217
> => {
// @ts-ignore ts-migrate(2322) FIXME: Type 'unknown' is not assignable to type 'Download... Remove this comment to see the full error message
> => localStorage.getAll();
return localStorage.getAll();
};
Copy link
Contributor

Choose a reason for hiding this comment

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

Apologies, but is there any reason to change that? :) I assume that previous ts-ignore was working.

Copy link
Member Author

Choose a reason for hiding this comment

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

git merge didn't work out the right way and reverted to a previous configuration. That's the sad part about long lived branches with multiple migrations run

Copy link

@gabriela-ponce gabriela-ponce left a comment

Choose a reason for hiding this comment

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

This looks ok, good job 💯

Regarding the issues mentioned here, we think the API is returning a smaller value than is actually required to stay in the wallet to move the tokens. As it's out of the scope of this PR we'll check this with the Adrestia team and if required, address it on another card.

Copy link

@miorsufianiohk miorsufianiohk left a comment

Choose a reason for hiding this comment

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

Hi @mchappell,

LGTM. I could confirm that issue 1 exists on develop too of which I have created a Jira ticket for it. Issue 2 is now fixed. Great work 👍 . Tested on 20909

GetNetworkParametersApiResponse,
} from './network/types';
// Transactions Types
// @ts-ignore ts-migrate(2307) FIXME: Cannot find module './transactions/types' or its c... Remove this comment to see the full error message
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure how it happened, is it a result of running ts-migrate, but could we ideally please not introduce new ts-ignore's?

Copy link
Contributor

@danielmain danielmain left a comment

Choose a reason for hiding this comment

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

Great job @mchappell I have some questions if you still have some minutes for us :)

}

trigger(params: Params) {
trigger(params?: Params) {
Copy link
Contributor

Choose a reason for hiding this comment

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

If this is optional, why not checking it its null the next line?

@danielmain danielmain merged commit c515b62 into develop Feb 23, 2022
@danielmain danielmain deleted the feature/ddw-827-empty-wallet-with-tokens branch February 23, 2022 11:14
@danielmain danielmain removed the WIP label Feb 23, 2022
renanvalentin added a commit that referenced this pull request Feb 25, 2022
… native tokens (#2783)

Co-authored-by: Daniel Main <daniel.main.cernhoff@icloud.com>
Co-authored-by: Marcin Mazurek <marcin.mazurek@iohk.io>
Co-authored-by: Renan Ferreira <renan.ferreira@iohk.io>
Co-authored-by: Szymon Masłowski <szymon.maslowski@iohk.io>
lucas-barros pushed a commit that referenced this pull request Apr 25, 2022
… native tokens (#2783)

Co-authored-by: Daniel Main <daniel.main.cernhoff@icloud.com>
Co-authored-by: Marcin Mazurek <marcin.mazurek@iohk.io>
Co-authored-by: Renan Ferreira <renan.ferreira@iohk.io>
Co-authored-by: Szymon Masłowski <szymon.maslowski@iohk.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants