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

Jade wallet implement #12041

Merged
merged 16 commits into from
Dec 12, 2023
Merged

Jade wallet implement #12041

merged 16 commits into from
Dec 12, 2023

Conversation

Whem
Copy link
Collaborator

@Whem Whem commented Dec 6, 2023

Fixes: zkSNACKs/WalletWasabi#11908

Introduction

The HWI already supports the Blockstream Jade hardware wallet, but until now, Wasabi wallet did not. Therefore, we decided to implement this in the current codebase.

Solution

We acquired a Blockstream Jade hardware wallet and initialized it with the appropriate parameters. After this, I implemented the new Enums, HardwareWalletModel and WalletType, in the code.

I started the Wasabi wallet and was able to add it as a wallet.

Subtasks

  • Writing the Jade Test
  • Writing the Jade Mock Test

@nopara73
Copy link
Contributor

nopara73 commented Dec 6, 2023

@kristapsk
Copy link
Collaborator

I have Jade somewhere at home, will try to find it and test.

@yahiheb
Copy link
Collaborator

yahiheb commented Dec 6, 2023

Don't forget the docs:

1- Is done already.
2- The following FAQ covers that already: https://docs.wasabiwallet.io/FAQ/FAQ-UseWasabi.html#what-hardware-wallets-does-wasabi-support

yahiheb
yahiheb previously approved these changes Dec 6, 2023
Copy link
Collaborator

@yahiheb yahiheb left a comment

Choose a reason for hiding this comment

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

cACK, code LGTM.
I run TrezorTKataAsync and tested using Trezor T.

You probably should add this to WalletDirTests.GetFriendlyNameTest:
Assert.Equal("Jade", HardwareWalletModels.Jade.FriendlyName());

I started the Wasabi wallet and was able to add it as a wallet.

Did you send a transaction using Jade?

I have Jade somewhere at home, will try to find it and test.

@kristapsk Can you also run this test JadeKataAsync?

@kristapsk
Copy link
Collaborator

kristapsk commented Dec 7, 2023

I have Jade somewhere at home, will try to find it and test.

@kristapsk Can you also run this test JadeKataAsync?

Yes, hope so (need to find device), ETA - before end of this week.

@nopara73
Copy link
Contributor

nopara73 commented Dec 7, 2023

fixes #11908 ?

@Whem
Copy link
Collaborator Author

Whem commented Dec 7, 2023

fixes #11908 ?

Yes, i tried to added to main net and testnet too with successfully.

yahiheb
yahiheb previously approved these changes Dec 7, 2023
Copy link
Collaborator

@yahiheb yahiheb left a comment

Choose a reason for hiding this comment

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

LGTM

@yahiheb yahiheb requested a review from kiminuo December 7, 2023 17:12
Copy link
Collaborator

@turbolay turbolay left a comment

Choose a reason for hiding this comment

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

Easy PR, if it's tested and it works then merging is pretty trivial.
It's a shame tho that the implementation is not more generic

Copy link
Collaborator

@kiminuo kiminuo left a comment

Choose a reason for hiding this comment

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

I'm not that much familiar with HWI stuff. So just a few comments.

WalletWasabi/Hwi/Parsers/HwiParser.cs Outdated Show resolved Hide resolved
WalletWasabi/Hwi/Parsers/HwiParser.cs Outdated Show resolved Hide resolved
WalletWasabi/Hwi/Parsers/HwiParser.cs Outdated Show resolved Hide resolved
WalletWasabi.Tests/UnitTests/Hwi/MockedDeviceTests.cs Outdated Show resolved Hide resolved
WalletWasabi.Tests/UnitTests/Hwi/MockedDeviceTests.cs Outdated Show resolved Hide resolved
WalletWasabi.Tests/UnitTests/Hwi/MockedDeviceTests.cs Outdated Show resolved Hide resolved
HwiEnumerateEntry entry = Assert.Single(enumerate);
Assert.NotNull(entry.Path);
Assert.Equal(HardwareWalletModels.Jade, entry.Model);
Assert.True(HwiParser.ValidatePathString(entry.Model, entry.Path));
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm a bit confused: So there is this new ValidatePathString method but it's used only for Jade but not for others. Why is it not used for other HW models if the method supports other models?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This PR focus on Jade wallet, after if this PR is merged I will start to extend with new tests the current HWI Wallet tests and then i will put there the new parse method to the right places.

Copy link
Collaborator

@molnard molnard Dec 12, 2023

Choose a reason for hiding this comment

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

Make sure to use the "new" method everywhere in the following mini PR.

SealHiboGIF

Whem and others added 5 commits December 11, 2023 10:39
Co-authored-by: Kimi <58662979+kiminuo@users.noreply.github.com>
Co-authored-by: Kimi <58662979+kiminuo@users.noreply.github.com>
Co-authored-by: Kimi <58662979+kiminuo@users.noreply.github.com>
yahiheb
yahiheb previously approved these changes Dec 11, 2023
Copy link
Collaborator

@yahiheb yahiheb left a comment

Choose a reason for hiding this comment

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

LGTM

@yahiheb yahiheb requested a review from molnard December 11, 2023 13:47
/// <param name="path">The wallet path which come from HWI enumerate command.</param>
/// <param name="model">The hardware wallet model.</param>
/// <returns><c>true</c> if the path matches the model's regex, <c>false</c> otherwise.</returns>
public static bool ValidatePathString(HardwareWalletModels model, string path)
Copy link
Collaborator

Choose a reason for hiding this comment

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

You only use this in the tests. You should move this logic out of the production code.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Alright.

WalletWasabi.Tests/AcceptanceTests/HwiKatas.cs Outdated Show resolved Hide resolved
@molnard
Copy link
Collaborator

molnard commented Dec 11, 2023

Manual testing

  • Connect and Add Wallet
  • Display address
  • Receive
  • Send

Copy link
Collaborator

@molnard molnard left a comment

Choose a reason for hiding this comment

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

PSBT workflow can be enabled in the UI however the device is not supporting is. The settings should be disabled. Can you add it in this PR if the code is simple?

@soosr
Copy link
Collaborator

soosr commented Dec 12, 2023

PSBT workflow can be enabled in the UI however the device is not supporting is. The settings should be disabled. Can you add it in this PR if the code is simple?

It wouldn't be simple as in that case for HW wallets the whole settings would be empty and the wallet settings should be also hidden.
Since as of now it is visible for several other HW wallets that do not support PSBT workflow, I would propose to merge this PR without that change.

And in a separate PR, it could be fixed for all HW wallets. Another plus point would be to fix it after the Wallet Rename feature is merged, as after that the wallet settings would never be empty even for HW wallets, so the fix would be simpler.

WDYT? @molnard

@molnard
Copy link
Collaborator

molnard commented Dec 12, 2023

Since as of now it is visible for several other HW wallets that do not support PSBT workflow, I would propose to merge this PR without that change.

I agree.

@molnard
Copy link
Collaborator

molnard commented Dec 12, 2023

And in a separate PR, it could be fixed for all HW wallets. Another plus point would be to fix it after the Wallet Rename feature is merged, as after that the wallet settings would never be empty even for HW wallets, so the fix would be simpler.

ACK.

Copy link
Collaborator

@molnard molnard left a comment

Choose a reason for hiding this comment

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

tACK. 🥇 Well done!

@molnard molnard merged commit 47ea380 into WalletWasabi:master Dec 12, 2023
6 of 7 checks passed
@MaxHillebrand
Copy link
Collaborator

MaxHillebrand commented Dec 12, 2023

woop woop on getting your first PR merged @Whem, you started with a banger! 🎉🖤

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error when trying to connect with Jade
9 participants