Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

B2CA-1838: Implement swap #82

Merged
merged 28 commits into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
233404f
Update gitignore
cedelavergne-ledger Oct 18, 2024
a204239
Implement 1st ragger tests (Version, Serial, App Name)
cedelavergne-ledger Oct 18, 2024
f8ecf27
Reusable ragger tests
cedelavergne-ledger Oct 21, 2024
f443a63
Add Derive Address tests
cedelavergne-ledger Oct 18, 2024
2c2acfb
Add Get Public Key tests
cedelavergne-ledger Oct 22, 2024
93d8a3a
Add SignCVote tests
cedelavergne-ledger Oct 22, 2024
e9498ae
Add SignOperationCertificate tests
cedelavergne-ledger Oct 23, 2024
cd029fc
Add SignMessage tests
cedelavergne-ledger Oct 23, 2024
e3804f4
Add SignTx tests
cedelavergne-ledger Oct 29, 2024
0ff3adb
Add Derive Native Script hash tests
cedelavergne-ledger Nov 4, 2024
7ff80f2
Add linter config files
cedelavergne-ledger Nov 5, 2024
a0d615a
Run linters
cedelavergne-ledger Nov 5, 2024
a5a15bd
Remove useless flag 'APP_FEATURE_TOKEN_MINTING'
cedelavergne-ledger Nov 6, 2024
c5d6ced
Reorganize icons and glyphs
cedelavergne-ledger Nov 4, 2024
4f19756
Reorganize src tree files
cedelavergne-ledger Nov 5, 2024
1617adf
Enable Standard App
cedelavergne-ledger Nov 5, 2024
6a8560f
Standard App: change errors.h
cedelavergne-ledger Nov 6, 2024
a6fd6fc
Standard App: change io.c/io.h
cedelavergne-ledger Nov 6, 2024
a999b9e
Standard App: change main()
cedelavergne-ledger Nov 6, 2024
0837989
Separate flag to debug stack memory consumption, to limit logs
cedelavergne-ledger Nov 18, 2024
4576e18
Add function to check bip44 avoiding the THROW
cedelavergne-ledger Nov 19, 2024
e295ae1
Update documentation
cedelavergne-ledger Nov 6, 2024
ef43256
Fix fuzzing
cedelavergne-ledger Nov 5, 2024
54ae577
Prepare SWAP
cedelavergne-ledger Nov 8, 2024
efa1734
Disable swap for nanos
cedelavergne-ledger Nov 14, 2024
7065280
No UI when called from swap
cedelavergne-ledger Nov 8, 2024
9a32219
Add swap CI
cedelavergne-ledger Nov 20, 2024
861f5bc
Update version to '7.2.1'
cedelavergne-ledger Nov 21, 2024
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
  •  
  •  
  •  
18 changes: 18 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
BasedOnStyle: Google
IndentWidth: 4
Language: Cpp
ColumnLimit: 100
PointerAlignment: Right
AlignAfterOpenBracket: Align
AlignConsecutiveMacros: true
AllowAllParametersOfDeclarationOnNextLine: false
SortIncludes: false
SpaceAfterCStyleCast: true
AllowShortCaseLabelsOnASingleLine: false
AllowAllArgumentsOnNextLine: false
AllowShortBlocksOnASingleLine: Never
AllowShortFunctionsOnASingleLine: None
BinPackArguments: false
BinPackParameters: false
---
2 changes: 1 addition & 1 deletion .clusterfuzzlite/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ FROM gcr.io/oss-fuzz-base/base-builder:v1
COPY . $SRC/app-cardano
COPY ./.clusterfuzzlite/build.sh $SRC/
COPY --from=LITE_BUILDER /opt/ledger-secure-sdk $SRC/app-cardano/BOLOS_SDK
WORKDIR $SRC/app-cardano
WORKDIR $SRC/app-cardano
2 changes: 1 addition & 1 deletion .clusterfuzzlite/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ pushd fuzzing
cmake -DBOLOS_SDK=../BOLOS_SDK -Bbuild -H.
make -C build
mv build/*_harness $OUT
popd
popd
2 changes: 1 addition & 1 deletion .clusterfuzzlite/project.yaml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
language: c
language: c
5 changes: 4 additions & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
# Checklist

<!-- Put an `x` in each box when you have completed the items. -->

- [ ] App update process has been followed <!-- See comment below -->
- [ ] Target branch is `develop` <!-- unless you have a very good reason -->
- [ ] Application version has been bumped <!-- required if your changes are to be deployed -->

<!-- Make sure you followed the process described in https://developers.ledger.com/docs/device-app/deliver/maintenance before opening your Pull Request.
<!-- Make sure you followed the process described in https://developers.ledger.com/docs/device-app/deliver/maintenance
before opening your Pull Request.
Don't hesitate to contact us directly on Discord if you have any questions ! https://developers.ledger.com/discord -->
41 changes: 41 additions & 0 deletions .github/workflows/build_and_functional_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Build and run functional 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:
inputs:
golden_run:
type: choice
required: true
default: 'Raise an error (default)'
description: CI behavior if the test snapshots are different than expected.
options:
- 'Raise an error (default)'
- 'Open a PR'
push:
branches:
- master
- 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"

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"
regenerate_snapshots: ${{ inputs.golden_run == 'Open a PR' }}
1 change: 0 additions & 1 deletion .github/workflows/cflite_cron.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,3 @@ jobs:
fuzz-seconds: 300 # 5 minutes
mode: ${{ matrix.mode }}
sanitizer: ${{ matrix.sanitizer }}

2 changes: 1 addition & 1 deletion .github/workflows/cflite_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ jobs:
# batch fuzzing.
# storage-repo: https://${{ secrets.PERSONAL_ACCESS_TOKEN }}@github.com/OWNER/STORAGE-REPO-NAME.git
# storage-repo-branch: main # Optional. Defaults to "main"
# storage-repo-branch-coverage: gh-pages # Optional. Defaults to "gh-pages".
# storage-repo-branch-coverage: gh-pages # Optional. Defaults to "gh-pages".
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
uses: LedgerHQ/ledger-app-workflows/.github/workflows/reusable_build.yml@v1
with:
upload_app_binaries_artifact: "compiled_app_binaries"

build_and_test:
name: Build and test app for all supported devices
strategy:
Expand All @@ -25,14 +25,14 @@ jobs:
runs-on: ubuntu-latest
container:
image: ghcr.io/ledgerhq/ledger-app-builder/ledger-app-dev-tools:latest

steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Build application in developer + headless mode
id: "build"
shell: bash
run: |
run: |
eval "BOLOS_SDK=\$$(echo ${{ matrix.device }} | tr [:lower:] [:upper:])_SDK" && \
echo "BOLOS_SDK value will be: ${BOLOS_SDK}" && \
BOLOS_SDK=${BOLOS_SDK} DEVEL=1 DEFINES+=HEADLESS make
Expand All @@ -47,7 +47,7 @@ jobs:
run: |
BUILD_DEVICE_NAME="$(echo ${{ matrix.device }} | sed 's/nanosp/nanos2/')"
speculos --model ${{ matrix.device }} build/$BUILD_DEVICE_NAME/bin/app.elf --seed "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about" --display headless &
apk add g++ libusb-dev libusb eudev-dev eudev &&
apk add g++ libusb-dev libusb eudev-dev eudev &&
cd ledgerjs-cardano-shelley &&
yarn install &&
yarn test-speculos
25 changes: 25 additions & 0 deletions .github/workflows/coding_style_checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Run coding style check through reusable workflow

# This workflow will run linting checks to ensure a level of uniformization among all Ledger applications.
#
# 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.

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

jobs:
check_linting:
name: Check linting using the reusable workflow
uses: LedgerHQ/ledger-app-workflows/.github/workflows/reusable_lint.yml@v1
with:
source: './src'
extensions: 'h,c'
version: 11
28 changes: 28 additions & 0 deletions .github/workflows/misspellings_checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Misspellings checks

# This workflow performs some misspelling checks on the repository
# 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:
push:
branches:
- master
- develop
pull_request:

jobs:
misspell:
name: Check misspellings
runs-on: ubuntu-latest
steps:
- name: Clone
uses: actions/checkout@v4

- name: Check misspellings
uses: codespell-project/actions-codespell@v2
with:
builtin: clear,rare
check_filenames: true
ignore_words_list: cips
42 changes: 42 additions & 0 deletions .github/workflows/python_client_checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Checks on the Python client

# This workflow performs some checks on the Python client used by the Application 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:
push:
branches:
- master
- develop
pull_request:

jobs:
lint:
name: Client linting
runs-on: ubuntu-latest
steps:
- name: Clone
uses: actions/checkout@v4
- name: Installing PIP dependencies
run: |
pip install pylint
pip install -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@v4
- name: Installing PIP dependencies
run: |
pip install mypy
pip install -r tests/requirements.txt
- name: Mypy type checking
run: |
mypy tests/application_client/
17 changes: 17 additions & 0 deletions .github/workflows/swap-ci-workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
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_cardano: ${{ github.ref }}
test_filter: '"ADA or ada or Cardano or cardano"'
26 changes: 18 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,14 +1,24 @@
ledger
bin
# Compilation files of the application
build

# Legacy compilation output
bin
debug
dep
obj
src/u2f_crypto_data.h
src/glyphs.h
src/glyphs.c
.vscode

# Temporary directory with snapshots taken during test runs
tests/snapshots-tmp/

# Fuzzing
fuzz/build
fuzz/corpus
fuzz/coverage

# Python
__pycache__/
venv/

# IDE
.vscode

# Virtual env for sideload (macOS and Windows)
ledger/
11 changes: 11 additions & 0 deletions .mdl.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Style file for mdl
# https://github.com/markdownlint/markdownlint/blob/main/docs/creating_styles.md

# Include all rules
all

# Disable specific rules
#exclude_rule 'MD012'

# Update rules configuration
rule 'MD013', :line_length => 130, :tables => false
13 changes: 13 additions & 0 deletions .mdlrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# markdownlint config file

# Use custom style file
style "#{File.dirname(__FILE__)}/.mdl.rb"

# MD005 - Inconsistent indentation for list items at the same level
# MD007 - Unordered list indentation
# MD014 - Dollar signs used before commands without showing output
# MD024 - Multiple headers with the same content
# MD041 - First line in file should be a top level header
# MD036 - Emphasis used instead of a header
# MD029 - Ordered list item prefix
rules "~MD005,~MD007,~MD014,~MD024,~MD041,~MD036,~MD029"
52 changes: 52 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# To install hooks, run:
# pre-commit install --hook-type pre-commit
# pre-commit install --hook-type commit-msg

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: mixed-line-ending
- id: check-added-large-files
- id: check-merge-conflict
- id: check-case-conflict

- repo: https://github.com/codespell-project/codespell
rev: v2.3.0
hooks:
- id: codespell
args: ['--ignore-words-list', 'cips']

- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v11.0.1
hooks:
- id: clang-format
types_or: [c]

- repo: https://github.com/Mateusz-Grzelinski/actionlint-py
rev: v1.7.3.17
hooks:
- id: actionlint
types_or: [yaml]
args: [-shellcheck="" -pyflakes=""]


- repo: https://github.com/markdownlint/markdownlint
rev: v0.13.0
hooks:
- id: markdownlint
types_or: [markdown]

- repo: local
hooks:

# Python scripts
- id: pylint
name: Check python Client
# Only display messages, no score, disable few errors
entry: pylint -j 0 --rc tests/setup.cfg
language: system
types: [python]
files: '^tests\/.*$'
Loading