From 0a41008a9313c6fbb9f8436afd7ce057e6ffc751 Mon Sep 17 00:00:00 2001 From: Eric Passmore Date: Sat, 7 Jan 2023 04:39:25 -0800 Subject: [PATCH 1/5] docs for building, testing, developing in ledger eco-system --- CONTRIBUTING.md | 23 +++++++++ README.md | 83 ++++++++++++++++++++++++++------- docs/Ledger-Developer-Notes.md | 27 +++++++++++ docs/ledger-blue-setup.md | 80 +++++++++++++++++++++++++++++++ docs/running-tests.md | 75 +++++++++++++++++++++++++++++ docs/speculos-emulator-setup.md | 42 +++++++++++++++++ 6 files changed, 313 insertions(+), 17 deletions(-) create mode 100644 CONTRIBUTING.md create mode 100644 docs/Ledger-Developer-Notes.md create mode 100644 docs/ledger-blue-setup.md create mode 100644 docs/running-tests.md create mode 100644 docs/speculos-emulator-setup.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..de82bfe --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,23 @@ +# Welcome + +We are glad you are here to help. This document goes over the process of submitting changes and making improvements. + +## Developer Steps + +Step 5 is optional. It helps avoid submiting broken PRs. + +1. Open an Issue +2. Create a Branch for your work with issue number at the end +3. Make your changes. Don't forget to update app version in `Makefile` +4. Check your changes by running [`make scan-build`](./README.md#clang-analyzer) +5. To validate push your changed to `main` branch to test. This runs git actions to verify build +6. [Run tests](docs/running-tests.md) +7. Create a PR to merge the changes from your Branch `#2` into `main` + + +## ENF Steps +**EOS Network Foundanation** will perform the following steps +- Fill out [LedgerHQ Form](https://ledger.typeform.com/Nano-App?typeform-source=developers.ledger.com) to start review process + - we are public release + - review [the checklist](https://developers.ledger.com/docs/nano-app/deliverables-checklist/) +- Submitt PR to merge `main` branch into `LedgerHQ/app-eos` on `develop` branch diff --git a/README.md b/README.md index 1e7a18a..bede97c 100644 --- a/README.md +++ b/README.md @@ -9,36 +9,85 @@ To use the generic wallet refer to `signTransaction.py`, `getPublicKey.py` or Le # How to Install developer version ## Configuring Ledger Environment -* Install Vagrant and Virtualbox on your machine -* Run the following +* Install Docker on your machines +* Checkout the app builder repository ``` -git clone https://github.com/fix/ledger-vagrant -cd ledger-vagrant -vagrant up +git clone https://github.com/LedgerHQ/ledger-app-builder.git +cd ledger-app-builder +sudo docker build -t ledger-app-builder:latest . ``` This will take a few minutes to install +## Prepare to Connect Device +Set `udev` rules to enable devices to connect with docker container. *Note:* Instructions are for linux and tested on Ubuntu 22. +``` +wget -q -O - https://raw.githubusercontent.com/LedgerHQ/udev-rules/master/add_udev_rules.sh | sudo bash +``` + +Download your app +``` +git clone https://github.com/eosnetworkfoundation/ledger-app.git +``` + ## Compile your ledger app -* install your app under apps/ for instance: +* go to your instance directory: +* copy over the files and enter the docker container +``` +cd ledger-app +sudo docker run --rm -ti -v "$(realpath .):/app" ledger-app-builder:latest +bash-5.1# make clean +bash-5.1# make +``` + +If you want to **load** and **delete** your app directly from the container image you need to provide `--privileged` access. + +``` +sudo docker run --rm -ti -v "/dev/bus/usb:/dev/bus/usb" -v "$(realpath .):/app" --privileged ledger-app-builder:latest +bash-5.1# make clean +bash-5.1# make +``` + +## Clang Analyzer + ``` -cd apps/ -git clone https://github.com/tarassh/eos-ledger +sudo docker run --rm -ti -v "$(realpath .):/app" ledger-app-builder:latest +bash-5.1# make scan-build +``` + +## Ledger Variants + +The `BOLOS_SDK` has three varients +- **unset**: Nanos +- $NANOX_SDK: Nanox +- $NANOSP_SDK: Nanosp +For Nano X, specify the BOLOS_SDK environment variable before building your app: + +``` +sudo docker run --rm -ti -v "$(realpath .):/app" ledger-app-builder:latest +bash-5.1# make clean +bash-5.1# BOLOS_SDK=$NANOX_SDK make ``` -* connect to the machine with `ssh vagrant` -* build eos app + +For Nano S+, specify the BOLOS_SDK environment variable before building your app: ``` -cd apps/eos-ledger -make clean -make +sudo docker run --rm -ti -v "$(realpath .):/app" ledger-app-builder:latest +bash-5.1# make clean +bash-5.1# BOLOS_SDK=$NANOSP_SDK make ``` -* connect your ledger Nano S to your computer -* install the app on your ledger: `make load` -* remove the app from the ledger: `make delete` +Instructions taken from [Ledger HQ App Builder Readme](https://raw.githubusercontent.com/LedgerHQ/ledger-app-builder/master/README.md) with modification. + +## Loading App + +- Plugin and unlock your device +- From within your container + - `make load` or `BOLOS_SDK=$NANOSP_SDK make load` for the S-Plus + - `make delete` or `BOLOS_SDK=$NANOSP_SDK make delete` for the S-Plus -Install instruction with slight modifications has been taken from [here](https://github.com/fix/ledger-vagrant) +## Developer Notes +[Setup Tools, Emulator, and Testing](./docs/Ledger-Developer-Notes.md) \ No newline at end of file diff --git a/docs/Ledger-Developer-Notes.md b/docs/Ledger-Developer-Notes.md new file mode 100644 index 0000000..601ead5 --- /dev/null +++ b/docs/Ledger-Developer-Notes.md @@ -0,0 +1,27 @@ +## Notes + +Highly recomended to setup the Speculos emulator. Installing Ledger Blue is optional, and recomend holding off on the Ledger Blue tools untill you need them. + +### Setup + - Follow instructions in [README](../README.md) to build & compile + - Setup the [Speculor Emulator](./speculos-emulator-setup.md) + - Optionally setup [Ledger Blue](./ledger-blue-setup.md) command line tools + +## Testing + - Instructions on [Running Tests](./running-test.md) + - LedgerHQ notes on [Testing with Ragger](../tests/functional/usage.md) + +### Creating a New App + - [General Process](https://developers.ledger.com/docs/coin/general-process/) + - [Start Here](https://developers.ledger.com/docs/nano-app/start-here/) + +### Developer Notes + - [Side Loading Apps](https://developers.ledger.com/docs/nano-app/load/) + - [Ragger Documentation](https://ledgerhq.github.io/ragger/) + + +### Ledger Emmulator + - [Speculos Overview](https://developers.ledger.com/docs/speculos/introduction/) + - [Usage](https://developers.ledger.com/docs/speculos/user/usage/) + - [Linux](https://developers.ledger.com/docs/speculos/installation/build/) + diff --git a/docs/ledger-blue-setup.md b/docs/ledger-blue-setup.md new file mode 100644 index 0000000..6055991 --- /dev/null +++ b/docs/ledger-blue-setup.md @@ -0,0 +1,80 @@ +# Setup For Ledger Blue +A more powerful set of command line interfaces. Ledger Blue is an optional set of python scripts that help you manage ledger devices + +## Overview + +- Install python virtual env +- Install App on Physical Device + +## Python Virtual Env + +Install `pipenv` +``` +sudo apt install pip +pip install --user pipenv +``` + +Update you path +``` +if [ -d /home/me/.local/bin ]; then export PATH=${PATH}:/home/me/.local/bin; fi +``` + +Make a place for your virtual environments, and run additional setup +``` +mkdir -p ~/local/python/virtualenv +curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py +python get-pip.py +``` +Test virtual environment install +``` +virtualenv --version +``` +If this doesn't work you may need to run +``` +pip install virtualenv +``` + +## Install on Physical Device + +- Connect your Ledger device to your computer and unlock it. +- Enter your ledger app's directory. If needed build the application binary [see README](../README.md) +- Start a python vitural environment named `ledger` +``` +virtualenv -p python3 ledger +``` +- Activate & Install Ledger Blue +``` +source ledger/bin/activate +pip3 install ledgerblue +``` +- Enter container, everything below is inside the container +``` +sudo docker run --rm -ti -v "/dev/bus/usb:/dev/bus/usb" -v "$(realpath .):/app" --privileged ledger-app-builder:latest +``` +- Test command with `ledgerblue.checkGenuineRemote` + - See [Target Ids](https://gist.github.com/TamtamHero/b7651ffe6f1e485e3886bf4aba673348) + - Example below target id is nano s+ (plus) + - Hardware buttons to accept command + - See [README for udev rules](../README.md) required on linux +``` +python -m ledgerblue.checkGenuineRemote --targetId 0x33000004 +``` +- Deploy binary `app.hex` to ledger device + - target below is nano s+ + - hardware buttons to accept command + - Note if you get error `680f`, delete the app and reload it. +``` +python -m ledgerblue.loadApp --appFlags 0x240 --path "44'/194'" --curve secp256k1 --tlv --targetId 0x33100004 --targetVersion="1.0.4" --delete --fileName bin/app.hex --appName Eos --appVersion 1.4.3 --dataSize $((0x`cat debug/app.map |grep _envram_data | tr -s ' ' | cut -f2 -d' '|cut -f2 -d'x'` - 0x`cat debug/app.map |grep _nvram_data | tr -s ' ' | cut -f2 -d' '|cut -f2 -d'x'`)) `ICONHEX=\`python3 /opt/nanosplus-secure-sdk/icon3.py --hexbitmaponly nanox_app_eos.gif 2>/dev/null\` ; [ ! -z "$ICONHEX" ] && echo "--icon $ICONHEX"` +``` +- [List of Commands for Ledger Blue](https://github.com/LedgerHQ/blue-loader-python/tree/master/ledgerblue) +- Exit Docker. +- Stop Vitural Environment, type `deactivate` in shell. + + +## Sources + +- [Ledger Short Guide](https://www.ledger.com/a-short-guide-to-nano-s-firmware-1-2-features) +- [Python Virtual Envs](https://docs.python-guide.org/dev/virtualenvs/) +- [Ledger Blue Python Project](https://pypi.org/project/ledgerblue/) +- [Ledger Loading the Application](https://developers.ledger.com/docs/nano-app/load/) +- [Bolos Python Loader Specs](https://readthedocs.org/projects/bolos-python-loader/downloads/pdf/latest/) diff --git a/docs/running-tests.md b/docs/running-tests.md new file mode 100644 index 0000000..ae6595b --- /dev/null +++ b/docs/running-tests.md @@ -0,0 +1,75 @@ +# Running Tests + +## Setup + +General configuration for pytest is under `ledger-app/tests/functional/conftest.py`. Configuration inclues useful information like the `app name`, the `devices`, and the `ragger backends`. + +### Ragger +First install `ragger`. It is a python package. May be [installed via pip](https://ledgerhq.github.io/ragger/installation.html) + +Alternatively you can install directly from the github repo. + +``` +git clone https://github.com/LedgerHQ/ragger +cd ragger +pip install --extra-index-url https://test.pypi.org/simple/ '.[all_backends]' +``` + +See [Ragger Documentation](https://ledgerhq.github.io/ragger/) for addtional information. + +### Build The App + +Follow the instructions in [Readme](../README.md#compile-your-ledger-app). + +After each build rename the binaries from `app.elf` to `eos_.elf`. Device is one of the three listed here *nano*, *nanox*, *nanosp*. You will find the binaries under `/bin` directory. + +### Setup Binaries + +Copy the compiled binaries to `tests/elfs` directory, create the directory if necessary. +``` +mkdir -p tests/elfs/ +cd bin +sudo mv app.elf eos_.elf +cp eos_*.elf ../tests/elfs +cd ../ +``` + +## Repeat +Build and copy the binary for each device to `tests/elfs` + +There should be three binaries under `tests/elfs` +- eos_nano.elf +- eos_nanox.elf +- eos_nanosp.elf + +## Run The Emulator + +To validate run the app via speculos. Make sure that you run your emulator to match the build. You pass the correct device in with the `-m` option. + +Note your path to `speculos.py` may differ. + +``` +cd ledger-app +../../ledgerHQ/speculos/speculos.py -m nanosp tests/elfs/eos_naosp.elf +``` + +## Testing + +### Install Packages + +You will need to install several python packages +``` +pip install pytest pycoin asn1 base58 +``` + +### Run Tests + +``` +cd test/functional +pytest -v --tb=short --nanox --display +``` + +### CleanUp + +remove the directory `ledger-app/tests/functional/snapshots-tmp/` to clean out the old snapshots + diff --git a/docs/speculos-emulator-setup.md b/docs/speculos-emulator-setup.md new file mode 100644 index 0000000..95b4579 --- /dev/null +++ b/docs/speculos-emulator-setup.md @@ -0,0 +1,42 @@ +# Setup Emulator for Ledger Devices + +## Overview + +- Build Emulator Speculos + +## Emulator + +- Get the [Source Code](https://github.com/LedgerHQ/speculos) +```console +git clone https://github.com/LedgerHQ/speculos +``` +- cd into directory `speculos` +- [Follow Instructions](https://github.com/LedgerHQ/speculos/blob/master/docs/index.md) to build. Recommend installing with VNC option + - ```` + sudo apt install \ + cmake gcc-arm-linux-gnueabihf libc6-dev-armhf-cross gdb-multiarch \ + python3-pyqt5 python3-construct python3-flask-restful python3-jsonschema \ + python3-mnemonic python3-pil python3-pyelftools python-requests \ + qemu-user-static + ``` + - `sudo apt install libvncserver-dev` + - `cmake -Bbuild -H. -DWITH_VNC=1 && make -C build/` +- Look for `speculos.py` +- Test to validate install + - `pip install pytest` + - `python3 -m pytest -s -v tests/apps/` +- Validate by running with default BTC app + - run in foreground + - display text mode, otherwise default is QT +``` +./speculos.py --display text ./apps/btc.elf +``` +- You can go to `http://127.0.0.1:5000/` for another interface and more data + +## Clean +The clean command is below. After cleaning you may recompile and rebuild. +``` +make -C build/ clean +``` + +## Building With \ No newline at end of file From 0916e88d3b49c36651a52ff9e2861b612d5f6fb7 Mon Sep 17 00:00:00 2001 From: Eric Passmore Date: Mon, 9 Jan 2023 21:58:02 -0800 Subject: [PATCH 2/5] Update docs/running-tests.md Co-authored-by: xchapron-ledger <107417453+xchapron-ledger@users.noreply.github.com> --- docs/running-tests.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/running-tests.md b/docs/running-tests.md index ae6595b..259a934 100644 --- a/docs/running-tests.md +++ b/docs/running-tests.md @@ -2,7 +2,7 @@ ## Setup -General configuration for pytest is under `ledger-app/tests/functional/conftest.py`. Configuration inclues useful information like the `app name`, the `devices`, and the `ragger backends`. +General configuration for pytest is under `ledger-app/tests/functional/conftest.py`. Configuration includes useful information like the `app name`, the `devices`, and the `ragger backends`. ### Ragger First install `ragger`. It is a python package. May be [installed via pip](https://ledgerhq.github.io/ragger/installation.html) From f15cea8237beee2459982993f434762a7ccae11a Mon Sep 17 00:00:00 2001 From: Eric Passmore Date: Mon, 9 Jan 2023 22:33:33 -0800 Subject: [PATCH 3/5] fixed docs to align with ledger - updated links to match updated portal docs - updated Ragger params for version 1.2 - removed ledgerblue docs they were redundant with ledgerHQ docs - removing ledgerblue also removed back sideload example - fixed broken links --- README.md | 5 ++- docs/Ledger-Developer-Notes.md | 21 ++++----- docs/ledger-blue-setup.md | 80 ---------------------------------- docs/running-tests.md | 15 ++++--- 4 files changed, 22 insertions(+), 99 deletions(-) delete mode 100644 docs/ledger-blue-setup.md diff --git a/README.md b/README.md index bede97c..a022162 100644 --- a/README.md +++ b/README.md @@ -12,10 +12,11 @@ To use the generic wallet refer to `signTransaction.py`, `getPublicKey.py` or Le * Install Docker on your machines * Checkout the app builder repository +Note the `./full` path on `docker build` differentiate from the previous version now under `legacy` ``` git clone https://github.com/LedgerHQ/ledger-app-builder.git cd ledger-app-builder -sudo docker build -t ledger-app-builder:latest . +sudo docker build -t ledger-app-builder:latest ./full ``` This will take a few minutes to install @@ -90,4 +91,4 @@ Instructions taken from [Ledger HQ App Builder Readme](https://raw.githubusercon - `make delete` or `BOLOS_SDK=$NANOSP_SDK make delete` for the S-Plus ## Developer Notes -[Setup Tools, Emulator, and Testing](./docs/Ledger-Developer-Notes.md) \ No newline at end of file +[Setup Tools, Emulator, and Testing](./docs/Ledger-Developer-Notes.md) diff --git a/docs/Ledger-Developer-Notes.md b/docs/Ledger-Developer-Notes.md index 601ead5..6f20441 100644 --- a/docs/Ledger-Developer-Notes.md +++ b/docs/Ledger-Developer-Notes.md @@ -1,22 +1,24 @@ ## Notes -Highly recomended to setup the Speculos emulator. Installing Ledger Blue is optional, and recomend holding off on the Ledger Blue tools untill you need them. +Setting up the Speculos emulator and Ragger test utility is highly recommended. ### Setup - - Follow instructions in [README](../README.md) to build & compile + - Follow instructions in [README](../README.md) to build & compile - Setup the [Speculor Emulator](./speculos-emulator-setup.md) - - Optionally setup [Ledger Blue](./ledger-blue-setup.md) command line tools - + - Optionally setup [Ledger Blue](./ledger-blue-setup.md) command line tools + ## Testing - - Instructions on [Running Tests](./running-test.md) + - Instructions on [Running Tests](./running-tests.md) - LedgerHQ notes on [Testing with Ragger](../tests/functional/usage.md) ### Creating a New App - [General Process](https://developers.ledger.com/docs/coin/general-process/) - - [Start Here](https://developers.ledger.com/docs/nano-app/start-here/) - -### Developer Notes - - [Side Loading Apps](https://developers.ledger.com/docs/nano-app/load/) + - [Developer Portal](https://developers.ledger.com/) + +### Developer Notes + - Side Loading Apps + - [Linux](https://developers.ledger.com/docs/embedded-app/load-linux/) + - [Mac OSx](https://developers.ledger.com/docs/embedded-app/load-mac/) - [Ragger Documentation](https://ledgerhq.github.io/ragger/) @@ -24,4 +26,3 @@ Highly recomended to setup the Speculos emulator. Installing Ledger Blue is opti - [Speculos Overview](https://developers.ledger.com/docs/speculos/introduction/) - [Usage](https://developers.ledger.com/docs/speculos/user/usage/) - [Linux](https://developers.ledger.com/docs/speculos/installation/build/) - diff --git a/docs/ledger-blue-setup.md b/docs/ledger-blue-setup.md deleted file mode 100644 index 6055991..0000000 --- a/docs/ledger-blue-setup.md +++ /dev/null @@ -1,80 +0,0 @@ -# Setup For Ledger Blue -A more powerful set of command line interfaces. Ledger Blue is an optional set of python scripts that help you manage ledger devices - -## Overview - -- Install python virtual env -- Install App on Physical Device - -## Python Virtual Env - -Install `pipenv` -``` -sudo apt install pip -pip install --user pipenv -``` - -Update you path -``` -if [ -d /home/me/.local/bin ]; then export PATH=${PATH}:/home/me/.local/bin; fi -``` - -Make a place for your virtual environments, and run additional setup -``` -mkdir -p ~/local/python/virtualenv -curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py -python get-pip.py -``` -Test virtual environment install -``` -virtualenv --version -``` -If this doesn't work you may need to run -``` -pip install virtualenv -``` - -## Install on Physical Device - -- Connect your Ledger device to your computer and unlock it. -- Enter your ledger app's directory. If needed build the application binary [see README](../README.md) -- Start a python vitural environment named `ledger` -``` -virtualenv -p python3 ledger -``` -- Activate & Install Ledger Blue -``` -source ledger/bin/activate -pip3 install ledgerblue -``` -- Enter container, everything below is inside the container -``` -sudo docker run --rm -ti -v "/dev/bus/usb:/dev/bus/usb" -v "$(realpath .):/app" --privileged ledger-app-builder:latest -``` -- Test command with `ledgerblue.checkGenuineRemote` - - See [Target Ids](https://gist.github.com/TamtamHero/b7651ffe6f1e485e3886bf4aba673348) - - Example below target id is nano s+ (plus) - - Hardware buttons to accept command - - See [README for udev rules](../README.md) required on linux -``` -python -m ledgerblue.checkGenuineRemote --targetId 0x33000004 -``` -- Deploy binary `app.hex` to ledger device - - target below is nano s+ - - hardware buttons to accept command - - Note if you get error `680f`, delete the app and reload it. -``` -python -m ledgerblue.loadApp --appFlags 0x240 --path "44'/194'" --curve secp256k1 --tlv --targetId 0x33100004 --targetVersion="1.0.4" --delete --fileName bin/app.hex --appName Eos --appVersion 1.4.3 --dataSize $((0x`cat debug/app.map |grep _envram_data | tr -s ' ' | cut -f2 -d' '|cut -f2 -d'x'` - 0x`cat debug/app.map |grep _nvram_data | tr -s ' ' | cut -f2 -d' '|cut -f2 -d'x'`)) `ICONHEX=\`python3 /opt/nanosplus-secure-sdk/icon3.py --hexbitmaponly nanox_app_eos.gif 2>/dev/null\` ; [ ! -z "$ICONHEX" ] && echo "--icon $ICONHEX"` -``` -- [List of Commands for Ledger Blue](https://github.com/LedgerHQ/blue-loader-python/tree/master/ledgerblue) -- Exit Docker. -- Stop Vitural Environment, type `deactivate` in shell. - - -## Sources - -- [Ledger Short Guide](https://www.ledger.com/a-short-guide-to-nano-s-firmware-1-2-features) -- [Python Virtual Envs](https://docs.python-guide.org/dev/virtualenvs/) -- [Ledger Blue Python Project](https://pypi.org/project/ledgerblue/) -- [Ledger Loading the Application](https://developers.ledger.com/docs/nano-app/load/) -- [Bolos Python Loader Specs](https://readthedocs.org/projects/bolos-python-loader/downloads/pdf/latest/) diff --git a/docs/running-tests.md b/docs/running-tests.md index 259a934..5cb7809 100644 --- a/docs/running-tests.md +++ b/docs/running-tests.md @@ -2,9 +2,9 @@ ## Setup -General configuration for pytest is under `ledger-app/tests/functional/conftest.py`. Configuration includes useful information like the `app name`, the `devices`, and the `ragger backends`. +General configuration for pytest is under `ledger-app/tests/functional/conftest.py`. Configuration includes useful information like the `app name`, the `devices`, and the `ragger backends`. -### Ragger +### Ragger First install `ragger`. It is a python package. May be [installed via pip](https://ledgerhq.github.io/ragger/installation.html) Alternatively you can install directly from the github repo. @@ -19,9 +19,9 @@ See [Ragger Documentation](https://ledgerhq.github.io/ragger/) for addtional inf ### Build The App -Follow the instructions in [Readme](../README.md#compile-your-ledger-app). +Follow the instructions in [Readme](../README.md#compile-your-ledger-app). -After each build rename the binaries from `app.elf` to `eos_.elf`. Device is one of the three listed here *nano*, *nanox*, *nanosp*. You will find the binaries under `/bin` directory. +After each build rename the binaries from `app.elf` to `eos_.elf`. Device is one of the three listed here *nano*, *nanox*, *nanosp*. You will find the binaries under `/bin` directory. ### Setup Binaries @@ -34,7 +34,7 @@ cp eos_*.elf ../tests/elfs cd ../ ``` -## Repeat +## Repeat Build and copy the binary for each device to `tests/elfs` There should be three binaries under `tests/elfs` @@ -64,12 +64,13 @@ pip install pytest pycoin asn1 base58 ### Run Tests +You can run emulated tests for a specific device or for all devices. Set `--device` to `all` for all devices. +To see the GUI for the tests you can use `--display=qt`. If you want to run tests in the background use `--display=headless`. The last option is `--display=text` which simulates the UI inside the terminal. ``` cd test/functional -pytest -v --tb=short --nanox --display +pytest -v --tb=short --device=nanox --display ``` ### CleanUp remove the directory `ledger-app/tests/functional/snapshots-tmp/` to clean out the old snapshots - From 2a7cd1a7f63e4df1ae560b5efac6dff57ee55f07 Mon Sep 17 00:00:00 2001 From: Eric Passmore Date: Mon, 9 Jan 2023 22:46:32 -0800 Subject: [PATCH 4/5] docs macosx need ledgerblue --- docs/Ledger-Developer-Notes.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/Ledger-Developer-Notes.md b/docs/Ledger-Developer-Notes.md index 6f20441..8fd49ab 100644 --- a/docs/Ledger-Developer-Notes.md +++ b/docs/Ledger-Developer-Notes.md @@ -3,9 +3,9 @@ Setting up the Speculos emulator and Ragger test utility is highly recommended. ### Setup +Note for Mac OSx you will need to install ledgerblue to sideload apps onto your physical device. - Follow instructions in [README](../README.md) to build & compile - Setup the [Speculor Emulator](./speculos-emulator-setup.md) - - Optionally setup [Ledger Blue](./ledger-blue-setup.md) command line tools ## Testing - Instructions on [Running Tests](./running-tests.md) From 3cd2723adfcabdcea91e2a8d6be53a351e34a8f1 Mon Sep 17 00:00:00 2001 From: Eric Passmore Date: Tue, 10 Jan 2023 02:27:52 -0800 Subject: [PATCH 5/5] updated parameter usage --- CONTRIBUTING.md | 9 ++++----- README.md | 10 +++++----- docs/running-tests.md | 2 +- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index de82bfe..4e7dfad 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -6,13 +6,12 @@ We are glad you are here to help. This document goes over the process of submitt Step 5 is optional. It helps avoid submiting broken PRs. -1. Open an Issue -2. Create a Branch for your work with issue number at the end +1. Open an issue +2. Create a branch for your work 3. Make your changes. Don't forget to update app version in `Makefile` 4. Check your changes by running [`make scan-build`](./README.md#clang-analyzer) -5. To validate push your changed to `main` branch to test. This runs git actions to verify build -6. [Run tests](docs/running-tests.md) -7. Create a PR to merge the changes from your Branch `#2` into `main` +5. [Run tests](docs/running-tests.md) +6. Create a PR to merge the changes from your Branch `#2` into `main` ## ENF Steps diff --git a/README.md b/README.md index a022162..bd78b5c 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ git clone https://github.com/eosnetworkfoundation/ledger-app.git * copy over the files and enter the docker container ``` cd ledger-app -sudo docker run --rm -ti -v "$(realpath .):/app" ledger-app-builder:latest +sudo docker run --user "$(id -u)":"$(id -g)" --rm -ti -v "$(realpath .):/app" ledger-app-builder:latest bash-5.1# make clean bash-5.1# make ``` @@ -46,7 +46,7 @@ bash-5.1# make If you want to **load** and **delete** your app directly from the container image you need to provide `--privileged` access. ``` -sudo docker run --rm -ti -v "/dev/bus/usb:/dev/bus/usb" -v "$(realpath .):/app" --privileged ledger-app-builder:latest +sudo docker run --user "$(id -u)":"$(id -g)" --rm -ti -v "/dev/bus/usb:/dev/bus/usb" -v "$(realpath .):/app" --privileged ledger-app-builder:latest bash-5.1# make clean bash-5.1# make ``` @@ -54,7 +54,7 @@ bash-5.1# make ## Clang Analyzer ``` -sudo docker run --rm -ti -v "$(realpath .):/app" ledger-app-builder:latest +sudo docker run --user "$(id -u)":"$(id -g)" --rm -ti -v "$(realpath .):/app" ledger-app-builder:latest bash-5.1# make scan-build ``` @@ -68,7 +68,7 @@ The `BOLOS_SDK` has three varients For Nano X, specify the BOLOS_SDK environment variable before building your app: ``` -sudo docker run --rm -ti -v "$(realpath .):/app" ledger-app-builder:latest +sudo docker run --user "$(id -u)":"$(id -g)" --rm -ti -v "$(realpath .):/app" ledger-app-builder:latest bash-5.1# make clean bash-5.1# BOLOS_SDK=$NANOX_SDK make ``` @@ -76,7 +76,7 @@ bash-5.1# BOLOS_SDK=$NANOX_SDK make For Nano S+, specify the BOLOS_SDK environment variable before building your app: ``` -sudo docker run --rm -ti -v "$(realpath .):/app" ledger-app-builder:latest +sudo docker run --user "$(id -u)":"$(id -g)" --rm -ti -v "$(realpath .):/app" ledger-app-builder:latest bash-5.1# make clean bash-5.1# BOLOS_SDK=$NANOSP_SDK make ``` diff --git a/docs/running-tests.md b/docs/running-tests.md index 5cb7809..5f3d8f3 100644 --- a/docs/running-tests.md +++ b/docs/running-tests.md @@ -65,7 +65,7 @@ pip install pytest pycoin asn1 base58 ### Run Tests You can run emulated tests for a specific device or for all devices. Set `--device` to `all` for all devices. -To see the GUI for the tests you can use `--display=qt`. If you want to run tests in the background use `--display=headless`. The last option is `--display=text` which simulates the UI inside the terminal. +Use `--display` to see the emulated UI as the tests are run. The default mode runs the emulator in headless mode. ``` cd test/functional pytest -v --tb=short --device=nanox --display