Skip to content
This repository was archived by the owner on Feb 13, 2022. It is now read-only.

Commit 30a302c

Browse files
authored
Merge pull request #33 from Zondax/dev
upgrade dependencies + SDK
2 parents b8bffd2 + 9cd0d7f commit 30a302c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+1374
-6340
lines changed

.github/workflows/ledger.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
name: CI
22

33
on:
4-
# Triggers the workflow on push or pull request events but only for the master branch
4+
# Triggers the workflow on push or pull request events but only for the main branch
55
push:
6-
branches: [ master ]
6+
branches: [ main ]
77
pull_request:
8-
branches: [ master ]
8+
branches: [ main ]
99

1010
# Allows you to run this workflow manually from the Actions tab
1111
workflow_dispatch:

.github/workflows/main.yml

Lines changed: 39 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
1-
name: Build
2-
on: [ push ]
1+
name: "Test/Build"
2+
on:
3+
workflow_dispatch:
4+
push:
5+
pull_request:
6+
branches: [ main ]
37

48
jobs:
59
configure:
@@ -22,11 +26,11 @@ jobs:
2226
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 10
2327
make deps
2428
brew install conan
25-
sudo apt install libbsd-dev
29+
conan config install https://github.com/conan-io/conanclientcert.git
2630
- run: cmake -DCMAKE_BUILD_TYPE=Debug . && make
2731
- run: GTEST_COLOR=1 ASAN_OPTIONS=detect_leaks=0 ctest -VV
2832

29-
build_ledger:
33+
build_ledger_nano_S:
3034
needs: configure
3135
runs-on: ubuntu-latest
3236
container:
@@ -47,14 +51,30 @@ jobs:
4751
source $HOME/.cargo/env
4852
make
4953
50-
test_zemu:
54+
build_ledger_nano_X:
55+
needs: configure
5156
runs-on: ubuntu-latest
57+
container:
58+
image: zondax/builder-bolos:latest
59+
options: --user ${{ needs.configure.outputs.uid_gid }}
60+
env:
61+
BOLOS_SDK: ${{ github.workspace }}/deps/nanox-secure-sdk
62+
BOLOS_ENV: /opt/bolos
63+
HOME: /home/zondax_circle
5264
steps:
53-
- name: Test
65+
- name: Checkout
66+
uses: actions/checkout@v2
67+
with:
68+
submodules: true
69+
- name: Build Standard app
70+
shell: bash -l {0}
5471
run: |
55-
id
56-
echo $HOME
57-
echo $DISPLAY
72+
source $HOME/.cargo/env
73+
make
74+
75+
test_zemu:
76+
runs-on: ubuntu-latest
77+
steps:
5878
- name: Checkout
5979
uses: actions/checkout@v2
6080
with:
@@ -85,7 +105,7 @@ jobs:
85105
make zemu_test
86106
87107
build_package:
88-
needs: [ configure, build, build_ledger, test_zemu ]
108+
needs: [ configure, build, build_ledger_nano_S, build_ledger_nano_X, test_zemu ]
89109
if: ${{ github.ref == 'refs/heads/main' }}
90110
runs-on: ubuntu-latest
91111
container:
@@ -106,17 +126,19 @@ jobs:
106126
shell: bash -l {0}
107127
run: |
108128
source $HOME/.cargo/env
109-
make SUBSTRATE_PARSER_FULL=0
110-
- name: Set tag name var (1)
111-
id: vars_1
112-
run: echo ::set-output name=tag_name::$(./app/pkg/installer_s.sh version)
113-
- name: Create or Update Release (1)
114-
id: create_release_1
129+
make
130+
- name: Set tag name var
131+
id: vars
132+
run: |
133+
pip install ledgerblue
134+
echo ::set-output name=tag_name::$(./app/pkg/installer_s.sh version)
135+
- name: Create or Update Release
136+
id: create_release
115137
uses: softprops/action-gh-release@v1
116138
env:
117139
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
118140
with:
119141
files: ./app/pkg/installer_s.sh
120-
tag_name: ${{ steps.vars_1.outputs.tag_name }}
142+
tag_name: ${{ steps.vars.outputs.tag_name }}
121143
draft: false
122144
prerelease: false

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,3 +95,4 @@ fuzz-*.log
9595
/fuzz/corpora
9696

9797
.vscode/
98+
tests_zemu/yarn.lock

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ target_include_directories(app_lib PUBLIC
114114
deps/ledger-zxlib/app/common
115115
)
116116

117-
target_link_libraries(app_lib PUBLIC bsd)
117+
target_link_libraries(app_lib PUBLIC)
118118

119119
##############################################################
120120
##############################################################

app/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ OUTPUT_INSTALLER := $(CURDIR)/pkg/installer_s.sh
8282
endif
8383

8484
ifeq ($(TARGET_NAME),TARGET_NANOX)
85-
SCRIPT_LD:=$(CURDIR)/script_x.ld
85+
APP_STACK_SIZE:=4096
8686
ICONNAME:=$(CURDIR)/nanox_icon.gif
8787
OUTPUT_ELF ?= $(CURDIR)/output/app_x.elf
8888
OUTPUT_INSTALLER:= $(CURDIR)/pkg/installer_x.sh
@@ -113,6 +113,7 @@ DEFINES += USB_SEGMENT_SIZE=64
113113
DEFINES += HAVE_BOLOS_APP_STACK_CANARY
114114

115115
DEFINES += HAVE_WEBUSB WEBUSB_URL_SIZE_B=0 WEBUSB_URL=""
116+
DEFINES += HAVE_HASH HAVE_BLAKE2 HAVE_SHA256 HAVE_SHA512
116117

117118
ifeq ($(TARGET_NAME),TARGET_NANOX)
118119
DEFINES += IO_SEPROXYHAL_BUFFER_SIZE_B=300

app/Makefile.version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ APPVERSION_M=2
33
# This is the `spec_version` field of `Runtime`
44
APPVERSION_N=32
55
# This is the patch version of this release
6-
APPVERSION_P=0
6+
APPVERSION_P=1

app/script_x.ld

Lines changed: 0 additions & 175 deletions
This file was deleted.

app/src/apdu_handler.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ __Z_INLINE void handleSignSecp256K1(volatile uint32_t *flags, volatile uint32_t
6767
*tx = 0;
6868
THROW(APDU_CODE_DATA_INVALID);
6969
}
70-
parser_tx_obj.own_addr = (const char *)(G_io_apdu_buffer + VIEW_ADDRESS_OFFSET_SECP256K1);
70+
parser_tx_obj.own_addr = (const char *) (G_io_apdu_buffer + VIEW_ADDRESS_OFFSET_SECP256K1);
7171

7272
const char *error_msg = tx_parse();
7373

app/src/coin.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ typedef enum {
3838
#define VIEW_ADDRESS_LAST_PAGE_DEFAULT 0
3939

4040
#define MENU_MAIN_APP_LINE1 "Cosmos"
41-
#define MENU_MAIN_APP_LINE2 "ready"
41+
#define MENU_MAIN_APP_LINE2 "Ready"
4242
#define APPVERSION_LINE1 "Version:"
4343
#define APPVERSION_LINE2 ("v" APPVERSION)
4444

app/src/crypto.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ void ripemd160_32(uint8_t *out, uint8_t *in) {
172172
void crypto_set_hrp(char *p) {
173173
bech32_hrp_len = strlen(p);
174174
if (bech32_hrp_len < MAX_BECH32_HRP_LEN) {
175-
strlcpy(bech32_hrp, p, sizeof(bech32_hrp));
175+
snprintf(bech32_hrp, sizeof(bech32_hrp), "%s", p);
176176
}
177177
}
178178

app/src/json/json_parser.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#include <common/parser_common.h>
2020
#include "json_parser.h"
2121

22-
#define EQUALS(_P, _Q, _LEN) (MEMCMP( PIC(_P), PIC(_Q), (_LEN))==0)
22+
#define EQUALS(_P, _Q, _LEN) (MEMCMP( (const void*) PIC(_P), (const void*) PIC(_Q), (_LEN))==0)
2323

2424
parser_error_t json_parse(parsed_json_t *parsed_json, const char *buffer, uint16_t bufferLen) {
2525
jsmn_parser parser;
@@ -209,9 +209,9 @@ parser_error_t object_get_nth_value(const parsed_json_t *json,
209209
}
210210

211211
CHECK_PARSER_ERR(object_get_nth_key(json, object_token_index, object_element_index, key_index))
212-
(*key_index) ++;
212+
(*key_index)++;
213213

214-
return parser_ok;
214+
return parser_ok;
215215
}
216216

217217
parser_error_t object_get_value(const parsed_json_t *json,

app/src/tx_display.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,15 @@ __Z_INLINE parser_error_t calculate_is_default_chainid() {
108108
outVal, sizeof(outVal),
109109
0, &pageCount))
110110

111-
if (strcmp(outVal, COIN_DEFAULT_CHAINID) != 0) {
111+
zemu_log_stack(outVal);
112+
zemu_log_stack(COIN_DEFAULT_CHAINID);
113+
114+
if (strcmp(outVal, COIN_DEFAULT_CHAINID) == 0) {
112115
// If we don't match the default chainid, switch to expert mode
113116
display_cache.is_default_chain = true;
117+
zemu_log_stack("DEFAULT Chain ");
118+
} else {
119+
zemu_log_stack("Chain is NOT DEFAULT");
114120
}
115121

116122
return parser_ok;
@@ -293,7 +299,7 @@ __Z_INLINE bool is_default_chainid() {
293299
}
294300

295301
bool tx_is_expert_mode() {
296-
return app_mode_expert() || is_default_chainid();
302+
return app_mode_expert() || !is_default_chainid();
297303
}
298304

299305
__Z_INLINE uint8_t get_subitem_count(root_item_e root_item) {

0 commit comments

Comments
 (0)