Skip to content

Commit

Permalink
Merge pull request #2 from blooo-io/ci/LDG-533--nano-app-run-the-ci-c…
Browse files Browse the repository at this point in the history
…d-and-resolve-issues

[LDG-533]: run ci
  • Loading branch information
keiff3r authored Nov 15, 2024
2 parents 4dc7899 + 02a7304 commit c5acdef
Show file tree
Hide file tree
Showing 112 changed files with 81 additions and 85 deletions.
6 changes: 3 additions & 3 deletions .clusterfuzzlite/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ FROM ghcr.io/ledgerhq/ledger-app-builder/ledger-app-builder-lite:latest AS LITE_
FROM gcr.io/oss-fuzz-base/base-builder:v1

# Copy the project's source code.
COPY . $SRC/app-boilerplate
COPY --from=LITE_BUILDER /opt/ledger-secure-sdk $SRC/app-boilerplate/BOLOS_SDK
COPY . $SRC/concordium-ledger-app
COPY --from=LITE_BUILDER /opt/ledger-secure-sdk $SRC/concordium-ledger-app/BOLOS_SDK

# Working directory for build.sh
WORKDIR $SRC/app-boilerplate
WORKDIR $SRC/concordium-ledger-app

# Copy build.sh into $SRC dir.
COPY ./.clusterfuzzlite/build.sh $SRC/
2 changes: 1 addition & 1 deletion .doxygen/Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ DOXYFILE_ENCODING = UTF-8
# title of most generated pages and in a few other places.
# The default value is: My Project.

PROJECT_NAME = "Boilerplate"
PROJECT_NAME = "Concordium"

# The PROJECT_NUMBER tag can be used to enter a project or revision number. This
# could be handy for archiving the generated documentation or if some version
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/coding_style_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ name: Run coding style check through reusable workflow
#
# The presence of this workflow is mandatory as a minimal level of linting is required.
# You are however free to modify the content of the .clang-format file and thus the coding style of your application.
# We simply ask you to not diverge too much from the linting of the Boilerplate application.
# We simply ask you to not diverge too much from the linting of the Concordium application.

on:
workflow_dispatch:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/python_client_checks.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Checks on the Python client

# This workflow performs some checks on the Python client used by the Boilerplate tests
# This workflow performs some checks on the Python client used by the Concordium 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.

Expand All @@ -16,7 +16,7 @@ on:
jobs:

lint:
name: Boilerplate client linting
name: Concordium client linting
runs-on: ubuntu-latest
steps:
- name: Clone
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ jobs:
image: ghcr.io/ledgerhq/ledger-app-builder/ledger-app-builder-lite:latest

steps:

- name: Clone
uses: actions/checkout@v3

Expand Down Expand Up @@ -52,6 +53,8 @@ jobs:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./unit-tests/coverage.info
flags: unittests
name: codecov-app-boilerplate
name: codecov-app-concordium
fail_ci_if_error: true
verbose: true
env:
CODECOV_DEBUG: true
2 changes: 1 addition & 1 deletion .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"USB_SEGMENT_SIZE=64",
"UNUSED(x)=(void)x",
"APPVERSION=\"1.0.0\"",
"APPNAME=\"Boilerplate\"",
"APPNAME=\"Concordium\"",
"MAJOR_VERSION=1",
"MINOR_VERSION=0",
"PATCH_VERSION=0",
Expand Down
4 changes: 4 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,8 @@
"editor.formatOnSave": false,
"python.terminal.activateEnvironment": false,
"git.ignoreLimitWarning": true,
"ledgerDevTools.appSettings": {
"selectedUseCase": "release",
"selectedVariant": "CCD"
},
}
20 changes: 10 additions & 10 deletions APP_SPECIFICATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,20 @@ This documentation is a template and shall be updated with your own APDUs.

## About

This documentation describes the APDU messages interface to communicate with the Boilerplate application.
This documentation describes the APDU messages interface to communicate with the Concordium application.

The application covers the following functionalities :

- Get a public Boilerplate address given a BIP 32 path
- Sign a basic Boilerplate transaction given a BIP 32 path and raw transaction
- Retrieve the Boilerplate app version
- Retrieve the Boilerplate app name
- Get a public Concordium address given a BIP 32 path
- Sign a basic Concordium transaction given a BIP 32 path and raw transaction
- Retrieve the Concordium app version
- Retrieve the Concordium app name

The application interface can be accessed over HID or BLE

## APDUs

### GET BOILERPLATE PUBLIC ADDRESS
### GET Concordium PUBLIC ADDRESS

#### Description

Expand Down Expand Up @@ -54,11 +54,11 @@ The address can be optionally checked on the device before being returned.
| Chain code | var |


### SIGN BOILERPLATE TRANSACTION
### SIGN Concordium TRANSACTION

#### Description

This command signs a Boilerplate transaction after having the user validate the transactions parameters.
This command signs a Concordium transaction after having the user validate the transactions parameters.

The input data is the RLP encoded transaction streamed to the device in 255 bytes maximum data chunks.

Expand Down Expand Up @@ -100,7 +100,7 @@ The input data is the RLP encoded transaction streamed to the device in 255 byte

#### Description

This command returns boilerplate application version
This command returns Concordium application version

#### Coding

Expand All @@ -127,7 +127,7 @@ None

#### Description

This command returns boilerplate application name
This command returns Concordium application name

#### Coding

Expand Down
14 changes: 7 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# ****************************************************************************
# Ledger App Boilerplate
# Ledger App Concordium
# (c) 2023 Ledger SAS.
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -25,7 +25,7 @@ include $(BOLOS_SDK)/Makefile.defines
# Mandatory configuration #
########################################
# Application name
APPNAME = "Boilerplate"
APPNAME = "Concordium"

# Application version
APPVERSION_M = 2
Expand All @@ -38,10 +38,10 @@ APP_SOURCE_PATH += src

# Application icons following guidelines:
# https://developers.ledger.com/docs/embedded-app/design-requirements/#device-icon
ICON_NANOX = icons/app_boilerplate_14px.gif
ICON_NANOSP = icons/app_boilerplate_14px.gif
ICON_STAX = icons/app_boilerplate_32px.gif
ICON_FLEX = icons/app_boilerplate_40px.gif
ICON_NANOX = icons/app_concordium_14px.gif
ICON_NANOSP = icons/app_concordium_14px.gif
ICON_STAX = icons/app_concordium_32px.gif
ICON_FLEX = icons/app_concordium_40px.gif

# Application allowed derivation curves.
# Possibles curves are: secp256k1, secp256r1, ed25519 and bls12381g1
Expand All @@ -65,7 +65,7 @@ PATH_APP_LOAD_PARAMS = "44'/1'" # purpose=coin(44) / coin_type=Testnet(1)
# * It must at least contains one value.
# * Values can be the app ticker or anything else but should be unique.
VARIANT_PARAM = COIN
VARIANT_VALUES = BOL
VARIANT_VALUES = CCD

# Enabling DEBUG flag will enable PRINTF and disable optimizations
#DEBUG = 1
Expand Down
23 changes: 6 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
[![Ensure compliance with Ledger guidelines](https://github.com/LedgerHQ/app-boilerplate/actions/workflows/guidelines_enforcer.yml/badge.svg)](https://github.com/LedgerHQ/app-boilerplate/actions/workflows/guidelines_enforcer.yml) [![Build and run functional tests using ragger through reusable workflow](https://github.com/LedgerHQ/app-boilerplate/actions/workflows/build_and_functional_tests.yml/badge.svg?branch=master)](https://github.com/LedgerHQ/app-boilerplate/actions/workflows/build_and_functional_tests.yml)
[![Ensure compliance with Ledger guidelines](https://github.com/blooo-io/concordium-ledger-app/actions/workflows/guidelines_enforcer.yml/badge.svg)](https://github.com/blooo-io/concordium-ledger-app/actions/workflows/guidelines_enforcer.yml) [![Build and run functional tests using ragger through reusable workflow](https://github.com/blooo-io/concordium-ledger-app/actions/workflows/build_and_functional_tests.yml/badge.svg)](https://github.com/blooo-io/concordium-ledger-app/actions/workflows/build_and_functional_tests.yml)

# Ledger Boilerplate Application

This is a boilerplate application which can be forked to start a new project for the Ledger Nano X/SP, Stax and Flex.
# Ledger Concordium Application

## Quick start guide

Expand All @@ -18,8 +16,8 @@ It will allow you, whether you are developing on macOS, Windows or Linux to quic
* On macOS, install and launch [XQuartz](https://www.xquartz.org/) (make sure to go to XQuartz > Preferences > Security and check "Allow client connections").
* On Windows, install and launch [VcXsrv](https://sourceforge.net/projects/vcxsrv/) (make sure to configure it to disable access control).
* Install [VScode](https://code.visualstudio.com/download) and add [Ledger's extension](https://marketplace.visualstudio.com/items?itemName=LedgerHQ.ledger-dev-tools).
* Open a terminal and clone `app-boilerplate` with `git clone [email protected]:LedgerHQ/app-boilerplate.git`.
* Open the `app-boilerplate` folder with VSCode.
* Open a terminal and clone `concordium-ledger-app` with `git clone [email protected]:LedgerHQ/concordium-ledger-app.git`.
* Open the `concordium-ledger-app` folder with VSCode.
* Use Ledger extension's sidebar menu or open the tasks menu with `ctrl + shift + b` (`command + shift + b` on a Mac) to conveniently execute actions :
* Build the app for the device model of your choice with `Build`.
* Test your binary on [Speculos](https://github.com/LedgerHQ/speculos) with `Run with Speculos`.
Expand Down Expand Up @@ -136,7 +134,7 @@ python3 -m ledgerblue.runScript --scp --fileName bin/app.apdu --elfFile bin/app.

## Test

The boilerplate app comes with functional tests implemented with Ledger's [Ragger](https://github.com/LedgerHQ/ragger) test framework.
The concordium app comes with functional tests implemented with Ledger's [Ragger](https://github.com/LedgerHQ/ragger) test framework.

### macOS / Windows

Expand Down Expand Up @@ -204,13 +202,4 @@ The flow processed in [GitHub Actions](https://github.com/features/actions) is t
It outputs 3 artifacts:
- `compiled_app_binaries` within binary files of the build process for each device
- `code-coverage` within HTML details of code coverage
- `documentation` within HTML auto-generated documentation

## Are you developing an application for Ledger devices?

If so, This boilerplate will help you get started.

For a smooth and quick integration:

- See the developers’ documentation on the [Developer Portal](https://developers.ledger.com/), and
- [Go on Discord](https://developers.ledger.com/discord-pro/) to chat with developer support and the developer community.
- `documentation` within HTML auto-generated documentation
2 changes: 1 addition & 1 deletion doc/TRANSACTION.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ The custom transaction serialization presented is for the purely fictitious BOLO

## Amount units

The base unit in BOLOK *chain* is the BOL and the smallest unit used in raw transaction is the *bolino* or mBOL: 1 BOL = 1000 mBOL.
The base unit in BOLOK *chain* is the CCD and the smallest unit used in raw transaction is the *bolino* or mBOL: 1 CCD = 1000 mCCD.

## Address format

Expand Down
6 changes: 3 additions & 3 deletions fuzzing/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

Fuzzing allows us to test how a program behaves when provided with invalid, unexpected, or random data as input.

In the case of `app-boilerplate` we want to test the code that is responsible for parsing the transaction data, which is `transaction_deserialize()`. To test `transaction_deserialize()`, our fuzz target, `fuzz_tx_parser.c`, needs to implement `int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)`, which provides an array of random bytes that can be used to simulate a serialized transaction. If the application crashes, or a [sanitizer](https://github.com/google/sanitizers) detects any kind of access violation, the fuzzing process is stopped, a report regarding the vulnerability is shown, and the input that triggered the bug is written to disk under the name `crash-*`. The vulnerable input file created can be passed as an argument to the fuzzer to triage the issue.
In the case of `concordium-ledger-app` we want to test the code that is responsible for parsing the transaction data, which is `transaction_deserialize()`. To test `transaction_deserialize()`, our fuzz target, `fuzz_tx_parser.c`, needs to implement `int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)`, which provides an array of random bytes that can be used to simulate a serialized transaction. If the application crashes, or a [sanitizer](https://github.com/google/sanitizers) detects any kind of access violation, the fuzzing process is stopped, a report regarding the vulnerability is shown, and the input that triggered the bug is written to disk under the name `crash-*`. The vulnerable input file created can be passed as an argument to the fuzzer to triage the issue.

> **Note**: Usually we want to write a separate fuzz target for each functionality.
Expand Down Expand Up @@ -61,13 +61,13 @@ The principle is to build the container, and run it to perform the fuzzing.
# Prepare directory tree
mkdir fuzzing/{corpus,out}
# Container generation
docker build -t app-boilerplate --file .clusterfuzzlite/Dockerfile .
docker build -t concordium-ledger-app --file .clusterfuzzlite/Dockerfile .
```

### Compilation

```console
docker run --rm --privileged -e FUZZING_LANGUAGE=c -v "$(realpath .)/fuzzing/out:/out" -ti app-boilerplate
docker run --rm --privileged -e FUZZING_LANGUAGE=c -v "$(realpath .)/fuzzing/out:/out" -ti concordium-ledger-app
```

### Run
Expand Down
2 changes: 1 addition & 1 deletion fuzzing/extra/TxParser.cmake
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# project information
project(TxParser
VERSION 1.0
DESCRIPTION "Transaction parser of Boilerplate app"
DESCRIPTION "Transaction parser of Concordium app"
LANGUAGES C)

# specify C standard
Expand Down
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
2 changes: 1 addition & 1 deletion src/address.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*****************************************************************************
* Ledger App Boilerplate.
* Ledger App Concordium.
* (c) 2020 Ledger SAS.
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
2 changes: 1 addition & 1 deletion src/apdu/dispatcher.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*****************************************************************************
* Ledger App Boilerplate.
* Ledger App Concordium.
* (c) 2020 Ledger SAS.
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
2 changes: 1 addition & 1 deletion src/app_main.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*****************************************************************************
* Ledger App Boilerplate.
* Ledger App Concordium.
* (c) 2020 Ledger SAS.
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
4 changes: 2 additions & 2 deletions src/constants.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once

/**
* Instruction class of the Boilerplate application.
* Instruction class of the Concordium application.
*/
#define CLA 0xE0

Expand Down Expand Up @@ -31,6 +31,6 @@
#define MAX_DER_SIG_LEN 72

/**
* Exponent used to convert mBOL to BOL unit (N BOL = N * 10^3 mBOL).
* Exponent used to convert mCCD to CCD unit (N CCD = N * 10^3 mCCD).
*/
#define EXPONENT_SMALLEST_UNIT 3
2 changes: 1 addition & 1 deletion src/handler/get_app_name.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*****************************************************************************
* Ledger App Boilerplate.
* Ledger App Concordium.
* (c) 2020 Ledger SAS.
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
2 changes: 1 addition & 1 deletion src/handler/get_public_key.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*****************************************************************************
* Ledger App Boilerplate.
* Ledger App Concordium.
* (c) 2020 Ledger SAS.
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
2 changes: 1 addition & 1 deletion src/handler/get_version.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*****************************************************************************
* Ledger App Boilerplate.
* Ledger App Concordium.
* (c) 2020 Ledger SAS.
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
2 changes: 1 addition & 1 deletion src/handler/sign_tx.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*****************************************************************************
* Ledger App Boilerplate.
* Ledger App Concordium.
* (c) 2020 Ledger SAS.
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
2 changes: 1 addition & 1 deletion src/helper/send_reponse.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*****************************************************************************
* Ledger App Boilerplate.
* Ledger App Concordium.
* (c) 2020 Ledger SAS.
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
2 changes: 1 addition & 1 deletion src/transaction/deserialize.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*****************************************************************************
* Ledger App Boilerplate.
* Ledger App Concordium.
* (c) 2020 Ledger SAS.
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
2 changes: 1 addition & 1 deletion src/transaction/serialize.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*****************************************************************************
* Ledger App Boilerplate.
* Ledger App Concordium.
* (c) 2020 Ledger SAS.
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
2 changes: 1 addition & 1 deletion src/transaction/utils.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*****************************************************************************
* Ledger App Boilerplate.
* Ledger App Concordium.
* (c) 2020 Ledger SAS.
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
2 changes: 1 addition & 1 deletion src/ui/action/validate.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*****************************************************************************
* Ledger App Boilerplate.
* Ledger App Concordium.
* (c) 2020 Ledger SAS.
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
4 changes: 2 additions & 2 deletions src/ui/bagl_display.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*****************************************************************************
* Ledger App Boilerplate.
* Ledger App Concordium.
* (c) 2020 Ledger SAS.
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -153,7 +153,7 @@ int ui_display_transaction() {
EXPONENT_SMALLEST_UNIT)) {
return io_send_sw(SW_DISPLAY_AMOUNT_FAIL);
}
snprintf(g_amount, sizeof(g_amount), "BOL %.*s", sizeof(amount), amount);
snprintf(g_amount, sizeof(g_amount), "CCD %.*s", sizeof(amount), amount);
PRINTF("Amount: %s\n", g_amount);

memset(g_address, 0, sizeof(g_address));
Expand Down
Loading

0 comments on commit c5acdef

Please sign in to comment.