Skip to content

Installer: let user choose derivation path#1705

Merged
edouardparis merged 2 commits intowizardsardine:masterfrom
pythcoiner:custom_deriv_path
May 21, 2025
Merged

Installer: let user choose derivation path#1705
edouardparis merged 2 commits intowizardsardine:masterfrom
pythcoiner:custom_deriv_path

Conversation

@pythcoiner
Copy link
Copy Markdown
Collaborator

@pythcoiner pythcoiner commented May 15, 2025

This PR closes #1700.

@pythcoiner pythcoiner force-pushed the custom_deriv_path branch 2 times, most recently from 4c08ab5 to 611a3e8 Compare May 15, 2025 02:51
@pythcoiner
Copy link
Copy Markdown
Collaborator Author

actual state:
image

image

@edouardparis
Copy link
Copy Markdown
Member

I would not use the warning icon but the tooltip one (icon::tooltip_icon) and move it on the right of
Import an extended public key by selecting a signing device.

Also I do not understand why incrementing account index makes the derivation path not standard.

@pythcoiner
Copy link
Copy Markdown
Collaborator Author

Also I do not understand why incrementing account index makes the derivation path not standard.

cc @bigspider

@bigspider
Copy link
Copy Markdown

Not sure what do you mean? Account numbers for the various supported BIPs are considered standard by the Ledger app if not larger than 100.

@pythcoiner
Copy link
Copy Markdown
Collaborator Author

pythcoiner commented May 15, 2025

Not sure what do you mean? Account numbers for the various supported BIPs are considered standard by the Ledger app if not larger than 100.

I failed to export an xpub w/ m/48'/1'/1'/2' (Nano S+ testnet app 2.2.0-beta)

image

and success if display == true

@pythcoiner
Copy link
Copy Markdown
Collaborator Author

I would not use the warning icon but the tooltip one (icon::tooltip_icon) and move it on the right of
Import an extended public key by selecting a signing device.

image

@pythcoiner pythcoiner force-pushed the custom_deriv_path branch 3 times, most recently from 133abdb to c0c863a Compare May 16, 2025 12:04
@pythcoiner
Copy link
Copy Markdown
Collaborator Author

fixed my mistake, the index stored was Unhardened

}

pub fn derivation_path(network: Network, account: ChildNumber) -> DerivationPath {
assert!(account.is_hardened());
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Note: added this assert to catch if an unhardened derivation path is used

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

nit: I feel it might be slightly better to return an Option or Result here and let the caller unwrap it.

@pythcoiner pythcoiner marked this pull request as ready for review May 16, 2025 12:12
@pythcoiner pythcoiner force-pushed the custom_deriv_path branch 3 times, most recently from 19afe39 to e2e411f Compare May 16, 2025 12:28
@pythcoiner pythcoiner requested a review from edouardparis May 16, 2025 12:51
Comment thread liana-ui/src/component/hw.rs Outdated
Comment thread liana-gui/src/installer/view/mod.rs Outdated
@pythcoiner pythcoiner force-pushed the custom_deriv_path branch 3 times, most recently from 48f98e3 to b09fa49 Compare May 20, 2025 15:39
@pythcoiner pythcoiner requested a review from jp1ac4 May 20, 2025 16:04
@pythcoiner pythcoiner force-pushed the custom_deriv_path branch from b09fa49 to 7d6fce8 Compare May 20, 2025 16:09
Copy link
Copy Markdown
Collaborator

@jp1ac4 jp1ac4 left a comment

Choose a reason for hiding this comment

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

tACK 7d6fce8.

Tested with Ledger and Specter DIY. Added comments for some nits.

version.as_ref(),
*fingerprint,
alias.as_ref(),
accounts.get(fingerprint).cloned(),
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

nit: could also use .copied()

}

pub fn derivation_path(network: Network, account: ChildNumber) -> DerivationPath {
assert!(account.is_hardened());
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

nit: I feel it might be slightly better to return an Option or Result here and let the caller unwrap it.

Comment thread liana-ui/src/component/hw.rs Outdated
impl Account {
pub fn new(index: ChildNumber, fingerprint: Fingerprint) -> Self {
Self {
hardened_index: index,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

nit: possibly there should be a check that the index argument is hardened given the field name, or otherwise I think you can rename the field back to index, which should be fine now that the type is ChildNumber.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

hardened_index => index

let source = Row::new()
.push(p1_regular("Select the source of your key").bold())
.push(Space::with_width(10))
.push(info)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

nit: I feel this tooltip would be more visible if it were next to the pick list within the HW card. Same applies for "Share Xpubs" below.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

this have been request by @edouardparis previously and ACK'd by @nondiremanuel iirc

@pythcoiner
Copy link
Copy Markdown
Collaborator Author

nit: I feel it might be slightly better to return an Option or Result here and let the caller unwrap it.

I don't think it worth bother w/ Option/Result here, it's intended to catch an error at implementation time not at run time

@pythcoiner pythcoiner force-pushed the custom_deriv_path branch from 7d6fce8 to 386c14c Compare May 20, 2025 16:34
Copy link
Copy Markdown
Collaborator

@jp1ac4 jp1ac4 left a comment

Choose a reason for hiding this comment

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

tACK 386c14c.

@pythcoiner
Copy link
Copy Markdown
Collaborator Author

added display of account after xpub fetched:

image

@pythcoiner pythcoiner requested a review from jp1ac4 May 21, 2025 09:53
@pythcoiner pythcoiner force-pushed the custom_deriv_path branch from 5a05a84 to 626eaa1 Compare May 21, 2025 12:55
@pythcoiner
Copy link
Copy Markdown
Collaborator Author

If I choose the same key in a different path, the selected account is shown as 0 regardless of the selection made in the other path. So I think the account parameter is not being set in all places. Also, but less importantly, in the key list view, when viewing HWs, the account is not shown

fixed these 2 issues

@pythcoiner pythcoiner force-pushed the custom_deriv_path branch from 626eaa1 to ce8e1f3 Compare May 21, 2025 14:36
@pythcoiner
Copy link
Copy Markdown
Collaborator Author

the "Register descriptor" step is showing the "Account #0"

fixed this issue

Copy link
Copy Markdown
Collaborator

@jp1ac4 jp1ac4 left a comment

Choose a reason for hiding this comment

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

tACK ce8e1f3.

Copy link
Copy Markdown
Member

@edouardparis edouardparis left a comment

Choose a reason for hiding this comment

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

ACK ce8e1f3

@edouardparis edouardparis merged commit cc00114 into wizardsardine:master May 21, 2025
15 of 19 checks passed
@nondiremanuel nondiremanuel moved this from In Review to Done in Liana General May 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Add Account (i.e. derivation path) selection when setting a key from a hw device

5 participants