Skip to content

Commit

Permalink
Merge pull request #7 from trilitech/main
Browse files Browse the repository at this point in the history
Flex upgrade
  • Loading branch information
agrojean-ledger authored Aug 1, 2024
2 parents c75553d + 953b699 commit 6e4b8ef
Show file tree
Hide file tree
Showing 721 changed files with 1,213 additions and 1,248 deletions.
40 changes: 20 additions & 20 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
name: Build application
strategy:
matrix:
device: [nanos, nanosp, nanox, stax]
device: [nanos, nanosp, nanox, stax, flex]
runs-on: ubuntu-latest
container:
image: ghcr.io/ledgerhq/ledger-app-builder/ledger-app-dev-tools:latest
Expand All @@ -33,12 +33,12 @@ jobs:
bash -c "make -C app BOLOS_SDK=\$${DEVICE_SDK} DEBUG=1"
tar -C app/bin -czf app_${{ matrix.device }}_dbg.tgz .
- name: Upload
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
path: app_${{ matrix.device }}.tgz
name: app_${{ matrix.device }}.tgz
- name: Upload (dbg)
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
path: app_${{ matrix.device }}_dbg.tgz
name: app_${{ matrix.device }}_dbg.tgz
Expand All @@ -58,7 +58,7 @@ jobs:
strategy:
fail-fast: false
matrix:
device: [nanos, nanosp, nanox, stax]
device: [nanos, nanosp, nanox, stax, flex]
container:
image: ghcr.io/ledgerhq/ledger-app-builder/ledger-app-dev-tools:latest

Expand All @@ -71,20 +71,20 @@ jobs:
uses: actions/checkout@v3

- name: Download app
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: app_${{ matrix.device }}.tgz

- name: Download app (dbg)
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: app_${{ matrix.device }}_dbg.tgz

- name: Run test
run: |
if [ "${{ matrix.device }}" = "stax" ]; then
if [ "${{ matrix.device }}" = "stax" ] || [ "${{ matrix.device }}" = "flex" ]; then
./tests/integration/run_test_local.sh -F -m ${{ matrix.device }} \
./tests/integration/${{ matrix.device }}
./tests/integration/touch
else
apk add gmp-dev curl jq libsodium-dev git xxd procps
python3 -m venv tezos_test_env --system-site-package
Expand All @@ -98,15 +98,15 @@ jobs:
fi
- name: Upload Stax results
uses: actions/upload-artifact@v3
if: always() && matrix.device == 'stax'
uses: actions/upload-artifact@v4
if: always() && (matrix.device == 'stax' || matrix.device == 'flex')
with:
name: integration_tests_${{ matrix.device }}.json
path: ./integration_tests.json

- name: Upload Nano results
uses: actions/upload-artifact@v3
if: always() && matrix.device != 'stax'
uses: actions/upload-artifact@v4
if: always() && (matrix.device != 'stax' && matrix.device != 'flex')
with:
name: integration_tests_log_${{ matrix.device }}
path: ./integration_tests_log
Expand Down Expand Up @@ -134,9 +134,9 @@ jobs:
export PATH=/home/opam/.opam/4.14/bin:$PATH
cp ./app/src/parser/[!g]*.[ch] ./tests/unit/parser
dune exec ./tests/generate/generate.exe micheline 500 \
dune exec ./tests/generate/generate.exe micheline 50 \
nano tests/samples/micheline
dune exec ./tests/generate/generate.exe operations 500 \
dune exec ./tests/generate/generate.exe operations 50 \
nano tests/samples/operations
- name: Unit tests
Expand All @@ -146,13 +146,13 @@ jobs:
make -C tests/unit
- name: Upload results (nano, micheline)
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: nano_samples_micheline
path: tests/samples/micheline/nano

- name: Upload results (nano, operations)
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: nano_samples_operations
path: tests/samples/operations/nano
Expand All @@ -172,17 +172,17 @@ jobs:
uses: actions/checkout@v3

- name: Download app
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: app_${{ matrix.device }}.tgz

- name: Download app (dbg)
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: app_${{ matrix.device }}_dbg.tgz

- name: Download samples
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: nano_samples_${{ matrix.type }}
path: tests
Expand All @@ -196,7 +196,7 @@ jobs:
./tests/integration/run_test_local.sh -T100 -F -m ${{ matrix.device }} tests
- name: Upload results
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if: always()
with:
name: integration_tests_${{ matrix.type}}_${{ matrix.device }}.json
Expand Down
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
30 changes: 23 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,16 @@
# Makefile
#

all: app_nanos.tgz app_nanosp.tgz app_nanox.tgz
debug: app_nanos_dbg.tgz app_nanosp_dbg.tgz app_nanox_dbg.tgz
all: app_nanos.tgz \
app_nanosp.tgz \
app_nanox.tgz \
app_stax.tgz \
app_flex.tgz
debug: app_nanos_dbg.tgz \
app_nanosp_dbg.tgz \
app_nanox_dbg.tgz \
app_stax_dbg.tgz \
app_flex_dbg.tgz

.PHONY: clean all debug format integration_tests unit_tests scan-build% \
integration_tests_basic integration_tests_basic_% docker_%
Expand Down Expand Up @@ -49,7 +57,7 @@ scan-build-%:
"BOLOS_SDK=\$$$$SDK make -C app scan-build"

scan-build: scan-build-nanos scan-build-nanosp \
scan-build-nanox scan-build-stax
scan-build-nanox scan-build-stax scan-build-flex

app_%_dbg.tgz: app/src/*.[ch] \
app/src/parser/*.[ch] \
Expand Down Expand Up @@ -92,8 +100,14 @@ RUN_TEST_DOCKER = ./tests/integration/run_test_docker.sh
integration_tests_basic_stax: app_stax.tgz \
app_stax_dbg.tgz \
tests/integration/* \
tests/integration/stax/*
$(RUN_TEST_DOCKER) stax tests/integration/stax
tests/integration/touch/*
$(RUN_TEST_DOCKER) stax tests/integration/touch

integration_tests_basic_flex: app_flex.tgz \
app_flex_dbg.tgz \
tests/integration/* \
tests/integration/touch/*
$(RUN_TEST_DOCKER) flex tests/integration/touch

integration_tests_basic_%: app_%.tgz \
app_%_dbg.tgz \
Expand All @@ -116,7 +130,8 @@ integration_tests_basic_%: app_%.tgz \
integration_tests_basic: integration_tests_basic_nanos \
integration_tests_basic_nanosp \
integration_tests_basic_nanox \
integration_tests_basic_stax
integration_tests_basic_stax \
integration_tests_basic_flex

integration_tests_%: integration_tests_basic_% \
test/samples/operations/nano/samples.hex\
Expand All @@ -130,7 +145,8 @@ integration_tests: tests/integration/*.sh \
integration_tests_nanos \
integration_tests_nanosp \
integration_tests_nanox \
integration_tests_basic_stax
integration_tests_basic_stax \
integration_tests_basic_flex

test/samples/micheline/%/samples.hex: tests/generate/*.ml* \
tests/generate/dune \
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ Both of these commands take the following arguments:
-x
: executes the tests with shell tracing (-x)

Basic tests rely on gold-images, rather than OCR. They are stored under [nano/snapshots](./tests/integration/nano/snapshots) and [stax/snapshots](./tests/integration/stax/snapshots).
Basic tests rely on gold-images, rather than OCR. They are stored under [nano/snapshots](./tests/integration/nano/snapshots) and [touch/snapshots](./tests/integration/touch/snapshots).

To generate/reset the snapshots, you can do so for individual tests.

Expand Down Expand Up @@ -171,7 +171,7 @@ You will be requested to press enter to take snapshots in term.
**NB** make sure that the screen has updated to the screen you want to snapshot each time. It's also a good idea to
re-run the test normally afterwards, to ensure the snapshots have been set correctly.

### STAX
### STAX/FLEX

#### Preparation

Expand All @@ -196,15 +196,15 @@ $ docker exec -it ledger-app-tezos-integration-tests bash;
You can run an individual test from the test container. You should see the app progress on the display.

```sh
./tests/integration/stax/<test_name>.py
./tests/integration/touch/<test_name>.py
```

#### Setting goldimages

You can reset/set goldimages using the following:

```sh
GOLDEN=1 ./tests/integration/stax/<test_name>.py
GOLDEN=1 ./tests/integration/touch/<test_name>.py
```

If you are resetting goldimages for multiple tests, you can also use `export NOQUIT=1` to keep the app
Expand Down Expand Up @@ -264,4 +264,4 @@ with a new version
1. app/Makefile
2. tests/integration/app_vars.sh
3. tests/integration/nano/utils/app.py
4. the snapshots (nano and stax)
4. the snapshots (nano and touch)
3 changes: 2 additions & 1 deletion app/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ APPNAME = "Tezos Wallet"
# Application version
APPVERSION_M=3
APPVERSION_N=0
APPVERSION_P=3
APPVERSION_P=4
APPVERSION=$(APPVERSION_M).$(APPVERSION_N).$(APPVERSION_P)

# COMMIT
Expand Down Expand Up @@ -77,6 +77,7 @@ ICON_NANOS = icons/nano-s-tezos.gif
ICON_NANOX = icons/nano-x-tezos.gif
ICON_NANOSP = icons/nano-x-tezos.gif
ICON_STAX = icons/stax_tezos.gif
ICON_FLEX = icons/flex_tezos.gif

# Application allowed derivation curves.
# Possibles curves are: secp256k1, secp256r1, ed25519 and bls12381g1
Expand Down
Binary file removed app/glyphs/icon_go_cross.gif
Binary file not shown.
Binary file removed app/glyphs/icon_go_dots.gif
Binary file not shown.
Binary file added app/icons/flex_tezos.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
46 changes: 18 additions & 28 deletions app/src/apdu_pubkey.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ prompt_address(void)
TZ_UI_LAYOUT_HOME_PB, TZ_UI_ICON_EYE);
#endif
tz_ui_stream_push_all(TZ_UI_STREAM_CB_NOCB, "Address", buf,
TZ_UI_LAYOUT_BNP, TZ_UI_ICON_NONE);
TZ_UI_LAYOUT_BN, TZ_UI_ICON_NONE);
tz_ui_stream_push(TZ_UI_STREAM_CB_ACCEPT, "Approve", "",
TZ_UI_LAYOUT_HOME_PB, TZ_UI_ICON_TICK);
tz_ui_stream_push(TZ_UI_STREAM_CB_REJECT, "Reject", "",
Expand All @@ -117,52 +117,42 @@ prompt_address(void)
#include "nbgl_use_case.h"

static void
cancel_callback(void)
{
stream_cb(TZ_UI_STREAM_CB_REJECT);
global.step = ST_IDLE;
nbgl_useCaseStatus("Address rejected", false, ui_home_init);
}

static void
approve_callback(void)
confirmation_callback(bool confirm)
{
stream_cb(TZ_UI_STREAM_CB_ACCEPT);
nbgl_useCaseStatus("ADDRESS\nVERIFIED", true, ui_home_init);
if (confirm) {
stream_cb(TZ_UI_STREAM_CB_ACCEPT);
} else {
stream_cb(TZ_UI_STREAM_CB_REJECT);
global.step = ST_IDLE;
}
}

static void
confirmation_callback(bool confirm)
review_choice(bool confirm)
{
// Answer, display a status page and go back to main
confirmation_callback(confirm);
if (confirm) {
approve_callback();
nbgl_useCaseReviewStatus(STATUS_TYPE_ADDRESS_VERIFIED, ui_home_init);
} else {
cancel_callback();
nbgl_useCaseReviewStatus(STATUS_TYPE_ADDRESS_REJECTED, ui_home_init);
}
}

static void
verify_address(void)
prompt_address(void)
{
TZ_PREAMBLE(("void"));

global.step = ST_PROMPT;
TZ_CHECK(format_pkh(&global.keys.pubkey, global.stream.verify_address,
sizeof(global.stream.verify_address)));
nbgl_useCaseAddressConfirmation(global.stream.verify_address,
confirmation_callback);
TZ_POSTAMBLE;
}

static void
prompt_address(void)
{
TZ_PREAMBLE(("void"));
nbgl_useCaseAddressReview(global.stream.verify_address, NULL, &C_tezos,
"Verify Tezos\naddress", NULL, review_choice);

global.step = ST_PROMPT;
nbgl_useCaseReviewStart(&C_tezos, "Verify Tezos\naddress", NULL, "Cancel",
verify_address, cancel_callback);
TZ_POSTAMBLE;
}

#endif

void
Expand Down
Loading

0 comments on commit 6e4b8ef

Please sign in to comment.