cosmos / ledger-cosmos-obsolete

Ledger Nano S support for Tendermint/Cosmos
Apache License 2.0
42 stars 29 forks source link

Error "wrong targetId" while running `./nanocli.sh vload` #118

Closed phonikg closed 5 years ago

phonikg commented 5 years ago

It seems that the script is incorrectly identifying my Nano S Firmware v1.4.2 as having a targetID of 31100004 rather than the correct targetID of 3110003 as per Ledger Github resulting in the following error:

ledgerblue.commException.CommException: Exception : Invalid status 6484 (Are you using the correct targetId?

Full Error:

make: Entering directory '/home/jgerryts/valapp/ledger-cosmos/src/ledger-val' TARGET_NAME=TARGET_NANOS TARGET_ID=0x31100004 BOLOS_ENV=/opt/bolos BOLOS_ENV=/opt/bolos python -m ledgerblue.loadApp --appFlags 0x00 --delete --tlv --targetId 0x31100004 --delete --fileName bin/app.hex --appName "Tendermint" --appVersion 0.6.0 --dataSize cat debug/app.map |grep _nvram_data_size | tr -s ' ' | cut -f2 -d' ' ICONHEX=\python /home/jgerryts/valapp/ledger-cosmos/deps/nanos-secure-sdk/icon.py /home/jgerryts/valapp/ledger-cosmos/src/ledger-val/icon.gif hexbitmaponly 2>/dev/null` ; [ ! -z "$ICONHEX" ] && echo "--icon $ICONHEX"` --path "44'/118'" Generated random root public key : 04d0c4fd554e18dba0d76216fe9139f4cdf292b450c150363ff8551aee6b9e6aa1b080e172ad8ea61817f69634ea9be9212eab7717b0a1ff8f5a08ce271be5aa09 Traceback (most recent call last): File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main "main", fname, loader, pkg_name) File "/usr/lib/python2.7/runpy.py", line 72, in _run_code exec code in run_globals File "/home/jgerryts/.local/lib/python2.7/site-packages/ledgerblue/loadApp.py", line 176, in secret = getDeployedSecretV2(dongle, bytearray.fromhex(args.rootPrivateKey), args.targetId) File "/home/jgerryts/.local/lib/python2.7/site-packages/ledgerblue/deployed.py", line 91, in getDeployedSecretV2 dongle.exchange(apdu) File "/home/jgerryts/.local/lib/python2.7/site-packages/ledgerblue/comm.py", line 135, in exchange raise CommException("Invalid status %04x (%s)" % (sw, possibleCause), sw, response) ledgerblue.commException.CommException: Exception : Invalid status 6484 (Are you using the correct targetId?) make: *** [Makefile:104: load] Error 1 make: Leaving directory '/home/jgerryts/valapp/ledger-cosmos/src/ledger-val'

jleni commented 5 years ago

Hi @phonikg It is not a 'detection' issue... The app is compiled with the SDK that is added as a submodule here:

https://github.com/cosmos/ledger-cosmos/tree/master/deps

The SDK defines the applicable TARGET_ID. If you want to use a different firmware version, you will need to change the SDK by pointing the submodule to another tag. In practice, I am actually not sure if it will work.. as changes in the SDK might not be compatible, but it is worth trying.

phonikg commented 5 years ago

Thanks @jleni ,

I may be confused then as I read that "This project requires ledger firmware 1.4.2" but it looks like the SDK that is added is for 1.5.5 is that correct?

I was successful in sideloading onto a Ledger Nano w/ v1.5.5 but am getting the i/o timeout error on gaiad startup, was hoping to install on a v1.4.2 to see if the lower latencywould alleviate that error.

Is the requirement v1.4.2 specifically or => ?

jleni commented 5 years ago

I may be confused then as I read that "This project requires ledger firmware 1.4.2" but it looks like the SDK that is added is for 1.5.5 is that correct?

yes, the readme has not been updated. I have created an issue.

getting the i/o timeout error on gaiad startup, was hoping to install on a v1.4.2 to see if the lower latencywould alleviate that error.

What kind of timeout error are you getting?

phonikg commented 5 years ago

Re: Update README.md - that makes sense then thanks for clarification.

Re timeout error when connecting gaiad to tmkms(ledger) I am getting the following error in gaiad on startup:

While tmkms is running and the output is as follows:

[admin@localhost ~]$ tmkms start -c ~/.tmkms/tmkms.toml 21:34:59 [INFO] tmkms 0.4.0 starting up... 21:34:59 [INFO] [keyring:ledgertm:ledgertm] added validator key cosmosvalconspub1zcjduepq9t8j7hrvyjn7l6sw4ndhlmjt6xwy7dweqsmnxntd5ezkzsccm85q2ctjy6 21:34:59 [ERROR] [gaia-13001@tcp://localhost:26670] I/O error: No such file or directory (os error 2) 21:35:00 [ERROR] [gaia-13001@tcp://localhost:26670] I/O error: No such file or directory (os error 2) 21:35:01 [ERROR] [gaia-13001@tcp://localhost:26670] I/O error: No such file or directory (os error 2)

I then start gaiad and get the following error:

[admin@localhost ~]$ gaiad start I[2019-03-10|17:36:24.840] Starting ABCI with Tendermint module=main E[2019-03-10|17:36:27.874] OnStart module=privval err="accept tcp 127.0.0.1:26670: i/o timeout" ERROR: Error with private validator socket client: failed to start private validator: accept tcp 127.0.0.1:26670: i/o timeout

After reading the one medium post and some of the comments in Riot I have disabled IPv6, tried every combination of localhost vs 127.0.0.1 and still get the timeout msg almost immediately after running gaiad start

Therefore my thought was that maybe latency was still an issue and the Ledger on v1.5.5 wasnt responding within the window expected by gaiad. Hope you can follow my logic.

jleni commented 5 years ago

Thanks @jleni ,

I may be confused then as I read that "This project requires ledger firmware 1.4.2" but it looks like the SDK that is added is for 1.5.5 is that correct?

I was successful in sideloading onto a Ledger Nano w/ v1.5.5 but am getting the i/o timeout error on gaiad startup, was hoping to install on a v1.4.2 to see if the lower latencywould alleviate that error.

Is the requirement v1.4.2 specifically or => ?

I have been discussing this with Ledger today and you might be interested in this issue #120 The app will now run only in with SDK >= 1.5.5 to avoid this issue