Skip to content
This repository has been archived by the owner on Oct 18, 2024. It is now read-only.

Commit

Permalink
Merge pull request #195 from Zondax/stax
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosala authored Jun 1, 2023
2 parents dda0c92 + 70fd0cd commit 220ac42
Show file tree
Hide file tree
Showing 73 changed files with 40 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
name: Analyse
strategy:
matrix:
sdk: ["$NANOS_SDK", "$NANOX_SDK", "$NANOSP_SDK"]
sdk: ["$NANOS_SDK", "$NANOX_SDK", "$NANOSP_SDK", "$STAX_SDK"]
runs-on: ubuntu-latest
container:
image: ghcr.io/ledgerhq/ledger-app-builder/ledger-app-builder-legacy:latest
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/guidelines_enforcer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,3 @@ jobs:
uses: LedgerHQ/ledger-app-workflows/.github/workflows/reusable_guidelines_enforcer.yml@v1
with:
relative_app_directory: app
run_for_devices: '["nanos", "nanosp", "nanox"]'
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +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
SUBSTRATE_PARSER_FULL ?= 1
include $(CURDIR)/deps/ledger-zxlib/dockerized_build.mk

Expand All @@ -47,6 +48,5 @@ zemu_install: tests_tools_build
test_all:
make zemu_install
SUBSTRATE_PARSER_FULL=1 make
make clean_glyphs
SUBSTRATE_PARSER_FULL=1 SUPPORT_SR25519=1 make buildS
make zemu_test
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=22
# This is the `spec_version` field of `Runtime`
APPVERSION_N=9420
# This is the patch version of this release
APPVERSION_P=0
APPVERSION_P=1
Binary file added app/glyphs/icon_stax_32.gif
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 app/glyphs/icon_stax_64.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 @@ -21,7 +21,7 @@
#include <string.h>
#include "zxmacros.h"

#if defined(TARGET_NANOX) || defined(TARGET_NANOS2)
#if defined(TARGET_NANOX) || defined(TARGET_NANOS2) || defined(TARGET_STAX)
#define RAM_BUFFER_SIZE 8192
#define FLASH_BUFFER_SIZE 16384
#elif defined(TARGET_NANOS)
Expand All @@ -37,7 +37,7 @@ typedef struct {
uint8_t buffer[FLASH_BUFFER_SIZE];
} storage_t;

#if defined(TARGET_NANOS) || defined(TARGET_NANOX) || defined(TARGET_NANOS2)
#if defined(TARGET_NANOS) || defined(TARGET_NANOX) || defined(TARGET_NANOS2) || defined(TARGET_STAX)
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)
#if defined(TARGET_NANOS) || defined(TARGET_NANOX) || defined(TARGET_NANOS2) || defined(TARGET_STAX)
#include "cx.h"

int 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)
#if defined(TARGET_NANOX) || defined(TARGET_NANOS2) || defined(TARGET_STAX)
#define MAX_CALL_NESTING_SIZE 6
#define MAX_CALL_VEC_SIZE 6
#else
Expand Down
13 changes: 13 additions & 0 deletions app/src/substrate/substrate_types.c
Original file line number Diff line number Diff line change
Expand Up @@ -1334,6 +1334,7 @@ parser_error_t _readMetadataOwner(parser_context_t* c, pd_MetadataOwner_t* v)

parser_error_t _readOptionMultiSigner(parser_context_t* c, pd_OptionMultiSigner_t* v)
{
CHECK_INPUT()
CHECK_ERROR(_readUInt8(c, &v->some))
if (v->some > 0) {
CHECK_ERROR(_readMultiSigner(c, &v->verifier))
Expand Down Expand Up @@ -1583,6 +1584,7 @@ parser_error_t _readVecu8(parser_context_t* c, pd_Vecu8_t* v) {

parser_error_t _readOptionNetworkIdV3(parser_context_t* c, pd_OptionNetworkIdV3_t* v)
{
CHECK_INPUT()
CHECK_ERROR(_readUInt8(c, &v->some))
if (v->some > 0) {
CHECK_ERROR(_readNetworkIdV3(c, &v->contained))
Expand All @@ -1592,6 +1594,7 @@ parser_error_t _readOptionNetworkIdV3(parser_context_t* c, pd_OptionNetworkIdV3_

parser_error_t _readOptionu8_array_20(parser_context_t* c, pd_Optionu8_array_20_t* v)
{
CHECK_INPUT()
CHECK_ERROR(_readUInt8(c, &v->some))
if (v->some > 0) {
CHECK_ERROR(_readu8_array_20(c, &v->contained))
Expand All @@ -1601,6 +1604,7 @@ parser_error_t _readOptionu8_array_20(parser_context_t* c, pd_Optionu8_array_20_

parser_error_t _readOptionMultiSignature(parser_context_t* c, pd_OptionMultiSignature_t* v)
{
CHECK_INPUT()
CHECK_ERROR(_readUInt8(c, &v->some))
if (v->some > 0) {
CHECK_ERROR(_readMultiSignature(c, &v->contained))
Expand All @@ -1610,6 +1614,7 @@ parser_error_t _readOptionMultiSignature(parser_context_t* c, pd_OptionMultiSign

parser_error_t _readOptionTimepoint(parser_context_t* c, pd_OptionTimepoint_t* v)
{
CHECK_INPUT()
CHECK_ERROR(_readUInt8(c, &v->some))
if (v->some > 0) {
CHECK_ERROR(_readTimepoint(c, &v->contained))
Expand All @@ -1619,6 +1624,7 @@ parser_error_t _readOptionTimepoint(parser_context_t* c, pd_OptionTimepoint_t* v

parser_error_t _readOptionTuplePerbillAccountId(parser_context_t* c, pd_OptionTuplePerbillAccountId_t* v)
{
CHECK_INPUT()
CHECK_ERROR(_readUInt8(c, &v->some))
if (v->some > 0) {
CHECK_ERROR(_readTuplePerbillAccountId(c, &v->contained))
Expand All @@ -1628,6 +1634,7 @@ parser_error_t _readOptionTuplePerbillAccountId(parser_context_t* c, pd_OptionTu

parser_error_t _readOptionAccountId(parser_context_t* c, pd_OptionAccountId_t* v)
{
CHECK_INPUT()
CHECK_ERROR(_readUInt8(c, &v->some))
if (v->some > 0) {
CHECK_ERROR(_readAccountId(c, &v->contained))
Expand All @@ -1637,6 +1644,7 @@ parser_error_t _readOptionAccountId(parser_context_t* c, pd_OptionAccountId_t* v

parser_error_t _readOptionClassOf(parser_context_t* c, pd_OptionClassOf_t* v)
{
CHECK_INPUT()
CHECK_ERROR(_readUInt8(c, &v->some))
if (v->some > 0) {
CHECK_ERROR(_readClassOf(c, &v->contained))
Expand All @@ -1646,6 +1654,7 @@ parser_error_t _readOptionClassOf(parser_context_t* c, pd_OptionClassOf_t* v)

parser_error_t _readOptionPerquintill(parser_context_t* c, pd_OptionPerquintill_t* v)
{
CHECK_INPUT()
CHECK_ERROR(_readUInt8(c, &v->some))
if (v->some > 0) {
CHECK_ERROR(_readPerquintill(c, &v->contained))
Expand All @@ -1655,6 +1664,7 @@ parser_error_t _readOptionPerquintill(parser_context_t* c, pd_OptionPerquintill_

parser_error_t _readOptionPreimageHash(parser_context_t* c, pd_OptionPreimageHash_t* v)
{
CHECK_INPUT()
CHECK_ERROR(_readUInt8(c, &v->some))
if (v->some > 0) {
CHECK_ERROR(_readPreimageHash(c, &v->contained))
Expand All @@ -1664,6 +1674,7 @@ parser_error_t _readOptionPreimageHash(parser_context_t* c, pd_OptionPreimageHas

parser_error_t _readOptionProxyType(parser_context_t* c, pd_OptionProxyType_t* v)
{
CHECK_INPUT()
CHECK_ERROR(_readUInt8(c, &v->some))
if (v->some > 0) {
CHECK_ERROR(_readProxyType(c, &v->contained))
Expand All @@ -1673,6 +1684,7 @@ parser_error_t _readOptionProxyType(parser_context_t* c, pd_OptionProxyType_t* v

parser_error_t _readOptionReferendumIndex(parser_context_t* c, pd_OptionReferendumIndex_t* v)
{
CHECK_INPUT()
CHECK_ERROR(_readUInt8(c, &v->some))
if (v->some > 0) {
CHECK_ERROR(_readReferendumIndex(c, &v->contained))
Expand All @@ -1682,6 +1694,7 @@ parser_error_t _readOptionReferendumIndex(parser_context_t* c, pd_OptionReferend

parser_error_t _readOptionu32(parser_context_t* c, pd_Optionu32_t* v)
{
CHECK_INPUT()
CHECK_ERROR(_readUInt8(c, &v->some))
if (v->some > 0) {
CHECK_ERROR(_readu32(c, &v->contained))
Expand Down
Binary file added app/stax_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 deps/nanos-secure-sdk
4 changes: 2 additions & 2 deletions tests_zemu/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
],
"scripts": {
"clean": "ts-node tests/pullImageKillOld.ts",
"test": "yarn clean && jest"
"test": "yarn clean && jest --maxConcurrency 2"
},
"dependencies": {
"@zondax/ledger-substrate": "^0.40.5",
"@zondax/zemu": "^0.42.0"
"@zondax/zemu": "^0.42.1"
},
"devDependencies": {
"@types/jest": "^29.2.1",
Expand Down
Binary file modified tests_zemu/snapshots/s-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 modified tests_zemu/snapshots/s-mainmenu/00010.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_zemu/snapshots/sp-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 modified tests_zemu/snapshots/sp-mainmenu/00010.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.
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/st-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/st-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/st-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/st-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/st-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/st-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/st-proxy_proxy/00000.png
Binary file added tests_zemu/snapshots/st-proxy_proxy/00001.png
Binary file added tests_zemu/snapshots/st-proxy_proxy/00002.png
Binary file added tests_zemu/snapshots/st-proxy_proxy/00003.png
Binary file added tests_zemu/snapshots/st-proxy_proxy/00004.png
Binary file added tests_zemu/snapshots/st-proxy_proxy/00005.png
Binary file added tests_zemu/snapshots/st-session_setkeys/00001.png
Binary file added tests_zemu/snapshots/st-session_setkeys/00002.png
Binary file added tests_zemu/snapshots/st-session_setkeys/00003.png
Binary file added tests_zemu/snapshots/st-session_setkeys/00004.png
Binary file added tests_zemu/snapshots/st-session_setkeys/00005.png
Binary file added tests_zemu/snapshots/st-session_setkeys/00006.png
Binary file added tests_zemu/snapshots/st-show_address/00000.png
Binary file added tests_zemu/snapshots/st-show_address/00001.png
Binary file added tests_zemu/snapshots/st-show_address/00002.png
Binary file added tests_zemu/snapshots/st-txUtility_batch/00001.png
Binary file added tests_zemu/snapshots/st-txUtility_batch/00003.png
Binary file added tests_zemu/snapshots/st-txUtility_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 @@ -7,9 +7,11 @@ export const APP_SEED = 'equip will roof matter pink blind book anxiety banner e
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')

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 },
]
15 changes: 12 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, { DEFAULT_START_OPTIONS, zondaxMainmenuNavigation } from '@zondax/zemu'
import Zemu, { ButtonKind, DEFAULT_START_OPTIONS, zondaxMainmenuNavigation } from '@zondax/zemu'
import { newKusamaApp } from '@zondax/ledger-substrate'
import { APP_SEED, models } from './common'

Expand Down Expand Up @@ -94,7 +94,12 @@ describe('Standard', function () {
test.concurrent.each(models)('show address', async function (m) {
const sim = new Zemu(m.path)
try {
await sim.start({ ...defaultOptions, model: m.name })
await sim.start({
...defaultOptions,
model: m.name,
approveKeyword: m.name === 'stax' ? 'QR' : '',
approveAction: ButtonKind.ApproveTapButton,
})
const app = newKusamaApp(sim.getTransport())

const respRequest = app.getAddress(0x80000000, 0x80000000, 0x80000000, true)
Expand All @@ -119,7 +124,11 @@ describe('Standard', function () {
test.concurrent.each(models)('show address - reject', async function (m) {
const sim = new Zemu(m.path)
try {
await sim.start({ ...defaultOptions, model: m.name })
await sim.start({
...defaultOptions,
model: m.name,
rejectKeyword: m.name === 'stax' ? 'QR' : '',
})
const app = newKusamaApp(sim.getTransport())

const respRequest = app.getAddress(0x80000000, 0x80000000, 0x80000000, true)
Expand Down

0 comments on commit 220ac42

Please sign in to comment.