Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 5 additions & 29 deletions .github/workflows/codeql_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,35 +10,11 @@ on:
pull_request:
# Excluded path: add the paths you want to ignore instead of deleting the workflow
paths-ignore:
- ".github/workflows/*.yml"
- "tests/*"
- '.github/workflows/*.yml'
- 'tests/*'

jobs:
analyse:
name: Analyse
strategy:
matrix:
sdk: ["$NANOX_SDK", "$NANOSP_SDK", "$STAX_SDK", "$FLEX_SDK"]
#'cpp' covers C and C++
language: ["cpp"]
runs-on: ubuntu-latest
container:
image: ghcr.io/ledgerhq/ledger-app-builder/ledger-app-builder-legacy:latest

steps:
- name: Clone
uses: actions/checkout@v3

- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
queries: security-and-quality

# CodeQL will create the database during the compilation
- name: Build
run: |
make BOLOS_SDK=${{ matrix.sdk }}

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
name: Call Ledger CodeQL analysis
uses: LedgerHQ/ledger-app-workflows/.github/workflows/reusable_codeql_checks.yml@v1
secrets: inherit
39 changes: 11 additions & 28 deletions .github/workflows/python_client_checks.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
name: Checks on the Python client

# This workflow performs some checks on the Python client used by the Aptos tests
# This workflow performs some checks on the Python client used by the ragger tests
# It is there to help us maintain a level of quality in our codebase and does not have to be kept on forked
# applications.

on:
workflow_dispatch:
Expand All @@ -12,31 +14,12 @@ on:
pull_request:

jobs:

lint:
name: Aptos client linting
runs-on: ubuntu-latest
steps:
- name: Clone
uses: actions/checkout@v3
- name: Installing PIP dependencies
run: |
pip install pylint
pip install --extra-index-url https://test.pypi.org/simple/ -r tests/requirements.txt
- name: Lint Python code
run: |
pylint --rc tests/setup.cfg tests/application_client/

mypy:
name: Type checking
runs-on: ubuntu-latest
steps:
- name: Clone
uses: actions/checkout@v3
- name: Installing PIP dependencies
run: |
pip install mypy
pip install --extra-index-url https://test.pypi.org/simple/ -r tests/requirements.txt
- name: Mypy type checking
run: |
mypy tests/application_client/
name: Call Ledger Python linters
uses: LedgerHQ/ledger-app-workflows/.github/workflows/reusable_python_checks.yml@v1
with:
run_linter: pylint
run_type_check: true
src_directory: application_client
setup_directory: tests
req_directory: tests
52 changes: 5 additions & 47 deletions .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,50 +11,8 @@ on:

jobs:
job_unit_test:
name: Unit test
runs-on: ubuntu-latest
container:
image: ghcr.io/ledgerhq/ledger-app-builder/ledger-app-builder-lite:latest

steps:
- name: Clone
uses: actions/checkout@v3

- name: Clone SDK
uses: actions/checkout@v3
with:
repository: ledgerHQ/ledger-secure-sdk
path: sdk

- name: Build unit tests
run: |
cd unit-tests/
export BOLOS_SDK=../sdk
cmake -Bbuild -H. && make -C build && make -C build test

- name: Generate code coverage
run: |
cd unit-tests/
lcov --directory . -b "$(realpath build/)" --capture --initial -o coverage.base && \
lcov --rc lcov_branch_coverage=1 --directory . -b "$(realpath build/)" --capture -o coverage.capture && \
lcov --directory . -b "$(realpath build/)" --add-tracefile coverage.base --add-tracefile coverage.capture -o coverage.info && \
lcov --directory . -b "$(realpath build/)" --remove coverage.info '*/unit-tests/*' -o coverage.info && \
genhtml coverage.info -o coverage

- uses: actions/upload-artifact@v4
with:
name: code-coverage
path: unit-tests/coverage

- name: Install codecov dependencies
run: apt-get update && apt-get install -y gnupg gnupg-agent

- name: Upload to codecov.io
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./unit-tests/coverage.info
flags: unittests
name: codecov-app-aptos
fail_ci_if_error: true
verbose: true
name: Call Ledger unit_test
uses: LedgerHQ/ledger-app-workflows/.github/workflows/reusable_unit_tests.yml@v1
secrets: inherit
with:
test_directory: unit-tests
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.10.0]

### Added

- Support for apex p device.

## [0.9.14]

### Added
Expand Down
12 changes: 5 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,8 @@ endif
ifeq ($(TARGET_NAME),TARGET_NANOX)
DEFINES += MAX_TRANSACTION_PACKETS=90
endif
ifeq ($(TARGET_NAME),TARGET_STAX)
# still need to find the right value
DEFINES += MAX_TRANSACTION_PACKETS=70
endif
ifeq ($(TARGET_NAME),TARGET_FLEX)

ifeq ($(TARGET_NAME),$(filter $(TARGET_NAME),TARGET_STAX TARGET_FLEX TARGET_APEX_P))
# still need to find the right value
DEFINES += MAX_TRANSACTION_PACKETS=70
endif
Expand All @@ -48,8 +45,8 @@ APPNAME = "Aptos"

# Application version
APPVERSION_M = 0
APPVERSION_N = 9
APPVERSION_P = 14
APPVERSION_N = 10
APPVERSION_P = 0
APPVERSION = "$(APPVERSION_M).$(APPVERSION_N).$(APPVERSION_P)"

# Application source files
Expand All @@ -60,6 +57,7 @@ ICON_NANOX = icons/app_aptos_14px.gif
ICON_NANOSP = icons/app_aptos_14px.gif
ICON_STAX = icons/app_aptos_32px.gif
ICON_FLEX = icons/app_aptos_40px.gif
ICON_APEX_P = icons/app_aptos_32px_apex.png

# Application allowed derivation curves
CURVE_APP_LOAD_PARAMS = ed25519
Expand Down
7 changes: 1 addition & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
# Ledger Aptos Application

Aptos wallet application supporting the following Ledger devices:

- Nano S Plus
- Nano X
- Stax
- Flex
Aptos wallet application supporting all the Ledger devices

## Prerequisite

Expand Down
Binary file added glyphs/aptos_logo_48px.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 icons/app_aptos_32px_apex.png
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 ledger_app.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[app]
build_directory = "./"
sdk = "C"
devices = ["nanox", "nanos+", "stax", "flex"]
devices = ["nanox", "nanos+", "stax", "flex", "apex_p"]

[tests]
unit_directory = "./unit-tests/"
Expand Down
11 changes: 10 additions & 1 deletion src/app_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@
#include "ui/menu.h"
#include "apdu/dispatcher.h"

#ifdef HAVE_SWAP
#include "swap.h"
#endif

global_ctx_t G_context;
const app_storage_t N_app_storage;

Expand All @@ -52,7 +56,12 @@ void app_main() {

io_init();
nvm_app_storage_init();
ui_menu_main();

#ifdef HAVE_SWAP
if (!G_called_from_swap) {
ui_menu_main();
}
#endif // HAVE_SWAP

// Reset context
explicit_bzero(&G_context, sizeof(G_context));
Expand Down
6 changes: 6 additions & 0 deletions src/ui/display.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,9 @@ int ui_prepare_tx_fungible_asset_transfer(void);

int ui_display_delegation_pool_transfer(entry_function_known_type_t function_type);
int ui_prepare_delegation_pool_transfer(void);

#if defined(TARGET_STAX) || defined(TARGET_FLEX)
#define ICON_APP_HOME C_aptos_logo_64px
#elif defined(TARGET_APEX_P)
#define ICON_APP_HOME C_aptos_logo_48px
#endif
2 changes: 1 addition & 1 deletion src/ui/nbgl_display.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ void nbgl_useCaseReviewVerify(nbgl_operationType_t operation_type,
if (N_storage.settings.allow_blind_signing) {
blind_sign_info();
} else {
nbgl_useCaseChoice(&C_Warning_64px,
nbgl_useCaseChoice(&LARGE_WARNING_ICON,
"Enable blind signing to authorize this operation?",
NULL,
"Enable blind signing",
Expand Down
2 changes: 1 addition & 1 deletion src/ui/nbgl_display_address.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ int ui_display_address() {

nbgl_useCaseAddressReview(g_address,
&pair_list,
&C_aptos_logo_64px,
&ICON_APP_HOME,
"Verify Aptos address",
NULL,
confirm_address);
Expand Down
8 changes: 4 additions & 4 deletions src/ui/nbgl_display_message.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ int ui_display_message() {
if (is_str_interrupted((const char *) G_context.tx_info.raw_tx, G_context.tx_info.raw_tx_len)) {
nbgl_useCaseReviewVerify(TYPE_MESSAGE,
&pair_list,
&C_Review_64px,
&LARGE_REVIEW_ICON,
"Review message",
NULL,
"Sign message?",
Expand All @@ -64,7 +64,7 @@ int ui_display_message() {
} else {
nbgl_useCaseReview(TYPE_MESSAGE,
&pair_list,
&C_Review_64px,
&LARGE_REVIEW_ICON,
"Review message",
NULL,
"Sign message?",
Expand Down Expand Up @@ -98,7 +98,7 @@ int ui_display_raw_message() {
if (!short_enough) {
nbgl_useCaseReviewVerify(TYPE_MESSAGE,
&pair_list,
&C_Review_64px,
&LARGE_REVIEW_ICON,
"Review message",
NULL,
"Sign message?",
Expand All @@ -107,7 +107,7 @@ int ui_display_raw_message() {
} else {
nbgl_useCaseReview(TYPE_MESSAGE,
&pair_list,
&C_Review_64px,
&LARGE_REVIEW_ICON,
"Review message",
NULL,
"Sign message?",
Expand Down
12 changes: 6 additions & 6 deletions src/ui/nbgl_display_transaction.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ int ui_display_transaction() {

nbgl_useCaseReviewVerify(TYPE_TRANSACTION,
&pair_list,
&C_aptos_logo_64px,
&ICON_APP_HOME,
"Review transaction",
NULL,
"Sign transaction?",
Expand Down Expand Up @@ -83,7 +83,7 @@ int ui_display_entry_function() {

nbgl_useCaseReviewVerify(TYPE_TRANSACTION,
&pair_list,
&C_aptos_logo_64px,
&ICON_APP_HOME,
"Review transaction",
NULL,
"Sign transaction?",
Expand Down Expand Up @@ -115,7 +115,7 @@ int ui_display_tx_aptos_account_transfer() {

nbgl_useCaseReview(TYPE_TRANSACTION,
&pair_list,
&C_aptos_logo_64px,
&ICON_APP_HOME,
"Review transaction to send Aptos",
NULL,
"Sign transaction?",
Expand Down Expand Up @@ -144,7 +144,7 @@ void ui_listed_coin_transfer_flow_display() {

nbgl_useCaseReview(TYPE_TRANSACTION,
&pair_list,
&C_aptos_logo_64px,
&ICON_APP_HOME,
"Review transaction to transfer coins",
NULL,
"Sign transaction to transfer coins?",
Expand All @@ -171,7 +171,7 @@ void ui_unlisted_coin_transfer_flow_display() {

nbgl_useCaseReview(TYPE_TRANSACTION,
&pair_list,
&C_aptos_logo_64px,
&ICON_APP_HOME,
"Review transaction to transfer coins",
NULL,
"Sign transaction to transfer coins?",
Expand Down Expand Up @@ -267,7 +267,7 @@ void ui_delegation_pool_flow_display(entry_function_known_type_t function_type)

nbgl_useCaseReview(TYPE_TRANSACTION,
&pair_list,
&C_aptos_logo_64px,
&ICON_APP_HOME,
get_delegation_title(function_type),
NULL,
get_delegation_sign_review(function_type),
Expand Down
3 changes: 2 additions & 1 deletion src/ui/nbgl_menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include "../globals.h"
#include "menu.h"
#include "settings.h"
#include "display.h"

#define SETTINGS_PAGE_NUMBER 2

Expand Down Expand Up @@ -94,7 +95,7 @@ void ui_menu_main(void) {
N_storage.settings.allow_blind_signing == 0 ? OFF_STATE : ON_STATE;

nbgl_useCaseHomeAndSettings(APPNAME,
&C_aptos_logo_64px,
&ICON_APP_HOME,
NULL,
INIT_HOME_PAGE,
&g_setting_contents,
Expand Down
Loading
Loading