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-970] Prevent creation of new wallet during address verification #2906

Merged
merged 24 commits into from May 20, 2022

Conversation

szymonmaslowski
Copy link
Contributor

@szymonmaslowski szymonmaslowski commented Mar 3, 2022

This PR

  • prevents creating a new wallet when paired incorrect one during address verification
  • refactors part of HW logic

Unfortunately, this PR requires full regression testing of hardware wallet cases

Diagram representing part of the logic covered by the refactoring:
image

Todos

  • Wait for PR 2860 to be merged and use HWDeviceStatus introduced there instead of creating new one here.

Screenshots

image

image

Testing Checklist


Review Checklist

Basics

  • PR assigned to the PR author(s)
  • input-output-hk/daedalus-dev and input-output-hk/daedalus-qa assigned as PR reviewers
  • If there are UI changes, Alexander Rukin assigned as an additional reviewer
  • All visual regression testing has been reviewed (assign run Chromatic label to PR to trigger the run)
  • PR has appropriate labels (release-vNext, feature/bug/chore, WIP)
  • PR link is added to a Jira ticket, ticket moved to In Review
  • 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 contains screenshots (in case of UI changes)
  • CHANGELOG entry has been added to the top of the appropriate section (Features, Fixes, Chores) and is linked to the correct PR on GitHub
  • 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)
  • 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 typescript types
  • 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

  • Update Slack QA thread by marking it with a green checkmark

@alexander-rukin
Copy link
Contributor

alexander-rukin commented Mar 9, 2022

in the bottom there is too much space (because there is no buttons, but paddings are there 😓)

image

20px here

image

and 12px here

p.s. at least after I removed this in inspector it looked better

Copy link
Contributor

@tomislavhoracek tomislavhoracek left a comment

Choose a reason for hiding this comment

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

@szymonmaslowski 💯 Nice improvements and code / flow is much more cleaner now.
Please check my comments...

source/renderer/app/stores/HardwareWalletsStore.ts Outdated Show resolved Hide resolved
source/renderer/app/stores/HardwareWalletsStore.ts Outdated Show resolved Hide resolved
source/renderer/app/stores/HardwareWalletsStore.ts Outdated Show resolved Hide resolved
source/renderer/app/stores/HardwareWalletsStore.ts Outdated Show resolved Hide resolved
Comment on lines 1252 to 1263
const recognizedSoftwareWallet = await this._recognizeSoftwareWalletByExtendedPublicKey(
{ extendedPublicKey }
);

if (recognizedSoftwareWallet) {
await this._handleIdentifiedSoftwareWallet({
recognizedSoftwareWallet,
extendedPublicKey,
forcedPath: devicePath,
walletId,
address,
});
Copy link
Contributor

Choose a reason for hiding this comment

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

@szymonmaslowski following to the above comment. Now you have 2 functions that are connected to identifying / recognizing. It is better to say "ok, now get me an extended public key and then recognize"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry I didn't get your comment. By two functions do you mean the _handleIdentifiedSoftwareWallet and _identifyAndHandleSoftwareWallet? The _handleIdentifiedSoftwareWallet method is responsible only for the case when the wallet was found. On the other hand the _identifyAndHandleSoftwareWallet method encapsulates all steps including the extended public key request, finding the device and handling it accordingly, and it is there for a reduction of code duplication, but I believe with further refactoring it may be broken to few less generic code blocks and distributed to the proper places in the logic (for example part regarding the transaction to the transaction logic etc.).

};

@action
_proceedWithTransactionAfterConnectingDevice = ({
Copy link
Contributor

Choose a reason for hiding this comment

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

@szymonmaslowski maybe we should call this _reinitiate... or _recover...? What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I would say this is rather a continuation of the transaction process as there is the _signTransactionTrezor method called at the end of this method. Am I right?

source/renderer/app/stores/HardwareWalletsStore.ts Outdated Show resolved Hide resolved
@szymonmaslowski
Copy link
Contributor Author

@alexander-rukin Could you check again? Styling issues shouldn't be there anymore. I fixed it in a little different way than your suggestion, but I think I achieved the same result.

@alexander-rukin
Copy link
Contributor

@szymonmaslowski pls make sure that your fix didn't affect scrollbar position

image

as now it ends too early (not with the end of content)

@gabriela-ponce
Copy link

@szymonmaslowski I found a specific scenario where the message is different from the one on the screenshots:

  • Pair the Trezor and do not unplug it. Then, try to validate the address and insert an incorrect recovery phrase. You'll see no new device is paired, but the error will be "Address verification failed" instead of "We do not recognize this wallet...". Check this video
    Could this be improved and show the second message instead?

@miorsufianiohk miorsufianiohk self-requested a review April 28, 2022 08:48
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.

Good job, lgtm!
Notes:

  • The issue on my previous comment is going to be addressed on this card: DDW-1090.
  • Please do not merge until we have at least one additional approval from the rest of @input-output-hk/daedalus-qa

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.

LGTM. Great job @szymonmaslowski 👍 . Tested on 21656

@dmitrii-gaico
Copy link

@danielmain Additional QA review is required after resolving the conflicts. So please do not merge before further notice.

@ManusMcCole ManusMcCole self-requested a review May 19, 2022 09:42
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.

Looks good @szymonmaslowski 👍

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.

LGTM. Tested on 21788. Great work @szymonmaslowski 👍

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.

Amazing job @szymonmaslowski

@danielmain danielmain merged commit 5dfe3f6 into develop May 20, 2022
@iohk-bors iohk-bors bot deleted the feature/ddw-970 branch May 20, 2022 08:21
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.

None yet