Skip to content

Commit 52c3802

Browse files
Merge pull request #9 from coderofstuff/swap-integration
Swap integration
2 parents 1142d4f + f39cc98 commit 52c3802

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+583
-89
lines changed

.github/workflows/build_and_functional_tests.yml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,21 @@ name: Build and run functional tests using ragger through reusable workflow
55
# resulting binaries.
66
# It then calls another reusable workflow to run the Ragger tests on the compiled application binary.
77
#
8-
# While this workflow is optional, having functional testing on your application is mandatory and this workflow and
8+
# The build part of this workflow is mandatory, this ensures that the app will be deployable in the Ledger App Store.
9+
# While the test part of this workflow is optional, having functional testing on your application is mandatory and this workflow and
910
# tooling environment is meant to be easy to use and adapt after forking your application
1011

1112
on:
1213
workflow_dispatch:
14+
inputs:
15+
golden_run:
16+
type: choice
17+
required: true
18+
default: 'Raise an error (default)'
19+
description: CI behavior if the test snapshots are different than expected.
20+
options:
21+
- 'Raise an error (default)'
22+
- 'Open a PR'
1323
push:
1424
branches:
1525
- master
@@ -30,5 +40,4 @@ jobs:
3040
uses: LedgerHQ/ledger-app-workflows/.github/workflows/reusable_ragger_tests.yml@v1
3141
with:
3242
download_app_binaries_artifact: "compiled_app_binaries"
33-
test_dir: tests
34-
run_for_devices: '["nanos", "nanox", "nanosp", "stax"]'
43+
regenerate_snapshots: ${{ inputs.golden_run == 'Open a PR' }}

.github/workflows/codeql_checks.yml

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,24 +17,21 @@ jobs:
1717
analyse:
1818
name: Analyse
1919
strategy:
20+
fail-fast: false
2021
matrix:
21-
sdk: [ "$NANOS_SDK", "$NANOX_SDK", "$NANOSP_SDK" ]
22-
#'cpp' covers C and C++
23-
language: [ 'cpp' ]
22+
sdk: ["$NANOX_SDK", "$NANOSP_SDK", "$STAX_SDK", "$FLEX_SDK"]
23+
# 'cpp' covers C and C++
24+
language: ['cpp']
2425
runs-on: ubuntu-latest
25-
permissions:
26-
actions: read
27-
contents: read
28-
security-events: write
2926
container:
30-
image: ghcr.io/ledgerhq/ledger-app-builder/ledger-app-builder-legacy:latest
27+
image: ghcr.io/ledgerhq/ledger-app-builder/ledger-app-builder-lite:latest
3128

3229
steps:
3330
- name: Clone
34-
uses: actions/checkout@v3
31+
uses: actions/checkout@v4
3532

3633
- name: Initialize CodeQL
37-
uses: github/codeql-action/init@v2
34+
uses: github/codeql-action/init@v3
3835
with:
3936
languages: ${{ matrix.language }}
4037
queries: security-and-quality
@@ -45,4 +42,4 @@ jobs:
4542
make BOLOS_SDK=${{ matrix.sdk }}
4643
4744
- name: Perform CodeQL Analysis
48-
uses: github/codeql-action/analyze@v2
45+
uses: github/codeql-action/analyze@v3

.github/workflows/coding_style_checks.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,3 @@ jobs:
2222
with:
2323
source: './src'
2424
extensions: 'h,c'
25-
version: 11

.github/workflows/documentation_generation.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ jobs:
1818

1919
steps:
2020
- name: Clone
21-
uses: actions/checkout@v3
21+
uses: actions/checkout@v4
2222

2323
- name: HTML documentation
2424
run: doxygen .doxygen/Doxyfile
2525

26-
- uses: actions/upload-artifact@v3
26+
- uses: actions/upload-artifact@v4
2727
with:
2828
name: documentation
2929
path: doc/html
Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
name: Misspellings checks
1+
name: Checks on the Python client
22

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

@@ -14,17 +14,28 @@ on:
1414
pull_request:
1515

1616
jobs:
17-
misspell:
18-
name: Check misspellings
17+
lint:
18+
name: Client linting
1919
runs-on: ubuntu-latest
2020
steps:
21-
- name: Clone
22-
uses: actions/checkout@v3
23-
24-
- name: Check misspellings
25-
uses: codespell-project/actions-codespell@v1
26-
with:
27-
builtin: clear,rare
28-
check_filenames: true
29-
skip: ./.git,./unit-tests/mock_includes
21+
- name: Clone
22+
uses: actions/checkout@v4
23+
- name: Installing PIP dependencies
24+
run: |
25+
pip install pylint
26+
pip install -r tests/requirements.txt
27+
- name: Lint Python code
28+
run: pylint --rc tests/setup.cfg tests/application_client/
3029

30+
mypy:
31+
name: Type checking
32+
runs-on: ubuntu-latest
33+
steps:
34+
- name: Clone
35+
uses: actions/checkout@v4
36+
- name: Installing PIP dependencies
37+
run: |
38+
pip install mypy
39+
pip install -r tests/requirements.txt
40+
- name: Mypy type checking
41+
run: mypy tests/application_client/
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Swap functional tests
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- master
8+
- main
9+
- develop
10+
pull_request:
11+
12+
jobs:
13+
job_functional_tests:
14+
uses: LedgerHQ/app-exchange/.github/workflows/reusable_swap_functional_tests.yml@develop
15+
with:
16+
branch_for_kas: ${{ github.ref }}
17+
repo_for_kas: ${{ github.repository }}
18+
test_filter: '"KAS or Kaspa or kaspa"'

.github/workflows/unit_tests.yml

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,18 @@ jobs:
1818

1919
steps:
2020
- name: Clone
21-
uses: actions/checkout@v3
21+
uses: actions/checkout@v4
22+
23+
- name: Clone SDK
24+
uses: actions/checkout@v4
25+
with:
26+
repository: ledgerHQ/ledger-secure-sdk
27+
path: sdk
2228

2329
- name: Build unit tests
2430
run: |
2531
cd unit-tests/
32+
export BOLOS_SDK=../sdk
2633
cmake -Bbuild -H. && make -C build && make -C build test
2734
2835
- name: Generate code coverage
@@ -31,18 +38,22 @@ jobs:
3138
lcov --directory . -b "$(realpath build/)" --capture --initial -o coverage.base && \
3239
lcov --rc lcov_branch_coverage=1 --directory . -b "$(realpath build/)" --capture -o coverage.capture && \
3340
lcov --directory . -b "$(realpath build/)" --add-tracefile coverage.base --add-tracefile coverage.capture -o coverage.info && \
34-
lcov --directory . -b "$(realpath build/)" --remove coverage.info '*/unit-tests/*' --remove coverage.info 'lib_standard_app' --remove coverage.info '*/src/import/*' -o coverage.info && \
41+
lcov --directory . -b "$(realpath build/)" --remove coverage.info '*/unit-tests/*' -o coverage.info && \
3542
genhtml coverage.info -o coverage
3643
37-
- uses: actions/upload-artifact@v3
44+
- uses: actions/upload-artifact@v4
3845
with:
3946
name: code-coverage
4047
path: unit-tests/coverage
4148

49+
- name: Install codecov dependencies
50+
run: apt install --no-install-recommends -y curl gpg
51+
4252
- name: Upload to codecov.io
43-
uses: codecov/codecov-action@v3
53+
uses: codecov/codecov-action@v5
54+
env:
55+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
4456
with:
45-
token: ${{ secrets.CODECOV_TOKEN }}
4657
files: ./unit-tests/coverage.info
4758
flags: unittests
4859
name: codecov-app-boilerplate

Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ APPNAME = "Kaspa"
2929

3030
# Application version
3131
APPVERSION_M = 1
32-
APPVERSION_N = 0
33-
APPVERSION_P = 3
32+
APPVERSION_N = 1
33+
APPVERSION_P = 0
3434
APPVERSION = "$(APPVERSION_M).$(APPVERSION_N).$(APPVERSION_P)"
3535

3636
ifeq ($(TARGET_NAME),TARGET_NANOS)
@@ -95,6 +95,7 @@ VARIANT_VALUES = KAS
9595
# Application communication interfaces #
9696
########################################
9797
ENABLE_BLUETOOTH = 1
98+
ENABLE_SWAP = 1
9899
#ENABLE_NFC = 1
99100

100101
########################################

ledger_app.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[app]
22
build_directory = "./"
33
sdk = "C"
4-
devices = ["flex", "nanos", "nanox", "nanos+", "stax"]
4+
devices = ["flex", "nanox", "nanos+", "stax"]
55

66
[tests]
77
unit_directory = "./unit-tests/"

src/address.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,13 @@ bool address_from_pubkey(const uint8_t public_key[static 64],
101101
memmove(address, hrp, sizeof(hrp));
102102
address[5] = ':';
103103

104-
cashaddr_encode(compressed_public_key, compressed_pub_size, address + 6, address_len, version);
104+
if (cashaddr_encode(compressed_public_key,
105+
compressed_pub_size,
106+
address + 6,
107+
address_len,
108+
version) == 0) {
109+
return false;
110+
}
105111

106112
memmove(out, address, address_len);
107113

0 commit comments

Comments
 (0)