eosnetworkfoundation / ledger-app

EOS app for ledger devices
Apache License 2.0
1 stars 0 forks source link

Tests fails on nanosp physical device assumes navigation possible on all backends #41

Open ericpassmore opened 1 year ago

ericpassmore commented 1 year ago

When running ragger testing on a physical device the most basic test fails. All other tests pass. All tests pass on the speculos emulator.

Steps to reproduce, using nanosp device with app version 1.4.4 and firmware 1.0.4, includes PR #14

  1. Install app on device
    sudo docker run --rm -ti -v "/dev/bus/usb:/dev/bus/usb" -v "$(realpath .):/app" --privileged ledger-app-builder:latest
    make clean
    BOLOS_SDK=$NANOSP_SDK make
    BOLOS_SDK=$NANOSP_SDK make load

    Follow prompts on device to remove previous version and install new version.

  2. Open eos app on device
  3. Run test
    cd tests/functional
    pytest -v --tb=short --nanosp --backend ledgerwallet -k test_app_mainmenu_settings

Error Report

==================================================== test session starts ==================================================== platform linux -- Python 3.10.6, pytest-7.2.0, pluggy-1.0.0 -- /usr/bin/python3 cachedir: .pytest_cache rootdir: /home/eric/repos/ENF/ledger-app/tests/functional collected 18 items / 17 deselected / 1 selected

test_app_mainmenu_settings_cfg.py::test_app_mainmenu_settings_cfg[nanosp 1.0.3] FAILED [100%]

========================================================= FAILURES ========================================================== ___ test_app_mainmenu_settings_cfg[nanosp 1.0.3] ____ test_app_mainmenu_settings_cfg.py:37: in test_app_mainmenu_settings_cfg assert data_allowed is True E assert False is True --------------------------------------------------- Captured stderr setup --------------------------------------------------- [2023-01-05 05:29:46,759][INFO] ragger.logger - Starting LedgerWalletBackend stream ---------------------------------------------------- Captured log setup ----------------------------------------------------- INFO ragger.logger:ledgerwallet.py:54 Starting LedgerWalletBackend stream --------------------------------------------------- Captured stderr call ---------------------------------------------------- [2023-01-05 05:29:46,837][DEBUG] ragger.apdu_logger - => d406000000 [2023-01-05 05:29:46,842][DEBUG] ragger.apdu_logger - <= 000104049000 [2023-01-05 05:29:46,842][DEBUG] ragger.apdu_logger - <= 000104049000 [2023-01-05 05:29:46,843][DEBUG] ragger.apdu_logger - => d406000000 [2023-01-05 05:29:46,848][DEBUG] ragger.apdu_logger - <= 000104049000 [2023-01-05 05:29:46,849][DEBUG] ragger.apdu_logger - <= 000104049000 ----------------------------------------------------- Captured log call ----------------------------------------------------- DEBUG ragger.apdu_logger:ledgerwallet.py:82 => d406000000 DEBUG ragger.apdu_logger:ledgerwallet.py:86 <= 000104049000 DEBUG ragger.apdu_logger:ledgerwallet.py:37 <= 000104049000 DEBUG ragger.apdu_logger:ledgerwallet.py:82 => d406000000 DEBUG ragger.apdu_logger:ledgerwallet.py:86 <= 000104049000 DEBUG ragger.apdu_logger:ledgerwallet.py:37 <= 000104049000 ================================================== short test summary info ================================================== FAILED test_app_mainmenu_settings_cfg.py::test_app_mainmenu_settings_cfg[nanosp 1.0.3] - assert False is True ============================================= 1 failed, 17 deselected in 2.16s ==============================================

ericpassmore commented 1 year ago

Found the issue, its the contract data allow setting

# CLA 0xD4 
# INS_GET_APP_CONFIGURATION 0x06

https://github.com/eosnetworkfoundation/ledger-app/blob/3f6cc4ceb55226d80fed1c79c8754005ffc4fe07/tests/functional/apps/eos.py#L73-L86

ericpassmore commented 1 year ago

Tried with previous version of EOS APP 1.4.3, still failed on nanosp hardware

ericpassmore commented 1 year ago

Trying to isolate if this is a nanosp 1.0.4 firmware issue with instructions "d406000000"

Next step downgrade firmware on nanosp physical device to 1.0.3 and validate tests pass. Waiting on answer from discord dev support.

ericpassmore commented 1 year ago

Ok, figured this out. Ragger.Navigation does not work on physical devices. Will suggest adding a check for the SpeculosBackend before executing the navigation commands and second data_allowed check