Skip to content

Commit

Permalink
Merge pull request #15 from blooo-io/fix/audit-fix
Browse files Browse the repository at this point in the history
Fix/audit fix
  • Loading branch information
keiff3r authored Oct 8, 2024
2 parents 419b86d + 7217cd4 commit 5eb7ff5
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build_and_functional_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
uses: LedgerHQ/ledger-app-workflows/.github/workflows/reusable_build.yml@v1
with:
upload_app_binaries_artifact: "compiled_app_binaries"
flags: "DEBUG=0 COIN=bitcoin_testnet"
flags: "DEBUG=0 COIN=acre_testnet"

ragger_tests:
name: Run ragger tests using the reusable workflow
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ jobs:

- name: Build
run: |
make DEBUG=0 COIN=bitcoin BOLOS_SDK=${{ matrix.SDK }} && mv bin/ acre-bin/
make DEBUG=0 COIN=acre BOLOS_SDK=${{ matrix.SDK }} && mv bin/ acre-bin/
make clean
make DEBUG=0 COIN=bitcoin_testnet BOLOS_SDK=${{ matrix.SDK }} && mv bin/ acre-testnet-bin/
make DEBUG=0 COIN=acre_testnet BOLOS_SDK=${{ matrix.SDK }} && mv bin/ acre-testnet-bin/
- name: Upload Acre app binary
uses: actions/upload-artifact@v4
with:
Expand Down
14 changes: 7 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@ include $(BOLOS_SDK)/Makefile.defines
CURVE_APP_LOAD_PARAMS = secp256k1

# Application allowed derivation paths.
PATH_APP_LOAD_PARAMS = "44'/0'" "44'/1'" "84'/0'" "84'/1'" "86'/0'" "86'/1'"
PATH_APP_LOAD_PARAMS = "44'/0'" "44'/1'" "48'/0'" "48'/1'" "49'/0'" "49'/1'" "84'/0'" "84'/1'" "86'/0'" "86'/1'"

# Allowed SLIP21 paths
PATH_SLIP21_APP_LOAD_PARAMS = "LEDGER-Wallet policy"

# Application version
APPVERSION_M = 1
APPVERSION_N = 0
APPVERSION_P = 1
APPVERSION_P = 2
APPVERSION_SUFFIX = # if not empty, appended at the end. Do not add a dash.

ifeq ($(APPVERSION_SUFFIX),)
Expand All @@ -65,11 +65,11 @@ endif

# Setting to allow building variant applications
VARIANT_PARAM = COIN
VARIANT_VALUES = bitcoin_testnet bitcoin
VARIANT_VALUES = acre_testnet acre

# simplify for tests
ifndef COIN
COIN=bitcoin_testnet
COIN=acre_testnet
endif

########################################
Expand All @@ -79,7 +79,7 @@ HAVE_APPLICATION_FLAG_DERIVE_MASTER = 1
HAVE_APPLICATION_FLAG_BOLOS_SETTINGS = 1
HAVE_APPLICATION_FLAG_LIBRARY = 1

ifeq ($(COIN),bitcoin_testnet)
ifeq ($(COIN),acre_testnet)
# Bitcoin testnet, no legacy support
DEFINES += BIP32_PUBKEY_VERSION=0x043587CF
DEFINES += BIP44_COIN_TYPE=1
Expand All @@ -89,7 +89,7 @@ ifeq ($(COIN),bitcoin_testnet)
DEFINES += COIN_COINID_SHORT=\"TEST\"

APPNAME = "Acre Test"
else ifeq ($(COIN),bitcoin)
else ifeq ($(COIN),acre)
# the version for performance tests automatically approves all requests
# there is no reason to ever compile the mainnet app with this flag
ifneq ($(AUTOAPPROVE_FOR_PERF_TESTS),0)
Expand All @@ -108,7 +108,7 @@ else ifeq ($(COIN),bitcoin)

else
ifeq ($(filter clean,$(MAKECMDGOALS)),)
$(error Unsupported COIN - use bitcoin_testnet, bitcoin)
$(error Unsupported COIN - use acre_testnet, acre)
endif
endif

Expand Down
18 changes: 14 additions & 4 deletions tests/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# End-to-end tests
# End-to-end Tests

These tests are implemented in Python and can be executed either using the [Speculos](https://github.com/LedgerHQ/speculos) emulator or a Ledger Nano S/X.
These tests are implemented in Python and can be executed using either the [Speculos](https://github.com/LedgerHQ/speculos) emulator or a physical Ledger Nano X/SP/Flex or Stax device. The tests require an x86_64 architecture.

Note: If you're using the Ledger Developer Extension, some tests (those containing "e2e" in their names) may not run properly due to missing libraries in the Docker image.

All the commands in this folder are meant to be ran from the `tests` folder, not from the root.

Python dependencies are listed in [requirements.txt](requirements.txt), install them using [pip](https://pypi.org/project/pip/)
Python dependencies are listed in [requirements.txt](requirements.txt), install them using [pip](https://pypi.org/project/pip/).

```
pip install -r requirements.txt
Expand All @@ -16,6 +18,13 @@ Some tests require the `bitcoind 22.0` binary to be in the `$PATH` variable, or
export BITCOIND=/path/to/my/bitcoind
```

You may also need to install the following dependencies to run the end to end tests:

```
sudo apt-get update && sudo apt-get install -y qemu-user-static tesseract-ocr libtesseract-dev
pip install -U pip setuptools
```

## Launch with Speculos

Build the app as normal from the root folder. For convenience, you probably want to enable DEBUG:
Expand All @@ -29,6 +38,7 @@ Then run all the tests from this folder, specifying the device: nanox, nanosp, s
```
pytest --device yourdevice
```

You can enable the screen display with the option `--display`

## Launch with your Nano S/X/SP or Stax
Expand All @@ -45,4 +55,4 @@ Be sure to have you device connected through USB (without any other software int

```
pytest --device yourdevice --backend ledgercomm
```
```
Binary file modified tests/snapshots/flex/test_dashboard/00001.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/snapshots/nanosp/test_dashboard/00001.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/snapshots/nanox/test_dashboard/00001.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/snapshots/stax/test_dashboard/00001.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 5eb7ff5

Please sign in to comment.