diff --git a/.github/workflows/codeql_checks.yml b/.github/workflows/codeql_checks.yml index b781d5f1..8b535779 100644 --- a/.github/workflows/codeql_checks.yml +++ b/.github/workflows/codeql_checks.yml @@ -18,7 +18,7 @@ jobs: name: Analyse strategy: matrix: - sdk: [ "$NANOS_SDK", "$NANOX_SDK", "$NANOSP_SDK", "$STAX_SDK" ] + sdk: [ "$NANOS_SDK", "$NANOX_SDK", "$NANOSP_SDK", "$STAX_SDK", "$FLEX_SDK"] #'cpp' covers C and C++ language: [ 'cpp' ] runs-on: ubuntu-latest diff --git a/README.md b/README.md index 3f09aed6..e20c0488 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ This repository contains: -- Ledger Nano S/Nano X/Nano SPlus/STAX BOLOS app +- Ledger Nano S/Nano X/Nano SPlus/STAX/FLEX BOLOS app - Specs / Documentation - Ledger ragger tests @@ -54,7 +54,7 @@ make BOLOS_SDK=$STAX_SDK make BOLOS_SDK=$FLEX_SDK ``` -Stax app can be compiled in DEBUG mode for debugging purposes +Stax and flex app can be compiled in DEBUG mode for debugging purposes ```shell make BOLOS_SDK=$STAX_SDK DEBUG=1 ``` @@ -212,8 +212,9 @@ You can choose which device to compile and load for by setting the `BOLOS_SDK` e - `BOLOS_SDK=$NANOX_SDK` - `BOLOS_SDK=$NANOSP_SDK` - `BOLOS_SDK=$STAX_SDK` +- `BOLOS_SDK=$FLEX_SDK` -For Stax device you can compile +For Stax and FLEX device you can compile ```shell make BOLOS_SDK=$STAX_SDK DEBUG=1 # compile optionally with PRINTF ``` diff --git a/deps/README.md b/deps/README.md index dd8fb361..a8671974 100644 --- a/deps/README.md +++ b/deps/README.md @@ -1,8 +1,8 @@ ## Updating zx-lib -Menu feaure requires us o change zxlib menu layout. Thus insead of a submodule, we have ledger-zxlib included as a copy. In case you need to update zxlib, this is the list of changes performed. +Menu fetaure requires us to change zxlib menu layout. Thus instead of a submodule, we have ledger-zxlib included as a copy. In case you need to update zxlib, this is the list of changes performed. -- Menu conains new "Show address"/"View address" entries which display address and pubkey according to data saved on slot 0 +- Menu contains new "Show address"/"View address" entries which display address and pubkey according to data saved on slot 0 - Menu changes. Remove "Developed by" and "Website" entries. - Set MAX_CHARS_PER_VALUE1_LINE to 120 We experienced crashes with certain strings too long. diff --git a/deps/ledger-zxlib/app/ui/view_internal.h b/deps/ledger-zxlib/app/ui/view_internal.h index f22f4803..db808b24 100644 --- a/deps/ledger-zxlib/app/ui/view_internal.h +++ b/deps/ledger-zxlib/app/ui/view_internal.h @@ -96,7 +96,7 @@ static const char *shortcut_value = SHORTCUT_VALUE; #if defined(TARGET_STAX) || defined(TARGET_FLEX) #ifdef NB_MAX_DISPLAYED_PAIRS_IN_REVIEW #undef NB_MAX_DISPLAYED_PAIRS_IN_REVIEW -#define NB_MAX_DISPLAYED_PAIRS_IN_REVIEW 5 +#define NB_MAX_DISPLAYED_PAIRS_IN_REVIEW 6 #endif #endif diff --git a/deps/ledger-zxlib/include/buffering.h b/deps/ledger-zxlib/include/buffering.h index ec6e80cf..121ba278 100644 --- a/deps/ledger-zxlib/include/buffering.h +++ b/deps/ledger-zxlib/include/buffering.h @@ -26,8 +26,8 @@ extern "C" { typedef struct { uint8_t *data; - uint16_t size; - uint16_t pos; + size_t size; + size_t pos; uint8_t in_use: 1; } buffer_state_t; @@ -37,9 +37,9 @@ typedef struct { /// \param flash_buffer /// \param flash_buffer_size void buffering_init(uint8_t *ram_buffer, - uint16_t ram_buffer_size, + size_t ram_buffer_size, uint8_t *flash_buffer, - uint16_t flash_buffer_size); + size_t flash_buffer_size); /// Reset buffer void buffering_reset(); @@ -48,7 +48,7 @@ void buffering_reset(); /// \param data /// \param length /// \return the number of appended bytes -int buffering_append(uint8_t *data, int length); +int buffering_append(uint8_t *data, size_t length); /// buffering_get_ram_buffer /// \return diff --git a/deps/ledger-zxlib/include/zxversion.h b/deps/ledger-zxlib/include/zxversion.h index e59c51b8..186967bb 100644 --- a/deps/ledger-zxlib/include/zxversion.h +++ b/deps/ledger-zxlib/include/zxversion.h @@ -17,4 +17,4 @@ #define ZXLIB_MAJOR 28 #define ZXLIB_MINOR 0 -#define ZXLIB_PATCH 5 +#define ZXLIB_PATCH 7 diff --git a/deps/ledger-zxlib/src/buffering.c b/deps/ledger-zxlib/src/buffering.c index e9567827..01602adb 100644 --- a/deps/ledger-zxlib/src/buffering.c +++ b/deps/ledger-zxlib/src/buffering.c @@ -25,9 +25,9 @@ buffer_state_t ram; // Ram buffer_state_t flash; // Flash void buffering_init(uint8_t *ram_buffer, - uint16_t ram_buffer_size, + size_t ram_buffer_size, uint8_t *flash_buffer, - uint16_t flash_buffer_size) { + size_t flash_buffer_size) { ram.data = ram_buffer; ram.size = ram_buffer_size; ram.pos = 0; @@ -46,11 +46,11 @@ void buffering_reset() { flash.in_use = 0; } -int buffering_append(uint8_t *data, int length) { +int buffering_append(uint8_t *data, size_t length) { if (ram.in_use) { if (ram.size - ram.pos >= length) { // RAM in use, append to ram if there is enough space - MEMCPY(ram.data + ram.pos, data, (size_t) length); + MEMCPY(ram.data + ram.pos, data, length); ram.pos += length; } else { // If RAM is not big enough copy memory to flash @@ -66,7 +66,7 @@ int buffering_append(uint8_t *data, int length) { } else { // Flash in use, append to flash if (flash.size - flash.pos >= length) { - MEMCPY_NV(flash.data + flash.pos, data, (size_t) length); + MEMCPY_NV(flash.data + flash.pos, data, length); flash.pos += length; } else { return 0; diff --git a/ledger_app.toml b/ledger_app.toml index aaf2b49c..4294d168 100644 --- a/ledger_app.toml +++ b/ledger_app.toml @@ -1,7 +1,7 @@ [app] build_directory = "./" sdk = "C" -devices = ["nanos", "nanos+", "nanox", "stax"] +devices = ["nanos", "nanos+", "nanox", "stax", "flex"] [tests] unit_directory = "./unit-tests/" diff --git a/tests/snapshots/stax/test_arbitrary_transaction_signing_expert/part1/00003.png b/tests/snapshots/stax/test_arbitrary_transaction_signing_expert/part1/00003.png index 259a8bba..241f4c2a 100644 Binary files a/tests/snapshots/stax/test_arbitrary_transaction_signing_expert/part1/00003.png and b/tests/snapshots/stax/test_arbitrary_transaction_signing_expert/part1/00003.png differ diff --git a/tests/snapshots/stax/test_arbitrary_transaction_signing_expert/part2/00003.png b/tests/snapshots/stax/test_arbitrary_transaction_signing_expert/part2/00003.png index 641336b5..5732daee 100644 Binary files a/tests/snapshots/stax/test_arbitrary_transaction_signing_expert/part2/00003.png and b/tests/snapshots/stax/test_arbitrary_transaction_signing_expert/part2/00003.png differ diff --git a/tests/snapshots/stax/test_arbitrary_transaction_signing_expert/part6/00008.png b/tests/snapshots/stax/test_arbitrary_transaction_signing_expert/part6/00008.png index fd74da7b..bd6e24d7 100644 Binary files a/tests/snapshots/stax/test_arbitrary_transaction_signing_expert/part6/00008.png and b/tests/snapshots/stax/test_arbitrary_transaction_signing_expert/part6/00008.png differ diff --git a/tests/snapshots/stax/test_transaction_expert/part1/00002.png b/tests/snapshots/stax/test_transaction_expert/part1/00002.png index d0bdb395..e8c551df 100644 Binary files a/tests/snapshots/stax/test_transaction_expert/part1/00002.png and b/tests/snapshots/stax/test_transaction_expert/part1/00002.png differ diff --git a/tests/snapshots/stax/test_transaction_expert/part2/00002.png b/tests/snapshots/stax/test_transaction_expert/part2/00002.png index d0bdb395..e8c551df 100644 Binary files a/tests/snapshots/stax/test_transaction_expert/part2/00002.png and b/tests/snapshots/stax/test_transaction_expert/part2/00002.png differ diff --git a/tests/snapshots/stax/test_transaction_manifest/FA.03-Mainnet/00002.png b/tests/snapshots/stax/test_transaction_manifest/FA.03-Mainnet/00002.png index d0bdb395..e8c551df 100644 Binary files a/tests/snapshots/stax/test_transaction_manifest/FA.03-Mainnet/00002.png and b/tests/snapshots/stax/test_transaction_manifest/FA.03-Mainnet/00002.png differ diff --git a/tests/snapshots/stax/test_transaction_manifest/FA.03-Testnet/00002.png b/tests/snapshots/stax/test_transaction_manifest/FA.03-Testnet/00002.png index 21636f1d..cf492a38 100644 Binary files a/tests/snapshots/stax/test_transaction_manifest/FA.03-Testnet/00002.png and b/tests/snapshots/stax/test_transaction_manifest/FA.03-Testnet/00002.png differ diff --git a/tests/snapshots/stax/test_transaction_params/part10/00002.png b/tests/snapshots/stax/test_transaction_params/part10/00002.png index d0bdb395..e8c551df 100644 Binary files a/tests/snapshots/stax/test_transaction_params/part10/00002.png and b/tests/snapshots/stax/test_transaction_params/part10/00002.png differ diff --git a/tests/snapshots/stax/test_transaction_params/part11/00002.png b/tests/snapshots/stax/test_transaction_params/part11/00002.png index d0bdb395..e8c551df 100644 Binary files a/tests/snapshots/stax/test_transaction_params/part11/00002.png and b/tests/snapshots/stax/test_transaction_params/part11/00002.png differ diff --git a/tests/snapshots/stax/test_transaction_params/part12/00002.png b/tests/snapshots/stax/test_transaction_params/part12/00002.png index d0bdb395..e8c551df 100644 Binary files a/tests/snapshots/stax/test_transaction_params/part12/00002.png and b/tests/snapshots/stax/test_transaction_params/part12/00002.png differ diff --git a/tests/snapshots/stax/test_transaction_params/part9/00002.png b/tests/snapshots/stax/test_transaction_params/part9/00002.png index d0bdb395..e8c551df 100644 Binary files a/tests/snapshots/stax/test_transaction_params/part9/00002.png and b/tests/snapshots/stax/test_transaction_params/part9/00002.png differ diff --git a/tests/usage.md b/tests/usage.md index 4e92bd3e..edcd290e 100644 --- a/tests/usage.md +++ b/tests/usage.md @@ -21,7 +21,7 @@ docker pull ghcr.io/ledgerhq/ledger-app-builder/ledger-app-builder-lite:latest cd docker run --user "$(id -u)":"$(id -g)" --rm -ti -v "$(realpath .):/app" --privileged -v "/dev/bus/usb:/dev/bus/usb" ledger-app-builder-lite:latest -make clean && make BOLOS_SDK=$_SDK # replace with one of [NANOS, NANOX, NANOSP, STAX] +make clean && make BOLOS_SDK=$_SDK # replace with one of [NANOS, NANOX, NANOSP, STAX, FLEX] exit ``` @@ -45,7 +45,7 @@ docker pull ghcr.io/ledgerhq/ledger-app-builder/ledger-app-builder-lite:latest cd app-/ docker run --user "$(id -u)":"$(id -g)" --rm -ti -v "$(realpath .):/app" --privileged -v "/dev/bus/usb:/dev/bus/usb" ledger-app-builder-lite:latest -make clean && make BOLOS_SDK=$_SDK load # replace with one of [NANOS, NANOX, NANOSP, STAX] +make clean && make BOLOS_SDK=$_SDK load # replace with one of [NANOS, NANOX, NANOSP, STAX, FLEX] exit ``` @@ -72,7 +72,7 @@ Standard useful pytest options Custom pytest options ``` console - --device run the test on the specified device [nanos,nanox,nanosp,stax,all]. This parameter is mandatory + --device run the test on the specified device [nanos,nanox,nanosp,stax,flexall]. This parameter is mandatory --backend run the tests against the backend [speculos, ledgercomm, ledgerwallet]. Speculos is the default --display on Speculos, enables the display of the app screen using QT --golden_run on Speculos, screen comparison functions will save the current screen instead of comparing