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

Commit

Permalink
Merge pull request #33 from Zondax/dev
Browse files Browse the repository at this point in the history
upgrade dependencies + SDK
  • Loading branch information
jleni authored Feb 12, 2022
2 parents b8bffd2 + 9cd0d7f commit 30a302c
Show file tree
Hide file tree
Showing 54 changed files with 1,374 additions and 6,340 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ledger.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
name: CI

on:
# Triggers the workflow on push or pull request events but only for the master branch
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [ master ]
branches: [ main ]
pull_request:
branches: [ master ]
branches: [ main ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
Expand Down
56 changes: 39 additions & 17 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
name: Build
on: [ push ]
name: "Test/Build"
on:
workflow_dispatch:
push:
pull_request:
branches: [ main ]

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

build_ledger:
build_ledger_nano_S:
needs: configure
runs-on: ubuntu-latest
container:
Expand All @@ -47,14 +51,30 @@ jobs:
source $HOME/.cargo/env
make
test_zemu:
build_ledger_nano_X:
needs: configure
runs-on: ubuntu-latest
container:
image: zondax/builder-bolos:latest
options: --user ${{ needs.configure.outputs.uid_gid }}
env:
BOLOS_SDK: ${{ github.workspace }}/deps/nanox-secure-sdk
BOLOS_ENV: /opt/bolos
HOME: /home/zondax_circle
steps:
- name: Test
- name: Checkout
uses: actions/checkout@v2
with:
submodules: true
- name: Build Standard app
shell: bash -l {0}
run: |
id
echo $HOME
echo $DISPLAY
source $HOME/.cargo/env
make
test_zemu:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
Expand Down Expand Up @@ -85,7 +105,7 @@ jobs:
make zemu_test
build_package:
needs: [ configure, build, build_ledger, test_zemu ]
needs: [ configure, build, build_ledger_nano_S, build_ledger_nano_X, test_zemu ]
if: ${{ github.ref == 'refs/heads/main' }}
runs-on: ubuntu-latest
container:
Expand All @@ -106,17 +126,19 @@ jobs:
shell: bash -l {0}
run: |
source $HOME/.cargo/env
make SUBSTRATE_PARSER_FULL=0
- name: Set tag name var (1)
id: vars_1
run: echo ::set-output name=tag_name::$(./app/pkg/installer_s.sh version)
- name: Create or Update Release (1)
id: create_release_1
make
- name: Set tag name var
id: vars
run: |
pip install ledgerblue
echo ::set-output name=tag_name::$(./app/pkg/installer_s.sh version)
- name: Create or Update Release
id: create_release
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_s.sh
tag_name: ${{ steps.vars_1.outputs.tag_name }}
tag_name: ${{ steps.vars.outputs.tag_name }}
draft: false
prerelease: false
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,4 @@ fuzz-*.log
/fuzz/corpora

.vscode/
tests_zemu/yarn.lock
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ target_include_directories(app_lib PUBLIC
deps/ledger-zxlib/app/common
)

target_link_libraries(app_lib PUBLIC bsd)
target_link_libraries(app_lib PUBLIC)

##############################################################
##############################################################
Expand Down
3 changes: 2 additions & 1 deletion app/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ OUTPUT_INSTALLER := $(CURDIR)/pkg/installer_s.sh
endif

ifeq ($(TARGET_NAME),TARGET_NANOX)
SCRIPT_LD:=$(CURDIR)/script_x.ld
APP_STACK_SIZE:=4096
ICONNAME:=$(CURDIR)/nanox_icon.gif
OUTPUT_ELF ?= $(CURDIR)/output/app_x.elf
OUTPUT_INSTALLER:= $(CURDIR)/pkg/installer_x.sh
Expand Down Expand Up @@ -113,6 +113,7 @@ DEFINES += USB_SEGMENT_SIZE=64
DEFINES += HAVE_BOLOS_APP_STACK_CANARY

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

ifeq ($(TARGET_NAME),TARGET_NANOX)
DEFINES += IO_SEPROXYHAL_BUFFER_SIZE_B=300
Expand Down
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=2
# This is the `spec_version` field of `Runtime`
APPVERSION_N=32
# This is the patch version of this release
APPVERSION_P=0
APPVERSION_P=1
175 changes: 0 additions & 175 deletions app/script_x.ld

This file was deleted.

2 changes: 1 addition & 1 deletion app/src/apdu_handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ __Z_INLINE void handleSignSecp256K1(volatile uint32_t *flags, volatile uint32_t
*tx = 0;
THROW(APDU_CODE_DATA_INVALID);
}
parser_tx_obj.own_addr = (const char *)(G_io_apdu_buffer + VIEW_ADDRESS_OFFSET_SECP256K1);
parser_tx_obj.own_addr = (const char *) (G_io_apdu_buffer + VIEW_ADDRESS_OFFSET_SECP256K1);

const char *error_msg = tx_parse();

Expand Down
2 changes: 1 addition & 1 deletion app/src/coin.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ typedef enum {
#define VIEW_ADDRESS_LAST_PAGE_DEFAULT 0

#define MENU_MAIN_APP_LINE1 "Cosmos"
#define MENU_MAIN_APP_LINE2 "ready"
#define MENU_MAIN_APP_LINE2 "Ready"
#define APPVERSION_LINE1 "Version:"
#define APPVERSION_LINE2 ("v" APPVERSION)

Expand Down
2 changes: 1 addition & 1 deletion app/src/crypto.c
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ void ripemd160_32(uint8_t *out, uint8_t *in) {
void crypto_set_hrp(char *p) {
bech32_hrp_len = strlen(p);
if (bech32_hrp_len < MAX_BECH32_HRP_LEN) {
strlcpy(bech32_hrp, p, sizeof(bech32_hrp));
snprintf(bech32_hrp, sizeof(bech32_hrp), "%s", p);
}
}

Expand Down
6 changes: 3 additions & 3 deletions app/src/json/json_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include <common/parser_common.h>
#include "json_parser.h"

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

parser_error_t json_parse(parsed_json_t *parsed_json, const char *buffer, uint16_t bufferLen) {
jsmn_parser parser;
Expand Down Expand Up @@ -209,9 +209,9 @@ parser_error_t object_get_nth_value(const parsed_json_t *json,
}

CHECK_PARSER_ERR(object_get_nth_key(json, object_token_index, object_element_index, key_index))
(*key_index) ++;
(*key_index)++;

return parser_ok;
return parser_ok;
}

parser_error_t object_get_value(const parsed_json_t *json,
Expand Down
10 changes: 8 additions & 2 deletions app/src/tx_display.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,15 @@ __Z_INLINE parser_error_t calculate_is_default_chainid() {
outVal, sizeof(outVal),
0, &pageCount))

if (strcmp(outVal, COIN_DEFAULT_CHAINID) != 0) {
zemu_log_stack(outVal);
zemu_log_stack(COIN_DEFAULT_CHAINID);

if (strcmp(outVal, COIN_DEFAULT_CHAINID) == 0) {
// If we don't match the default chainid, switch to expert mode
display_cache.is_default_chain = true;
zemu_log_stack("DEFAULT Chain ");
} else {
zemu_log_stack("Chain is NOT DEFAULT");
}

return parser_ok;
Expand Down Expand Up @@ -293,7 +299,7 @@ __Z_INLINE bool is_default_chainid() {
}

bool tx_is_expert_mode() {
return app_mode_expert() || is_default_chainid();
return app_mode_expert() || !is_default_chainid();
}

__Z_INLINE uint8_t get_subitem_count(root_item_e root_item) {
Expand Down
Loading

0 comments on commit 30a302c

Please sign in to comment.