Skip to content

Commit

Permalink
Update zxlib and fix typos
Browse files Browse the repository at this point in the history
Fixes an issue on stax on screens containing 6 entries.
  • Loading branch information
relatko committed Sep 23, 2024
1 parent 888a39a commit 833d406
Show file tree
Hide file tree
Showing 20 changed files with 23 additions and 22 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/codeql_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
```
Expand Down Expand Up @@ -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
```
Expand Down
4 changes: 2 additions & 2 deletions deps/README.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
2 changes: 1 addition & 1 deletion deps/ledger-zxlib/app/ui/view_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
10 changes: 5 additions & 5 deletions deps/ledger-zxlib/include/buffering.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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();
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion deps/ledger-zxlib/include/zxversion.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@

#define ZXLIB_MAJOR 28
#define ZXLIB_MINOR 0
#define ZXLIB_PATCH 5
#define ZXLIB_PATCH 7
10 changes: 5 additions & 5 deletions deps/ledger-zxlib/src/buffering.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion ledger_app.toml
Original file line number Diff line number Diff line change
@@ -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/"
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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_transaction_expert/part1/00002.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_transaction_expert/part2/00002.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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_transaction_params/part10/00002.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_transaction_params/part11/00002.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_transaction_params/part12/00002.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_transaction_params/part9/00002.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions tests/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ docker pull ghcr.io/ledgerhq/ledger-app-builder/ledger-app-builder-lite:latest
cd <your app repository>

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=$<device>_SDK # replace <device> with one of [NANOS, NANOX, NANOSP, STAX]
make clean && make BOLOS_SDK=$<device>_SDK # replace <device> with one of [NANOS, NANOX, NANOSP, STAX, FLEX]
exit
```

Expand All @@ -45,7 +45,7 @@ docker pull ghcr.io/ledgerhq/ledger-app-builder/ledger-app-builder-lite:latest
cd app-<appname>/

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=$<device>_SDK load # replace <device> with one of [NANOS, NANOX, NANOSP, STAX]
make clean && make BOLOS_SDK=$<device>_SDK load # replace <device> with one of [NANOS, NANOX, NANOSP, STAX, FLEX]
exit
```

Expand All @@ -72,7 +72,7 @@ Standard useful pytest options
Custom pytest options

``` console
--device <device> run the test on the specified device [nanos,nanox,nanosp,stax,all]. This parameter is mandatory
--device <device> run the test on the specified device [nanos,nanox,nanosp,stax,flexall]. This parameter is mandatory
--backend <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
Expand Down

0 comments on commit 833d406

Please sign in to comment.