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

Align master with p1 #75

Merged
merged 59 commits into from
Oct 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
36cdd31
image: add tezos glyph and icon
sgliner-ledger Dec 26, 2022
34171b9
ui: refactore to have bagl related code in dedicated file
sgliner-ledger Dec 26, 2022
4c7a8ac
ui: move all ui related code to dedicated bagl files
sgliner-ledger Nov 29, 2022
2a4596d
ui: remove noreturn attribute that is incompatible with nbgl api
sgliner-ledger Dec 26, 2022
c90be41
Stax: add support for NBGL
sgliner-ledger Nov 25, 2022
3f8c9c4
apdu_handling: add flag parameter
sgliner-ledger Dec 26, 2022
46e6e8b
ui_common: disable ticker event only for BAGL
sgliner-ledger Dec 26, 2022
97220b3
bluetooth: fix support for Stax
sgliner-ledger Feb 6, 2023
0e7fca7
CI: update workflows
sgliner-ledger Apr 11, 2023
9811596
misc: clear some warnings
sgliner-ledger Apr 24, 2023
68a1fd1
Bump Version
sgliner-ledger Feb 6, 2023
da51278
boot.c: add missing CLOSE_TRY
sgliner-ledger Apr 25, 2023
ec9cd2b
Tests: add ragger tests
sgliner-ledger Apr 24, 2023
5ea4e40
Tests: add snapshots
sgliner-ledger Apr 24, 2023
dab1c0a
misc: clear some more warnings
sgliner-ledger Apr 26, 2023
93aa8fa
misc: improvements after review
sgliner-ledger Apr 26, 2023
7a6e463
[Lint]
sgliner-ledger Apr 26, 2023
320fd0d
update screenshots
sgliner-ledger Apr 26, 2023
b2e01c9
Merge pull request #50 from LedgerHQ/stax-port
sgliner-ledger Apr 28, 2023
5d547bd
Add a workflow triggering the Exchange tests with the current Tezos b…
fbeutin-ledger Apr 25, 2023
8a0a58d
Add bss reset
fbeutin-ledger Apr 28, 2023
6c093ad
Merge pull request #55 from LedgerHQ/fbe/exchange_reusable_workflow
fbeutin-ledger Apr 28, 2023
b2758a2
microtez_to_string: add ticker to string
sgliner-ledger May 31, 2023
21cdc73
nbgl: change wording
sgliner-ledger Jun 1, 2023
73d3792
BakersRegistryCoreUnfilteredData: update Figment Networks to Chorus O…
sgliner-ledger Jun 1, 2023
c4b68ab
BakersRegistryCoreUnfilteredData: changer Obsidian bakerAccount to match
sgliner-ledger Jun 1, 2023
e7cfca0
Withdraw delegation: change wording
sgliner-ledger Jun 1, 2023
e400c39
snaps: update
sgliner-ledger Jun 6, 2023
1786892
Merge pull request #56 from LedgerHQ/functional-review
sgliner-ledger Jun 6, 2023
9761f28
Makefile: Bump version
sgliner-ledger Jun 6, 2023
e1c823e
Merge pull request #58 from LedgerHQ/bump-version
sgliner-ledger Jun 6, 2023
fed61e6
Makefile: Bump version
sgliner-ledger Jun 7, 2023
b16aec3
Merge pull request #60 from LedgerHQ/bump-version
sgliner-ledger Jun 7, 2023
c8f6faa
boot.c: add parameter to io_seproxyhal_power_off
sgliner-ledger Jun 9, 2023
44f5a74
Merge pull request #61 from LedgerHQ/fix_build
sgliner-ledger Jun 9, 2023
baab79c
boot: fix only for API_LEVEL > 10
sgliner-ledger Jun 15, 2023
7dcfcc8
Merge pull request #62 from LedgerHQ/fix_build
sgliner-ledger Jun 15, 2023
1511d06
QR code source path is now used explicitly
apaillier-ledger Aug 3, 2023
72e4f92
Merge pull request #65 from LedgerHQ/fix/apa/explicit_qrcode_source_path
sgliner-ledger Aug 7, 2023
6b9caae
Add a modal when started by Exchange
fbeutin-ledger Aug 29, 2023
8e2e49c
Use swap_lib_calls.h interface from Exchange
fbeutin-ledger Aug 29, 2023
9d41ef6
Return in Exchange after a swap
fbeutin-ledger Aug 29, 2023
1e92a02
Merge pull request #66 from LedgerHQ/fbe/improve_exchange_ui
fbeutin-ledger Aug 30, 2023
7b17919
webusb only for wallet app
cryi Apr 19, 2023
2c4495a
Makefile: Bump version
sgliner-ledger Aug 30, 2023
3292372
tests: update snaps
sgliner-ledger Aug 30, 2023
b471a73
Merge pull request #67 from LedgerHQ/enable-webusb
sgliner-ledger Aug 30, 2023
f68565b
Add Kiln baker
nndiaye-ledger Oct 3, 2023
200055c
Merge pull request #68 from nndiaye-ledger/develop
sgliner-ledger Oct 4, 2023
fe9120b
Fix BakersRegistry
nndiaye-ledger Oct 9, 2023
03a1fec
Bump version
nndiaye-ledger Oct 9, 2023
c80f7c7
Merge pull request #70 from nndiaye-ledger/develop
sgliner-ledger Oct 9, 2023
20e1153
Bump version
sgliner-ledger Oct 10, 2023
ecc0645
Merge pull request #71 from LedgerHQ/bump_version
sgliner-ledger Oct 10, 2023
52c76f7
boot.c: fix build for master sdk
sgliner-ledger Oct 12, 2023
2661838
Merge pull request #72 from LedgerHQ/build-on-master-sdk
sgliner-ledger Oct 12, 2023
8e5885e
Adapt dep directory to sdk update
cedelavergne-ledger Oct 12, 2023
7fe0f97
Merge pull request #73 from LedgerHQ/cev/B2CA-1408_conflict-name
cedelavergne-ledger Oct 12, 2023
62cf404
Merge branch 'master' into develop
sgliner-ledger Oct 18, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
35 changes: 35 additions & 0 deletions .github/workflows/build_and_functional_tests_baking.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Build and run functional baking tests using ragger through reusable workflow

# This workflow will build the app and then run functional tests using the Ragger framework upon Speculos emulation.
# It calls a reusable workflow developed by Ledger's internal developer team to build the application and upload the
# resulting binaries.
# It then calls another reusable workflow to run the Ragger tests on the compiled application binary.
#
# While this workflow is optional, having functional testing on your application is mandatory and this workflow and
# tooling environment is meant to be easy to use and adapt after forking your application

on:
workflow_dispatch:
push:
branches:
- master
- main
- develop
pull_request:

jobs:
build_application:
name: Build application using the reusable workflow
uses: LedgerHQ/ledger-app-workflows/.github/workflows/reusable_build.yml@v1
with:
upload_app_binaries_artifact: "compiled_app_binaries"
flags: "APP=tezos_baking"

ragger_tests:
name: Run ragger tests using the reusable workflow
needs: build_application
uses: LedgerHQ/ledger-app-workflows/.github/workflows/reusable_ragger_tests.yml@v1
with:
download_app_binaries_artifact: "compiled_app_binaries"
test_dir: test/python/tests_baking

35 changes: 35 additions & 0 deletions .github/workflows/build_and_functional_tests_wallet.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Build and run functional wallet tests using ragger through reusable workflow

# This workflow will build the app and then run functional tests using the Ragger framework upon Speculos emulation.
# It calls a reusable workflow developed by Ledger's internal developer team to build the application and upload the
# resulting binaries.
# It then calls another reusable workflow to run the Ragger tests on the compiled application binary.
#
# While this workflow is optional, having functional testing on your application is mandatory and this workflow and
# tooling environment is meant to be easy to use and adapt after forking your application

on:
workflow_dispatch:
push:
branches:
- master
- main
- develop
pull_request:

jobs:
build_application:
name: Build application using the reusable workflow
uses: LedgerHQ/ledger-app-workflows/.github/workflows/reusable_build.yml@v1
with:
upload_app_binaries_artifact: "compiled_app_binaries"
flags: "APP=tezos_wallet"

ragger_tests:
name: Run ragger tests using the reusable workflow
needs: build_application
uses: LedgerHQ/ledger-app-workflows/.github/workflows/reusable_ragger_tests.yml@v1
with:
download_app_binaries_artifact: "compiled_app_binaries"
test_dir: test/python/tests_wallet

39 changes: 0 additions & 39 deletions .github/workflows/ci-workflow.yml

This file was deleted.

23 changes: 23 additions & 0 deletions .github/workflows/guidelines_enforcer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Ensure compliance with Ledger guidelines

# This workflow is mandatory in all applications
# It calls a reusable workflow guidelines_enforcer developed by Ledger's internal developer team.
# The successful completion of the reusable workflow is a mandatory step for an app to be available on the Ledger
# application store.
#
# More information on the guidelines can be found in the repository:
# LedgerHQ/ledger-app-workflows/

on:
workflow_dispatch:
push:
branches:
- master
- main
- develop
pull_request:

jobs:
guidelines_enforcer:
name: Call Ledger guidelines_enforcer
uses: LedgerHQ/ledger-app-workflows/.github/workflows/reusable_guidelines_enforcer.yml@v1
16 changes: 16 additions & 0 deletions .github/workflows/swap-ci-workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Swap functional tests

on:
workflow_dispatch:
push:
branches:
- master
- develop
pull_request:

jobs:
job_functional_tests:
uses: LedgerHQ/app-exchange/.github/workflows/reusable_swap_functional_tests.yml@develop
with:
branch_for_tezos: ${{ github.ref }}
test_filter: '"XLM or xlm or Tezos or tezos"'
52 changes: 38 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ GIT_DESCRIBE ?= $(shell git describe --tags --abbrev=8 --always --long --dirty 2

VERSION_TAG ?= $(shell echo "$(GIT_DESCRIBE)" | cut -f1 -d-)
APPVERSION_M=2
APPVERSION_N=3
APPVERSION_P=2
APPVERSION_N=4
APPVERSION_P=5
APPVERSION=$(APPVERSION_M).$(APPVERSION_N).$(APPVERSION_P)

# Only warn about version tags if specified/inferred
Expand All @@ -46,6 +46,8 @@ endif

ifeq ($(TARGET_NAME),TARGET_NANOS)
ICONNAME=icons/nano-s-tezos.gif
else ifeq ($(TARGET_NAME),TARGET_STAX)
ICONNAME=icons/stax_tezos.gif
else
ICONNAME=icons/nano-x-tezos.gif
endif
Expand All @@ -66,14 +68,14 @@ show-app:
############

DEFINES += OS_IO_SEPROXYHAL
DEFINES += HAVE_BAGL HAVE_SPRINTF HAVE_UX_FLOW
DEFINES += HAVE_SPRINTF
DEFINES += HAVE_IO_USB HAVE_L4_USBLIB IO_USB_MAX_ENDPOINTS=6 IO_HID_EP_LENGTH=64 HAVE_USB_APDU
DEFINES += HAVE_LEGACY_PID
DEFINES += VERSION=\"$(APPVERSION)\" APPVERSION_M=$(APPVERSION_M)
DEFINES += COMMIT=\"$(COMMIT)\" APPVERSION_N=$(APPVERSION_N) APPVERSION_P=$(APPVERSION_P)
# DEFINES += _Static_assert\(...\)=

ifeq ($(TARGET_NAME),TARGET_NANOX)
ifeq ($(TARGET_NAME),$(filter $(TARGET_NAME),TARGET_NANOX TARGET_STAX))
DEFINES += HAVE_BLE BLE_COMMAND_TIMEOUT_MS=2000
DEFINES += HAVE_BLE_APDU # basic ledger apdu transport over BLE

Expand All @@ -84,14 +86,25 @@ ifeq ($(TARGET_NAME),TARGET_NANOS)
DEFINES += IO_SEPROXYHAL_BUFFER_SIZE_B=128
else
DEFINES += IO_SEPROXYHAL_BUFFER_SIZE_B=300
DEFINES += HAVE_GLO096
DEFINES += HAVE_BAGL BAGL_WIDTH=128 BAGL_HEIGHT=64
DEFINES += HAVE_BAGL_ELLIPSIS # long label truncation feature
DEFINES += HAVE_BAGL_FONT_OPEN_SANS_REGULAR_11PX
DEFINES += HAVE_BAGL_FONT_OPEN_SANS_EXTRABOLD_11PX
DEFINES += HAVE_BAGL_FONT_OPEN_SANS_LIGHT_16PX
endif

ifeq ($(TARGET_NAME),TARGET_STAX)
DEFINES += NBGL_QRCODE
SDK_SOURCE_PATH += qrcode
else
DEFINES += HAVE_BAGL HAVE_UX_FLOW
ifneq ($(TARGET_NAME),TARGET_NANOS)
DEFINES += HAVE_GLO096
DEFINES += BAGL_WIDTH=128 BAGL_HEIGHT=64
DEFINES += HAVE_BAGL_ELLIPSIS # long label truncation feature
DEFINES += HAVE_BAGL_FONT_OPEN_SANS_REGULAR_11PX
DEFINES += HAVE_BAGL_FONT_OPEN_SANS_EXTRABOLD_11PX
DEFINES += HAVE_BAGL_FONT_OPEN_SANS_LIGHT_16PX
endif
endif

DEFINES += UNUSED\(x\)=\(void\)x

# Enabling debug PRINTF
DEBUG ?= 0
ifneq ($(DEBUG),0)
Expand Down Expand Up @@ -130,9 +143,9 @@ endif
CC := $(CLANGPATH)clang

ifeq ($(APP),tezos_wallet)
CFLAGS += -O3 -Os -Wall -Wextra
CFLAGS += -O3 -Os -Wall -Wextra -Wno-incompatible-pointer-types-discards-qualifiers
else ifeq ($(APP),tezos_baking)
CFLAGS += -DBAKING_APP -O3 -Os -Wall -Wextra
CFLAGS += -DBAKING_APP -O3 -Os -Wall -Wextra -Wno-incompatible-pointer-types-discards-qualifiers
else
ifeq ($(filter clean,$(MAKECMDGOALS)),)
$(error Unsupported APP - use tezos_wallet, tezos_baking)
Expand All @@ -150,7 +163,11 @@ include $(BOLOS_SDK)/Makefile.glyphs

### computed variables
APP_SOURCE_PATH += src
SDK_SOURCE_PATH += lib_stusb lib_stusb_impl lib_ux
SDK_SOURCE_PATH += lib_stusb lib_stusb_impl

ifneq ($(TARGET_NAME),TARGET_STAX)
SDK_SOURCE_PATH += lib_ux
endif

### U2F support (wallet app only)
ifeq ($(APP), tezos_wallet)
Expand All @@ -162,6 +179,13 @@ DEFINES += U2F_PROXY_MAGIC=\"XTZ\"
DEFINES += HAVE_IO_U2F HAVE_U2F
endif

### webusb support (wallet app only)
ifeq ($(APP), tezos_wallet)
#WEBUSB_URL = www.ledgerwallet.com
#DEFINES += HAVE_WEBUSB WEBUSB_URL_SIZE_B=$(shell echo -n $(WEBUSB_URL) | wc -c) WEBUSB_URL=$(shell echo -n $(WEBUSB_URL) | sed -e "s/./\\\'\0\\\',/g")
DEFINES += HAVE_WEBUSB WEBUSB_URL_SIZE_B=0 WEBUSB_URL=""
endif

load: all
python3 -m ledgerblue.loadApp $(APP_LOAD_PARAMS)

Expand All @@ -182,4 +206,4 @@ endif
# Generate delegates from baker list
src/delegates.h: tools/gen-delegates.sh tools/BakersRegistryCoreUnfilteredData.json
bash ./tools/gen-delegates.sh ./tools/BakersRegistryCoreUnfilteredData.json
$(DEP_DIR)/to_string.d: src/delegates.h
$(DEP_DIR)/to_string.d $(DEP_DIR)/app/to_string.d: src/delegates.h
Binary file added glyphs/tezos.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 icons/stax_tezos.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 13 additions & 8 deletions src/apdu.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include <stdint.h>
#include <string.h>

size_t provide_pubkey(uint8_t *const io_buffer, cx_ecfp_public_key_t const *const pubkey) {
size_t provide_pubkey(uint8_t* const io_buffer, cx_ecfp_public_key_t const* const pubkey) {
check_null(io_buffer);
check_null(pubkey);
size_t tx = 0;
Expand All @@ -22,17 +22,20 @@ size_t provide_pubkey(uint8_t *const io_buffer, cx_ecfp_public_key_t const *cons
return finalize_successful_send(tx);
}

size_t handle_apdu_error(uint8_t __attribute__((unused)) instruction) {
size_t handle_apdu_error(uint8_t __attribute__((unused)) instruction,
volatile uint32_t* __attribute__((unused)) flags) {
THROW(EXC_INVALID_INS);
}

size_t handle_apdu_version(uint8_t __attribute__((unused)) instruction) {
size_t handle_apdu_version(uint8_t __attribute__((unused)) instruction,
volatile uint32_t* __attribute__((unused)) flags) {
memcpy(G_io_apdu_buffer, &version, sizeof(version_t));
size_t tx = sizeof(version_t);
return finalize_successful_send(tx);
}

size_t handle_apdu_git(uint8_t __attribute__((unused)) instruction) {
size_t handle_apdu_git(uint8_t __attribute__((unused)) instruction,
volatile uint32_t* __attribute__((unused)) flags) {
static const char commit[] = COMMIT;
memcpy(G_io_apdu_buffer, commit, sizeof(commit));
size_t tx = sizeof(commit);
Expand All @@ -41,9 +44,10 @@ size_t handle_apdu_git(uint8_t __attribute__((unused)) instruction) {

#define CLA 0x80

__attribute__((noreturn)) void main_loop(apdu_handler const *const handlers,
__attribute__((noreturn)) void main_loop(apdu_handler const* const handlers,
size_t const handlers_size) {
volatile size_t rx = io_exchange(CHANNEL_APDU, 0);
volatile uint32_t flags = 0;
while (true) {
BEGIN_TRY {
TRY {
Expand Down Expand Up @@ -71,8 +75,9 @@ __attribute__((noreturn)) void main_loop(apdu_handler const *const handlers,
apdu_handler const cb =
instruction >= handlers_size ? handle_apdu_error : handlers[instruction];

size_t const tx = cb(instruction);
rx = io_exchange(CHANNEL_APDU, tx);
size_t const tx = cb(instruction, &flags);
rx = io_exchange(CHANNEL_APDU | flags, tx);
flags = 0;
}
CATCH(ASYNC_EXCEPTION) {
rx = io_exchange(CHANNEL_APDU | IO_ASYNCH_REPLY, 0);
Expand All @@ -89,7 +94,7 @@ __attribute__((noreturn)) void main_loop(apdu_handler const *const handlers,
switch (sw) {
default:
sw = 0x6800 | (e & 0x7FF);
// FALL THROUGH
__attribute__((fallthrough));
case 0x6000 ... 0x6FFF:
case 0x9000 ... 0x9FFF: {
PRINTF("Line number: %d", sw & 0x0FFF);
Expand Down
10 changes: 5 additions & 5 deletions src/apdu.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
#define INS_HMAC 0x0E
#define INS_SIGN_WITH_HASH 0x0F

__attribute__((noreturn)) void main_loop(apdu_handler const *const handlers,
__attribute__((noreturn)) void main_loop(apdu_handler const* const handlers,
size_t const handlers_size);

static inline size_t finalize_successful_send(size_t tx) {
Expand Down Expand Up @@ -69,8 +69,8 @@ static inline void require_permissioned_comm(void) {
}
}

size_t provide_pubkey(uint8_t *const io_buffer, cx_ecfp_public_key_t const *const pubkey);
size_t provide_pubkey(uint8_t* const io_buffer, cx_ecfp_public_key_t const* const pubkey);

size_t handle_apdu_error(uint8_t instruction);
size_t handle_apdu_version(uint8_t instruction);
size_t handle_apdu_git(uint8_t instruction);
size_t handle_apdu_error(uint8_t instruction, volatile uint32_t* flags);
size_t handle_apdu_version(uint8_t instruction, volatile uint32_t* flags);
size_t handle_apdu_git(uint8_t instruction, volatile uint32_t* flags);
Loading
Loading