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

[DDW-584] Apply withdrawals to Hardware Wallets #2408

Merged
merged 5 commits into from
Feb 27, 2021

Conversation

tomislavhoracek
Copy link
Contributor

@tomislavhoracek tomislavhoracek commented Feb 25, 2021

This PR introduces extended transaction signing / sending data with withdrawals with Hardware Wallets. Now we can use rewards along with Hardware wallets!


NOTE: DO NOT MERGE

  • WBE bumped to the latest master where coin selection with withdrawals is included. We need to check this before merging @nikolaglumac (REV: b6810e8401b04b1d8a1a142f0b06b47cd6b51186)

Testing Checklist

  • Slack QA thread
  • Try to send a transaction with an amount that contains available wallet balance + rewards. Test with Ledger and Trezor
  • Once you sent Transaction using withdrawals (rewards) try to create also a regular transaction without rewards just to ensure that TX Send is working for all cases

Withdrawals Example:

  • You have a wallet "Wallet Test"
  • Wallet balance is 50 ADA (shown in sidebar)
  • You earned 2 ADA as rewards
  • This means that you have walletBalance = 50, availableWalletBalance = 48, rewards = 2
  • Try to send 49 ADA - this means that you want to send your full wallet available balance without rewards + rewards to cover the transaction amount.
  • Once you start a process, first indicator is to see withdrawals on your HW device. After that, once tx sent, you can see rewards sent in transaction details e.g. summary screen.
  • e.g. if you have 3 ADA from rewards and e.g. you needed just 1 ADA to cover all tx requirements, the rest rewards are returned as a changed output to the wallet and are included in the wallet available balance which ( you will not have withdrawals anymore).

Test Cases

Scenario 1: Transaction on no reward wallet
Given I have a wallet with enough ADA for transaction fee
And the wallet doesn't have any reward
When I send some ADA
Then it will be successful

Scenario 2: Delegate on no reward wallet
Given I have a wallet with enough ADA for delegation
And the wallet doesn't have any reward
When I delegate the wallet
Then it will be successful

Note: I put numbers to make it easier to visualise
Scenario 3: Available balance, reward presence (Send less than available balance)
Given I have a wallet with enough ADA for transaction fee
And the wallet has available balance 10 ADA and reward 5 ADA
When I send 8 ADA
Then the transaction will be successful
And the available balance will be 7 ADA-transaction fees

Note: I put numbers to make it easier to visualise
Scenario 4: Available balance, reward presence (Send greater than available balance)
Given I have a wallet with enough ADA for transaction fee
And the wallet has available balance 10 ADA and reward 5 ADA
When I send 12 ADA
Then the transaction will be successful
And the available balance will be 3 ADA-transaction fees

Note: I put numbers to make it easier to visualise
Scenario 5: Delegate to a pool: Available balance, reward presence (Available balance less than 10 ADA)
Given I have a wallet with enough ADA for transaction fee
And the wallet has available balance 8 ADA and reward 5 ADA
When I attempt to delegate to a pool
Then I won't be able to

Note: I put numbers to make it easier to visualise
Scenario 6: Delegate to a pool: Available balance, reward presence (Available balance >=  10 ADA)
Given I have a wallet with enough ADA for transaction fee
And the wallet has available balance 10 ADA and reward 5 ADA
When I delegate to a pool
Then it will be successful
And the reward remains at 5 ADA

Scenario 7: Available balance 1 ADA, reward presence 3 ADA
Given I have a wallet with available balance 1 ADA and reward 3 ADA
When I send 1 ADA
Then the transaction will be successful
And the available balance will be 3 ADA-transaction fees


Still under construction

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

CHANGELOG.md Outdated Show resolved Hide resolved
Copy link
Contributor

@topseniors topseniors left a comment

Choose a reason for hiding this comment

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

@tomislavhoracek Great work. 🥇
Left minor comments. Would you please take a look at them?

source/renderer/app/api/api.js Show resolved Hide resolved
source/renderer/app/api/api.js Show resolved Hide resolved
source/renderer/app/api/api.js Show resolved Hide resolved
Copy link

@ManusMcCole ManusMcCole left a comment

Choose a reason for hiding this comment

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

@wadie914
Copy link

wadie914 commented Feb 26, 2021 via email

@nikolaglumac nikolaglumac merged commit 4f98910 into develop Feb 27, 2021
@iohk-bors iohk-bors bot deleted the chore/ddw-584-apply-withdrawals-to-hw branch February 27, 2021 13:45
@nikolaglumac nikolaglumac added release-4.0.0-RC1 Daedalus Testnet release-4.0.0-FC1 Daedalus Flight release-4.0.0 Daedalus Mainnet and removed ⏳release-vNext labels Feb 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore release-4.0.0-FC1 Daedalus Flight release-4.0.0-RC1 Daedalus Testnet release-4.0.0 Daedalus Mainnet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants