wizardsardine / async-hwi

⚠️ The interface is not finalized 🚧 and currently specific to our needs with Liana
BSD 3-Clause "New" or "Revised" License
28 stars 17 forks source link

`register_wallet` fails on Ledger Simulator #29

Closed wszdexdrf closed 1 year ago

wszdexdrf commented 1 year ago

I was hoping to create a test for register_wallet when I encountered this bug. The code is as follows:

let policy = "pk([5c9e228d/44'/0'/0']xpub6BiVtCpG9fQPxnPmHXG8PhtzQdWC2Su4qWu6XW9tpWFYhxydCLJGrWBJZ5H6qTAHdPQ7pQhtpjiYZVZARo14qHiay2fvrX996oEP42u8wZy/**)";
hw.register_wallet("Ledger", &policy).await.unwrap();

This results in a panic on the second line with message:

called `Result::unwrap()` on an `Err` value: Device("Device {\n    command: 2,\n    status: IncorrectData,\n}")

The ledger is initialized with seed all all all all all all all all all all all all. The fingerprint and xpub in the policy match with the ones reported by other async-hwi functions (and the SLIP-0014 specification)

edouardparis commented 1 year ago

Hello, thank you for your interest in the library. pk is used with raw public key, maybe do you mean pkh ?

wszdexdrf commented 1 year ago

pk is used with raw public key, maybe do you mean pkh ?

Yes, I am sorry I made a mistake while copying the code to this issue. The error is for let policy = "pkh(...

edouardparis commented 1 year ago

I tried to reproduce the problem with my own seed and the testnet bitcoin app and I reported an issue to the ledger team (https://github.com/LedgerHQ/app-bitcoin-new/issues/129), can you confirm me that your bitcoin app version is > 2.1.0 ? The policy you are using does not require registration, so I hope it does not block you

wszdexdrf commented 1 year ago

can you confirm me that your bitcoin app version is > 2.1.0 ?

Yes indeed the version is exactly 2.1. I got the app from here The firmware version is 2.1. The app version is 2.0.1 😅

bigspider commented 1 year ago

Oh, that's a very old version (I think it's 2.0.1), that is there to test speculos rather than to test bitcoin. The 2.1 in the filename refers to the firmware version (2.1 for NanoS).

We don't have stable places to distribute compiled elfs, I suggest building from the repository if you can.