Skip to content

Commit

Permalink
Add Flex support (#114)
Browse files Browse the repository at this point in the history
* feat: add flex support WIP

* feat: update zxlib

* feat: update stax sdk

* feat: add flex support

* fix: use REVIEW_GENERIC for key review

* feat: update workflows

* feat: remove stax sdk as it is not required now

* bump app version

* remove flag

* fix flex icon

* add flex script build to github CI

* feat: update snapshots
  • Loading branch information
emmanuelm41 authored Jul 30, 2024
1 parent ce348bb commit b138315
Show file tree
Hide file tree
Showing 419 changed files with 58 additions and 26 deletions.
41 changes: 38 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ jobs:
- name: Build NanoS
shell: bash -l {0}
run: |
make
PRODUCTION_BUILD=0 make
mv ./app/pkg/installer_s.sh ./app/pkg/installer_nanos.sh
- name: Set tag
id: nanos
Expand Down Expand Up @@ -182,7 +182,7 @@ jobs:
- name: Build NanoSP
shell: bash -l {0}
run: |
make
PRODUCTION_BUILD=0 make
mv ./app/pkg/installer_s2.sh ./app/pkg/installer_nanos_plus.sh
- name: Set tag
id: nanosp
Expand Down Expand Up @@ -217,7 +217,7 @@ jobs:
- name: Build Stax
shell: bash -l {0}
run: |
make
PRODUCTION_BUILD=0 make
- name: Set tag
id: stax
run: echo "tag_name=$(./app/pkg/installer_stax.sh version)" >> $GITHUB_OUTPUT
Expand All @@ -232,3 +232,38 @@ jobs:
tag_name: ${{ steps.stax.outputs.tag_name }}
draft: false
prerelease: false

build_package_flex:
needs: [configure, build, build_ledger, test_zemu]
if: ${{ github.ref == 'refs/heads/main' }}
runs-on: ${{ github.repository_owner == 'zondax' && 'zondax-runners' || 'ubuntu-latest' }}
container:
image: zondax/ledger-app-builder:latest
options: --user ${{ needs.configure.outputs.uid_gid }}
env:
BOLOS_SDK: /opt/flex-secure-sdk
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: true
- name: Install deps
run: pip install ledgerblue
- name: Build Flex
shell: bash -l {0}
run: |
PRODUCTION_BUILD=0 make
- name: Set tag
id: flex
run: echo "tag_name=$(./app/pkg/installer_flex.sh version)" >> $GITHUB_OUTPUT
- name: Update Release
id: update_release_2
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
files: |
./app/pkg/installer_flex.sh
tag_name: ${{ steps.flex.outputs.tag_name }}
draft: false
prerelease: false
5 changes: 1 addition & 4 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,4 @@
url = https://github.com/zondax/ledger-zxlib
[submodule "deps/blake2"]
path = deps/blake2
url = https://github.com/Zondax/BLAKE2.git
[submodule "deps/stax-secure-sdk"]
path = deps/stax-secure-sdk
url = https://github.com/LedgerHQ/ledger-secure-sdk
url = https://github.com/Zondax/BLAKE2.git
9 changes: 4 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ ifeq ($(BOLOS_SDK),)
# In this case, there is not predefined SDK and we run dockerized
# When not using the SDK, we override and build the XL complete app

ZXLIB_COMPILE_STAX ?= 1
PRODUCTION_BUILD ?= 0
PRODUCTION_BUILD ?= 1
include $(CURDIR)/deps/ledger-zxlib/dockerized_build.mk

else
Expand All @@ -38,8 +37,8 @@ default:
endif


prod:
PRODUCTION_BUILD=1 make
build_all:
APP_TESTING=1 PRODUCTION_BUILD=1 make

zcashtools_build:
cd zcashtools/neon && yarn install
Expand All @@ -52,7 +51,7 @@ zcashtools_test_rs: zcashtools_build

zemu_install: zcashtools_build

test_all: prod
test_all: build_all
make zemu_install
make zcashtools_test
make zcashtools_test_rs
Expand Down
4 changes: 2 additions & 2 deletions app/Makefile.version
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This is the major version
APPVERSION_M=4
# This is the minor version
APPVERSION_N=0
APPVERSION_N=1
# This is the patch version
APPVERSION_P=1
APPVERSION_P=0
Binary file added app/flex_icon.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion app/src/c_api/rust.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include <inttypes.h>
#include <stddef.h>

#if defined(TARGET_NANOS) || defined(TARGET_NANOX) || defined(TARGET_NANOS2) || defined(TARGET_STAX)
#if defined(TARGET_NANOS) || defined(TARGET_NANOX) || defined(TARGET_NANOS2) || defined(TARGET_STAX) || defined(TARGET_FLEX)
#include "lcx_rng.h"
unsigned char *bolos_cx_rng(uint8_t *buffer, size_t len) {
cx_rng_no_throw(buffer, len);
Expand Down
2 changes: 1 addition & 1 deletion app/src/common/tx.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ typedef struct {
uint8_t buffer[FLASH_BUFFER_SIZE];
} storage_t;

#if defined(TARGET_NANOS) || defined(TARGET_NANOX) || defined(TARGET_NANOS2) || defined(TARGET_STAX)
#if defined(TARGET_NANOS) || defined(TARGET_NANOX) || defined(TARGET_NANOS2) || defined(TARGET_STAX) || defined(TARGET_FLEX)
storage_t NV_CONST N_appdata_impl __attribute__((aligned(64)));
#define N_appdata (*(NV_VOLATILE storage_t *)PIC(&N_appdata_impl))
#endif
Expand Down
2 changes: 1 addition & 1 deletion app/src/common/tx.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include "os.h"
#include "zxerror.h"

#if defined(TARGET_NANOX) || defined(TARGET_NANOS2) || defined(TARGET_STAX)
#if defined(TARGET_NANOX) || defined(TARGET_NANOS2) || defined(TARGET_STAX) || defined(TARGET_FLEX)
#define RAM_BUFFER_SIZE 8192
#define FLASH_BUFFER_SIZE 16384
#elif defined(TARGET_NANOS)
Expand Down
8 changes: 4 additions & 4 deletions app/src/handlers/handler_keys.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ __Z_INLINE void handleGetKeyIVK(volatile uint32_t *flags, volatile uint32_t *tx,
key_state.len = (uint8_t)replyLen;

view_review_init(key_getItem, key_getNumItems, app_reply_key);
view_review_show(REVIEW_KEYS);
view_review_show(REVIEW_GENERIC);
*flags |= IO_ASYNCH_REPLY;
}

Expand Down Expand Up @@ -90,7 +90,7 @@ __Z_INLINE void handleGetKeyOVK(volatile uint32_t *flags, volatile uint32_t *tx,
key_state.len = (uint8_t)replyLen;

view_review_init(key_getItem, key_getNumItems, app_reply_key);
view_review_show(REVIEW_KEYS);
view_review_show(REVIEW_GENERIC);
*flags |= IO_ASYNCH_REPLY;
}

Expand Down Expand Up @@ -120,7 +120,7 @@ __Z_INLINE void handleGetKeyFVK(volatile uint32_t *flags, volatile uint32_t *tx,
key_state.len = (uint8_t)replyLen;

view_review_init(key_getItem, key_getNumItems, app_reply_key);
view_review_show(REVIEW_KEYS);
view_review_show(REVIEW_GENERIC);
*flags |= IO_ASYNCH_REPLY;
}

Expand Down Expand Up @@ -165,7 +165,7 @@ __Z_INLINE void handleGetNullifier(volatile uint32_t *flags, volatile uint32_t *
key_state.len = (uint8_t)replyLen;

view_review_init(key_getItem, key_getNumItems, app_reply_key);
view_review_show(REVIEW_KEYS);
view_review_show(REVIEW_GENERIC);
*flags |= IO_ASYNCH_REPLY;
}

Expand Down
2 changes: 1 addition & 1 deletion app/src/parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ typedef struct {
} parser_sapling_t;

void view_tx_state() {
#if !defined(TARGET_STAX)
#if !defined(TARGET_STAX) && !defined(TARGET_FLEX)
uint8_t state = get_state();
switch (state) {
case STATE_PROCESSED_INPUTS:
Expand Down
1 change: 0 additions & 1 deletion deps/stax-secure-sdk
Submodule stax-secure-sdk deleted from 3e726e
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 = "./app/"
sdk = "C"
devices = ["nanos", "nanox", "nanos+", "stax"]
devices = ["nanos", "nanox", "nanos+", "stax", "flex"]

[tests]
unit_directory = "./tests/"
2 changes: 1 addition & 1 deletion tests_zemu/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"@zondax/ledger-js": "^0.10.0",
"@zondax/ledger-zcash": "link:../js",
"@zondax/zcashtools": "link:../zcashtools/neon",
"@zondax/zemu": "^0.49.0"
"@zondax/zemu": "^0.50.2"
},
"devDependencies": {
"@ledgerhq/hw-transport-node-hid": "^6.29.1",
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.
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.
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.
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.
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.
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.
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.
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 added tests_zemu/snapshots/fl-2-spend-2-out/00000.png
Binary file added tests_zemu/snapshots/fl-2-spend-2-out/00001.png
Binary file added tests_zemu/snapshots/fl-2-spend-2-out/00002.png
Binary file added tests_zemu/snapshots/fl-2-spend-2-out/00003.png
Binary file added tests_zemu/snapshots/fl-2-spend-2-out/00004.png
Binary file added tests_zemu/snapshots/fl-2-spend-2-out/00005.png
Binary file added tests_zemu/snapshots/fl-2-spend-2-out/00006.png
Binary file added tests_zemu/snapshots/fl-get-fvk/00000.png
Binary file added tests_zemu/snapshots/fl-get-fvk/00001.png
Binary file added tests_zemu/snapshots/fl-get-fvk/00002.png
Binary file added tests_zemu/snapshots/fl-get-ivk/00000.png
Binary file added tests_zemu/snapshots/fl-get-ivk/00001.png
Binary file added tests_zemu/snapshots/fl-get-ivk/00002.png
Binary file added tests_zemu/snapshots/fl-get-ovk/00000.png
Binary file added tests_zemu/snapshots/fl-get-ovk/00001.png
Binary file added tests_zemu/snapshots/fl-get-ovk/00002.png
Binary file added tests_zemu/snapshots/fl-mainmenu/00000.png
Binary file added tests_zemu/snapshots/fl-mainmenu/00001.png
Binary file added tests_zemu/snapshots/fl-mainmenu/00002.png
Binary file added tests_zemu/snapshots/fl-mainmenu/00003.png
Binary file added tests_zemu/snapshots/fl-mainmenu/00004.png
Binary file added tests_zemu/snapshots/fl-mainmenu/00005.png
Binary file added tests_zemu/snapshots/fl-mainmenu/00006.png
Binary file added tests_zemu/snapshots/fl-txinit/00000.png
Binary file added tests_zemu/snapshots/fl-txinit/00001.png
Binary file added tests_zemu/snapshots/fl-txinit/00002.png
Binary file added tests_zemu/snapshots/fl-txinit/00003.png
Binary file added tests_zemu/snapshots/fl-txinit/00004.png
Binary file added tests_zemu/snapshots/fl-txinit/00005.png
Binary file added tests_zemu/snapshots/fl-txinit/00006.png
Binary file added tests_zemu/snapshots/fl-txinit/00007.png
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Binary file removed tests_zemu/snapshots/s-get-nullifier/00000.png
Diff not rendered.
Binary file removed tests_zemu/snapshots/s-get-nullifier/00001.png
Diff not rendered.
Binary file removed tests_zemu/snapshots/s-get-nullifier/00002.png
Diff not rendered.
Binary file removed tests_zemu/snapshots/s-get-nullifier/00003.png
Diff not rendered.
Binary file modified tests_zemu/snapshots/s-mainmenu/00004.png
Binary file modified tests_zemu/snapshots/s-mainmenu/00010.png
Binary file removed tests_zemu/snapshots/s-show-shielded-addr/00000.png
Diff not rendered.
Binary file removed tests_zemu/snapshots/s-show-shielded-addr/00001.png
Diff not rendered.
Binary file removed tests_zemu/snapshots/s-show-shielded-addr/00002.png
Diff not rendered.
Binary file removed tests_zemu/snapshots/s-show-shielded-addr/00003.png
Diff not rendered.
Binary file removed tests_zemu/snapshots/s-show-shielded-addr/00004.png
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Binary file removed tests_zemu/snapshots/sp-get-nullifier/00000.png
Diff not rendered.
Binary file removed tests_zemu/snapshots/sp-get-nullifier/00001.png
Diff not rendered.
Binary file removed tests_zemu/snapshots/sp-get-nullifier/00002.png
Diff not rendered.
Binary file removed tests_zemu/snapshots/sp-get-nullifier/00003.png
Diff not rendered.
Binary file removed tests_zemu/snapshots/sp-get-nullifier/00004.png
Diff not rendered.
Binary file modified tests_zemu/snapshots/sp-mainmenu/00004.png
Binary file modified tests_zemu/snapshots/sp-mainmenu/00010.png
Binary file removed tests_zemu/snapshots/sp-show-shielded-addr/00000.png
Diff not rendered.
Binary file removed tests_zemu/snapshots/sp-show-shielded-addr/00001.png
Diff not rendered.
Binary file removed tests_zemu/snapshots/sp-show-shielded-addr/00002.png
Diff not rendered.
Binary file removed tests_zemu/snapshots/sp-show-shielded-addr/00003.png
Diff not rendered.
Binary file removed tests_zemu/snapshots/sp-show-shielded-addr/00004.png
Diff not rendered.
Binary file modified tests_zemu/snapshots/st-1-tr-in-1-spend-2-sh-out/00000.png
Binary file modified tests_zemu/snapshots/st-1-tr-in-1-spend-2-sh-out/00001.png
Binary file modified tests_zemu/snapshots/st-1-tr-in-1-spend-2-sh-out/00002.png
Binary file modified tests_zemu/snapshots/st-1-tr-in-1-spend-2-sh-out/00003.png
Binary file modified tests_zemu/snapshots/st-1-tr-in-1-spend-2-sh-out/00004.png
Binary file modified tests_zemu/snapshots/st-1-tr-in-1-spend-2-sh-out/00005.png
Binary file modified tests_zemu/snapshots/st-1-tr-in-1-spend-2-sh-out/00006.png
Diff not rendered.
Diff not rendered.
Binary file modified tests_zemu/snapshots/st-1-tr-in-1-tr-out-1-spend-2-sh-out/00000.png
Binary file modified tests_zemu/snapshots/st-1-tr-in-1-tr-out-1-spend-2-sh-out/00001.png
Diff not rendered.
Binary file modified tests_zemu/snapshots/st-1-tr-out-1-spend-2-sh-out/00000.png
Binary file modified tests_zemu/snapshots/st-1-tr-out-1-spend-2-sh-out/00001.png
Binary file modified tests_zemu/snapshots/st-1-tr-out-1-spend-2-sh-out/00002.png
Binary file modified tests_zemu/snapshots/st-1-tr-out-1-spend-2-sh-out/00003.png
Binary file modified tests_zemu/snapshots/st-1-tr-out-1-spend-2-sh-out/00004.png
Binary file modified tests_zemu/snapshots/st-1-tr-out-1-spend-2-sh-out/00005.png
Binary file modified tests_zemu/snapshots/st-1-tr-out-1-spend-2-sh-out/00006.png
Diff not rendered.
Diff not rendered.
Binary file modified tests_zemu/snapshots/st-2-spend-2-out/00000.png
Binary file modified tests_zemu/snapshots/st-2-spend-2-out/00001.png
Binary file modified tests_zemu/snapshots/st-2-spend-2-out/00002.png
Binary file modified tests_zemu/snapshots/st-2-spend-2-out/00003.png
Binary file modified tests_zemu/snapshots/st-2-spend-2-out/00004.png
Binary file modified tests_zemu/snapshots/st-2-spend-2-out/00005.png
Binary file modified tests_zemu/snapshots/st-2-spend-2-out/00006.png
Binary file modified tests_zemu/snapshots/st-2-spend-2-out/00007.png
Binary file removed tests_zemu/snapshots/st-2-spend-2-out/00008.png
Diff not rendered.
Binary file modified tests_zemu/snapshots/st-2-tr-in-2-tr-out/00000.png
Binary file modified tests_zemu/snapshots/st-2-tr-in-2-tr-out/00001.png
Binary file modified tests_zemu/snapshots/st-2-tr-in-2-tr-out/00002.png
Binary file modified tests_zemu/snapshots/st-2-tr-in-2-tr-out/00003.png
Binary file modified tests_zemu/snapshots/st-2-tr-in-2-tr-out/00004.png
Binary file removed tests_zemu/snapshots/st-2-tr-in-2-tr-out/00005.png
Diff not rendered.
Binary file modified tests_zemu/snapshots/st-builder-addr-diff-to-inittx-addr/00000.png
Binary file modified tests_zemu/snapshots/st-builder-addr-diff-to-inittx-addr/00001.png
Binary file modified tests_zemu/snapshots/st-builder-addr-diff-to-inittx-addr/00002.png
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Binary file modified tests_zemu/snapshots/st-ext-more-sigs-than-needed-for-tx/00000.png
Loading

0 comments on commit b138315

Please sign in to comment.