Skip to content

Commit

Permalink
Merge pull request #26 from Zondax/flex-porting
Browse files Browse the repository at this point in the history
flex support
  • Loading branch information
0xPxt authored Sep 17, 2024
2 parents 820f948 + 4968836 commit 3a15558
Show file tree
Hide file tree
Showing 138 changed files with 230 additions and 207 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
if: github.event.repository.private == false
strategy:
matrix:
sdk: ["$NANOS_SDK", "$NANOX_SDK", "$NANOSP_SDK", "$STAX_SDK"]
sdk: ["$NANOS_SDK", "$NANOX_SDK", "$NANOSP_SDK", "$STAX_SDK", "$FLEX_SDK"]
runs-on: ubuntu-latest
container:
image: ghcr.io/ledgerhq/ledger-app-builder/ledger-app-builder-legacy:latest
Expand Down
34 changes: 34 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -268,3 +268,37 @@ 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: 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: make SUBSTRATE_PARSER_FULL=1 PRODUCTION_BUILD=0
- 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
15 changes: 3 additions & 12 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,21 +1,12 @@
[submodule "deps/nanos-secure-sdk"]
path = deps/nanos-secure-sdk
url = https://github.com/LedgerHQ/nanos-secure-sdk.git
[submodule "deps/BLAKE2"]
path = deps/BLAKE2
url = https://github.com/BLAKE2/BLAKE2
[submodule "cmake/cmake-modules"]
path = cmake/cmake-modules
url = https://github.com/bilke/cmake-modules.git
[submodule "deps/nanox-secure-sdk"]
path = deps/nanox-secure-sdk
url = https://github.com/LedgerHQ/ledger-secure-sdk.git
[submodule "deps/nanosplus-secure-sdk"]
path = deps/nanosplus-secure-sdk
url = https://github.com/LedgerHQ/ledger-secure-sdk.git
[submodule "deps/ledger-zxlib"]
path = deps/ledger-zxlib
url = https://github.com/Zondax/ledger-zxlib.git
[submodule "deps/stax-secure-sdk"]
path = deps/stax-secure-sdk
url = https://github.com/LedgerHQ/ledger-secure-sdk.git
[submodule "deps/ledger-secure-sdk"]
path = deps/ledger-secure-sdk
url = https://github.com/LedgerHQ/ledger-secure-sdk
358 changes: 179 additions & 179 deletions README.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion app/Makefile.version
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ APPVERSION_M=18
# This is the `spec_version` field of `Runtime`
APPVERSION_N=73
# This is the patch version of this release
APPVERSION_P=2
APPVERSION_P=3
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.
4 changes: 2 additions & 2 deletions app/src/common/tx.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include "zxformat.h"
#include "zxmacros.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 All @@ -39,7 +39,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/crypto_helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#include "crypto_helper.h"
#include "base58.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 "cx.h"

cx_err_t ss58hash(const unsigned char *in, unsigned int inLen,
Expand Down
2 changes: 1 addition & 1 deletion app/src/parser_txdef.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ extern "C" {
#include <stddef.h>
#include "substrate_methods.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 MAX_CALL_NESTING_SIZE 6
#define MAX_CALL_VEC_SIZE 6
#else
Expand Down
1 change: 0 additions & 1 deletion deps/nanos-secure-sdk
Submodule nanos-secure-sdk deleted from b9fa0e
1 change: 0 additions & 1 deletion deps/nanosplus-secure-sdk
Submodule nanosplus-secure-sdk deleted from 3054e6
1 change: 0 additions & 1 deletion deps/nanox-secure-sdk
Submodule nanox-secure-sdk deleted from 3054e6
1 change: 0 additions & 1 deletion deps/stax-secure-sdk
Submodule stax-secure-sdk deleted from 3054e6
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 @@ -19,7 +19,7 @@
},
"dependencies": {
"@zondax/ledger-substrate": "^0.44.2",
"@zondax/zemu": "^0.49.0"
"@zondax/zemu": "^0.50.2"
},
"devDependencies": {
"@types/jest": "^29.5.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.
Binary file added tests_zemu/snapshots/fl-mainmenu/00000.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 added tests_zemu/snapshots/fl-mainmenu/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 added tests_zemu/snapshots/fl-mainmenu/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 added tests_zemu/snapshots/fl-mainmenu/00003.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 added tests_zemu/snapshots/fl-mainmenu/00004.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 added tests_zemu/snapshots/fl-mainmenu/00005.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 added tests_zemu/snapshots/fl-mainmenu/00006.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 added tests_zemu/snapshots/fl-proxy_proxy/00000.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 added tests_zemu/snapshots/fl-proxy_proxy/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 added tests_zemu/snapshots/fl-proxy_proxy/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 added tests_zemu/snapshots/fl-proxy_proxy/00003.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 added tests_zemu/snapshots/fl-proxy_proxy/00004.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 added tests_zemu/snapshots/fl-proxy_proxy/00005.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 added tests_zemu/snapshots/fl-raw_sign/00000.png
Binary file added tests_zemu/snapshots/fl-raw_sign/00001.png
Binary file added tests_zemu/snapshots/fl-raw_sign/00002.png
Binary file added tests_zemu/snapshots/fl-raw_sign/00003.png
Binary file added tests_zemu/snapshots/fl-raw_sign_hex/00000.png
Binary file added tests_zemu/snapshots/fl-raw_sign_hex/00001.png
Binary file added tests_zemu/snapshots/fl-raw_sign_hex/00002.png
Binary file added tests_zemu/snapshots/fl-raw_sign_hex/00003.png
Binary file added tests_zemu/snapshots/fl-session_setkeys/00001.png
Binary file added tests_zemu/snapshots/fl-session_setkeys/00002.png
Binary file added tests_zemu/snapshots/fl-session_setkeys/00004.png
Binary file added tests_zemu/snapshots/fl-session_setkeys/00005.png
Binary file added tests_zemu/snapshots/fl-show_address/00000.png
Binary file added tests_zemu/snapshots/fl-show_address/00001.png
Binary file added tests_zemu/snapshots/fl-show_address/00002.png
Binary file added tests_zemu/snapshots/fl-utility_batch/00000.png
Binary file added tests_zemu/snapshots/fl-utility_batch/00001.png
Binary file added tests_zemu/snapshots/fl-utility_batch/00002.png
Binary file added tests_zemu/snapshots/fl-utility_batch/00003.png
Binary file added tests_zemu/snapshots/fl-utility_batch/00004.png
Binary file modified tests_zemu/snapshots/s-mainmenu/00004.png
Binary file modified tests_zemu/snapshots/s-mainmenu/00010.png
Binary file modified tests_zemu/snapshots/sp-mainmenu/00004.png
Binary file modified tests_zemu/snapshots/sp-mainmenu/00010.png
Binary file modified tests_zemu/snapshots/st-balances_transfer/00000.png
Binary file modified tests_zemu/snapshots/st-balances_transfer/00001.png
Binary file modified tests_zemu/snapshots/st-balances_transfer/00002.png
Binary file modified tests_zemu/snapshots/st-balances_transfer/00003.png
Binary file modified tests_zemu/snapshots/st-balances_transfer/00004.png
Binary file modified tests_zemu/snapshots/st-balances_transfer_expert/00000.png
Binary file modified tests_zemu/snapshots/st-balances_transfer_expert/00001.png
Binary file modified tests_zemu/snapshots/st-balances_transfer_expert/00002.png
Binary file modified tests_zemu/snapshots/st-balances_transfer_expert/00003.png
Binary file modified tests_zemu/snapshots/st-balances_transfer_expert/00004.png
Binary file modified tests_zemu/snapshots/st-balances_transfer_expert/00005.png
Diff not rendered.
Binary file modified tests_zemu/snapshots/st-mainmenu/00000.png
Binary file modified tests_zemu/snapshots/st-mainmenu/00001.png
Binary file modified tests_zemu/snapshots/st-mainmenu/00002.png
Binary file modified tests_zemu/snapshots/st-mainmenu/00003.png
Binary file modified tests_zemu/snapshots/st-mainmenu/00004.png
Binary file modified tests_zemu/snapshots/st-mainmenu/00005.png
Binary file added tests_zemu/snapshots/st-mainmenu/00006.png
Binary file modified tests_zemu/snapshots/st-proxy_proxy/00000.png
Binary file modified tests_zemu/snapshots/st-proxy_proxy/00001.png
Binary file modified tests_zemu/snapshots/st-proxy_proxy/00002.png
Binary file modified tests_zemu/snapshots/st-proxy_proxy/00003.png
Binary file modified tests_zemu/snapshots/st-proxy_proxy/00004.png
Binary file removed tests_zemu/snapshots/st-proxy_proxy/00005.png
Diff not rendered.
Binary file modified tests_zemu/snapshots/st-raw_sign/00000.png
Binary file modified tests_zemu/snapshots/st-raw_sign/00001.png
Binary file modified tests_zemu/snapshots/st-raw_sign/00002.png
Binary file modified tests_zemu/snapshots/st-raw_sign/00003.png
Binary file modified tests_zemu/snapshots/st-raw_sign_hex/00000.png
Binary file modified tests_zemu/snapshots/st-raw_sign_hex/00001.png
Binary file modified tests_zemu/snapshots/st-raw_sign_hex/00002.png
Binary file modified tests_zemu/snapshots/st-raw_sign_hex/00003.png
Binary file removed tests_zemu/snapshots/st-raw_sign_hex/00004.png
Diff not rendered.
Binary file modified tests_zemu/snapshots/st-session_setkeys/00000.png
Binary file modified tests_zemu/snapshots/st-session_setkeys/00001.png
Binary file modified tests_zemu/snapshots/st-session_setkeys/00002.png
Binary file modified tests_zemu/snapshots/st-session_setkeys/00003.png
Binary file modified tests_zemu/snapshots/st-session_setkeys/00004.png
Binary file removed tests_zemu/snapshots/st-session_setkeys/00005.png
Diff not rendered.
Binary file modified tests_zemu/snapshots/st-show_address/00000.png
Binary file modified tests_zemu/snapshots/st-show_address/00001.png
Binary file modified tests_zemu/snapshots/st-show_address/00002.png
Binary file modified tests_zemu/snapshots/st-show_address_reject/00000.png
Binary file modified tests_zemu/snapshots/st-show_address_reject/00001.png
Binary file modified tests_zemu/snapshots/st-show_address_reject/00002.png
Binary file modified tests_zemu/snapshots/st-show_address_reject/00003.png
Binary file modified tests_zemu/snapshots/st-staking_nominate/00000.png
Binary file modified tests_zemu/snapshots/st-staking_nominate/00001.png
Binary file modified tests_zemu/snapshots/st-staking_nominate/00002.png
Binary file modified tests_zemu/snapshots/st-staking_nominate/00003.png
Binary file modified tests_zemu/snapshots/st-staking_nominate/00004.png
Binary file removed tests_zemu/snapshots/st-staking_nominate/00005.png
Diff not rendered.
Binary file modified tests_zemu/snapshots/st-utility_batch/00000.png
Binary file modified tests_zemu/snapshots/st-utility_batch/00001.png
Binary file modified tests_zemu/snapshots/st-utility_batch/00002.png
Binary file modified tests_zemu/snapshots/st-utility_batch/00003.png
Binary file modified tests_zemu/snapshots/st-utility_batch/00004.png
Binary file modified tests_zemu/snapshots/x-mainmenu/00004.png
Binary file modified tests_zemu/snapshots/x-mainmenu/00010.png
2 changes: 2 additions & 0 deletions tests_zemu/tests/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ const APP_PATH_S = resolve('../app/output/app_s.elf')
const APP_PATH_X = resolve('../app/output/app_x.elf')
const APP_PATH_SP = resolve('../app/output/app_s2.elf')
const APP_PATH_ST = resolve('../app/output/app_stax.elf')
const APP_PATH_FL = resolve('../app/output/app_flex.elf')

export const models: IDeviceModel[] = [
{ name: 'nanos', prefix: 'S', path: APP_PATH_S },
{ name: 'nanox', prefix: 'X', path: APP_PATH_X },
{ name: 'nanosp', prefix: 'SP', path: APP_PATH_SP },
{ name: 'stax', prefix: 'ST', path: APP_PATH_ST },
{ name: 'flex', prefix: 'FL', path: APP_PATH_FL },
]
6 changes: 3 additions & 3 deletions tests_zemu/tests/standard.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
******************************************************************************* */

import Zemu, { ButtonKind, DEFAULT_START_OPTIONS, zondaxMainmenuNavigation } from '@zondax/zemu'
import Zemu, { ButtonKind, DEFAULT_START_OPTIONS, zondaxMainmenuNavigation, isTouchDevice } from '@zondax/zemu'
import { newAlephZeroApp } from '@zondax/ledger-substrate'
import { APP_SEED, models } from './common'

Expand Down Expand Up @@ -97,7 +97,7 @@ describe('Standard', function () {
await sim.start({
...defaultOptions,
model: m.name,
approveKeyword: m.name === 'stax' ? 'QR' : '',
approveKeyword: isTouchDevice(m.name) ? 'Confirm' : '',
approveAction: ButtonKind.ApproveTapButton,
})
const app = newAlephZeroApp(sim.getTransport())
Expand Down Expand Up @@ -128,7 +128,7 @@ describe('Standard', function () {
await sim.start({
...defaultOptions,
model: m.name,
rejectKeyword: m.name === 'stax' ? 'QR' : '',
rejectKeyword: isTouchDevice(m.name) ? 'Confirm' : '',
})
const app = newAlephZeroApp(sim.getTransport())

Expand Down

0 comments on commit 3a15558

Please sign in to comment.