Zondax / ledger-filecoin

Filecoin app for Ledger Nano S and X
Apache License 2.0
26 stars 17 forks source link

ChangeOwnerAddress get error #76

Closed toby127 closed 2 years ago

toby127 commented 3 years ago

it return error when i try to sign a message of changeOwnerAddress with ledger(nano s), error:Unexpected data type

youdou24 commented 3 years ago

i have the same problem

deanls1 commented 3 years ago

same problem

houweifeng commented 2 years ago

WithdrawBalance has the same problem。

rllola commented 2 years ago

I would need to know what wallet did you use that produce this error ?

My first thought is that this wallet send the wrong data to the ledger or in an invalid format. If you all use the same one it would help me confirm this and maybe help them fix it.

toby127 commented 2 years ago

I would need to know what wallet did you use that produce this error ?

My first thought is that this wallet send the wrong data to the ledger or in an invalid format. If you all use the same one it would help me confirm this and maybe help them fix it.

I used nanos to be owner of filecoin, and i try to sign a message of changeOwnerAddress method, then it return me "Unexpected data type",params of message was a string of CBOR addressId.

Message like : {"jsonrpc":"2.0","result":{"Version":0,"To":"f01171255","From":"f3vaxas7i4bhhno7uhzxpcflbmykk3wghc6vivxurobuin7n2bxckvxyqctofqznodfrs7o2qsyz2gstnphbja","Nonce":2,"Value":"0","GasLimit":1994916,"GasFeeCap":"2377727391","GasPremium":"99536","Method":23,"Params":"RADfvUc=","CID":{"/":"bafy2bzacecj6vgpcz4k5ulmu5dpskxrpgjtbrwzelbve7s4ia2wjnaldbkckm"}},"id":3}

rllola commented 2 years ago

I used nanos to be owner of filecoin, and i try to sign a message of changeOwnerAddress method, then it return me "Unexpected data type",params of message was a string of CBOR addressId.

I need to know what do you use your nano s with. On your computer what software is used to talk to the ledger device ? Do you use Lotus with ledger ?

Also have you activated the advance mode on your filecoin app ?

I am looking into it. I haven't managed to reproduce it tho. The message info is helpful.

rllola commented 2 years ago

@0127abcd I noticed that you are using a BLS address (start with f3). It required to produce a BLS signature (see https://spec.filecoin.io/algorithms/crypto/signatures/#section-algorithms.crypto.signatures.bls-signatures). Unfortunately it is not yet possible to do it on a ledger device. It will be in a few months after a firmware update.

It does not seems to be the source of this particular issue tho.

toby127 commented 2 years ago

Also have you activated the advance mode on your filecoin app ? I activated the expert mode. I used Lotus with ledger.

@0127abcd I noticed that you are using a BLS address (start with f3). It required to produce a BLS signature (see https://spec.filecoin.io/algorithms/crypto/signatures/#section-algorithms.crypto.signatures.bls-signatures). Unfortunately it is not yet possible to do it on a ledger device. It will be in a few months after a firmware update.

It does not seems to be the source of this particular issue tho.

I'm sorry to use the wrong information and bring you misunderstanding , that message was copied from a website, i didn't use bls address, but secp256k1 address generated by the ledger device.

rllola commented 2 years ago

Got it @0127abcd. No problem.

Well method 23 is definitely not implemented in ledger. The error message is wrong tho. It should be Data is invalid : Unexpected method.

I am not sure we can implement it. Lotus should restrict the ledger commands to the one that have been implemented.

rllola commented 2 years ago

All methods are in fact implemented and ledger should be able to parse them (I was looking at an old version my mistake).

I haven't been able to reproduce the issue and I have added a test in zemu that test exactly it. It is passing so without more info on it I can't do much more.