LedgerHQ / ledgerctl

A library to control Ledger devices
MIT License
40 stars 20 forks source link

Loading pre-built ledger app fails for nanoS device on Mac. #71

Closed jakub-rdx closed 1 year ago

jakub-rdx commented 1 year ago

Here is detailed setup I done before I tried to flash ledger nanoS with pre-built app: brew install pyenv pyenv install 3.11.3 pyenv global 3.11.3 then I followed ledgerctl README and done pip3 install --upgrade protobuf setuptools ecdsa pip3 install ledgerwallet Then I verified ledgerctl was indeed installed. Then cargo install --git https://github.com/LedgerHQ/cargo-ledger pip3 install ledgerblue After above setup I tried flashing with script that uses cargo ledger --use-prebuilt ... and I get following error ./flash-nanos.sh text data bss dec hex filename 79168 0 4608 83776 14740 /Users/jakub-rdx/git/babylon-ledger-app/target/nanos/debug/babylon-ledger-app [WARNING] JSON files will be deprecated in future version Traceback (most recent call last): File "/Users/jakub-rdx/.pyenv/versions/3.11.2/bin/ledgerctl", line 8, in <module> sys.exit(cli()) ^^^^^ File "/Users/jakub-rdx/.pyenv/versions/3.11.2/lib/python3.11/site-packages/click/core.py", line 1130, in __call__ return self.main(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/jakub-rdx/.pyenv/versions/3.11.2/lib/python3.11/site-packages/click/core.py", line 1055, in main rv = self.invoke(ctx) ^^^^^^^^^^^^^^^^ File "/Users/jakub-rdx/.pyenv/versions/3.11.2/lib/python3.11/site-packages/click/core.py", line 1657, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/jakub-rdx/.pyenv/versions/3.11.2/lib/python3.11/site-packages/click/core.py", line 1404, in invoke return ctx.invoke(self.callback, **ctx.params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/jakub-rdx/.pyenv/versions/3.11.2/lib/python3.11/site-packages/click/core.py", line 760, in invoke return __callback(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/jakub-rdx/.pyenv/versions/3.11.2/lib/python3.11/site-packages/click/decorators.py", line 38, in new_func return f(get_current_context().obj, *args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/jakub-rdx/.pyenv/versions/3.11.2/lib/python3.11/site-packages/ledgerwallet/ledgerctl.py", line 181, in install_app client.delete_app(app_manifest.app_name) File "/Users/jakub-rdx/.pyenv/versions/3.11.2/lib/python3.11/site-packages/ledgerwallet/client.py", line 345, in delete_app self.apdu_secure_exchange( File "/Users/jakub-rdx/.pyenv/versions/3.11.2/lib/python3.11/site-packages/ledgerwallet/client.py", line 227, in apdu_secure_exchange secret = self.authenticate(server) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/jakub-rdx/.pyenv/versions/3.11.2/lib/python3.11/site-packages/ledgerwallet/client.py", line 236, in authenticate self.reset() File "/Users/jakub-rdx/.pyenv/versions/3.11.2/lib/python3.11/site-packages/ledgerwallet/client.py", line 452, in reset return self.validate_target_id(self.target_id) ^^^^^^^^^^^^^^ File "/Users/jakub-rdx/.pyenv/versions/3.11.2/lib/python3.11/site-packages/ledgerwallet/client.py", line 463, in target_id self.get_version_info() File "/Users/jakub-rdx/.pyenv/versions/3.11.2/lib/python3.11/site-packages/ledgerwallet/client.py", line 438, in get_version_info version_info = VersionInfo.parse(data) ^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/jakub-rdx/.pyenv/versions/3.11.2/lib/python3.11/site-packages/construct/core.py", line 288, in parse return self.parse_stream(io.BytesIO(data), **contextkw) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/jakub-rdx/.pyenv/versions/3.11.2/lib/python3.11/site-packages/construct/core.py", line 300, in parse_stream return self._parsereport(stream, context, "(parsing)") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/jakub-rdx/.pyenv/versions/3.11.2/lib/python3.11/site-packages/construct/core.py", line 312, in _parsereport obj = self._parse(stream, context, path) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/jakub-rdx/.pyenv/versions/3.11.2/lib/python3.11/site-packages/construct/core.py", line 2120, in _parse subobj = sc._parsereport(stream, context, path) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/jakub-rdx/.pyenv/versions/3.11.2/lib/python3.11/site-packages/construct/core.py", line 312, in _parsereport obj = self._parse(stream, context, path) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/jakub-rdx/.pyenv/versions/3.11.2/lib/python3.11/site-packages/construct/core.py", line 2653, in _parse return self.subcon._parsereport(stream, context, path) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/jakub-rdx/.pyenv/versions/3.11.2/lib/python3.11/site-packages/construct/core.py", line 312, in _parsereport obj = self._parse(stream, context, path) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/jakub-rdx/.pyenv/versions/3.11.2/lib/python3.11/site-packages/construct/core.py", line 703, in _parse obj = self.subcon._parsereport(stream, context, path) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/jakub-rdx/.pyenv/versions/3.11.2/lib/python3.11/site-packages/construct/core.py", line 312, in _parsereport obj = self._parse(stream, context, path) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/jakub-rdx/.pyenv/versions/3.11.2/lib/python3.11/site-packages/construct/core.py", line 4703, in _parse length = self.lengthfield._parsereport(stream, context, path) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/jakub-rdx/.pyenv/versions/3.11.2/lib/python3.11/site-packages/construct/core.py", line 312, in _parsereport obj = self._parse(stream, context, path) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/jakub-rdx/.pyenv/versions/3.11.2/lib/python3.11/site-packages/construct/core.py", line 1041, in _parse data = stream_read(stream, self.length, path) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/jakub-rdx/.pyenv/versions/3.11.2/lib/python3.11/site-packages/construct/core.py", line 91, in stream_read raise StreamError("stream read less than specified amount, expected %d, found %d" % (length, len(data)), path=path) construct.core.StreamError: Error in path (parsing) -> mcu_version stream read less than specified amount, expected 1, found 0

Any idea what might be causing the issue?