Skip to content

Commit

Permalink
Merge pull request #272 from LedgerHQ/release-2-2-4
Browse files Browse the repository at this point in the history
Sync master branch to 2.2.4
  • Loading branch information
bigspider authored Jul 22, 2024
2 parents 74190fb + f17c7fd commit acd94a2
Show file tree
Hide file tree
Showing 3,552 changed files with 2,609 additions and 1,812 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
71 changes: 65 additions & 6 deletions .github/workflows/ci-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@ on:

jobs:
job_build:
name: Compilation for NanoS, X, S+, and Stax
name: Compilation for X, S+, Stax and Flex

strategy:
matrix:
include:
- model: nanos
SDK: "$NANOS_SDK"
- model: nanox
SDK: "$NANOX_SDK"
- model: nanosp
SDK: "$NANOSP_SDK"
- model: stax
SDK: "$STAX_SDK"
- model: flex
SDK: "$FLEX_SDK"

runs-on: ubuntu-latest

Expand Down Expand Up @@ -53,6 +53,28 @@ jobs:
name: bitcoin-testnet-app-${{ matrix.model }}
path: bitcoin-testnet-bin

job_build_app_perftest:
name: Compile the UX-less version of the app on Nano S+ for performance tests

runs-on: ubuntu-latest

container:
image: ghcr.io/ledgerhq/ledger-app-builder/ledger-app-builder:latest

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

- name: Build
run: |
make DEBUG=0 COIN=bitcoin_testnet BOLOS_SDK="$NANOSP_SDK" AUTOAPPROVE_FOR_PERF_TESTS=1
- name: Upload Bitcoin Testnet app binary
uses: actions/upload-artifact@v2
with:
name: bitcoin-testnet-perftest-app-nanosp
path: bin

job_unit_test:
name: Unit test
needs: job_build
Expand Down Expand Up @@ -105,10 +127,10 @@ jobs:
strategy:
matrix:
include:
- model: nanos
- model: nanox
- model: nanosp
- model: stax
- model: flex

needs: job_build
runs-on: ubuntu-latest
Expand Down Expand Up @@ -164,8 +186,45 @@ jobs:
run: |
cd bitcoin_client/tests
pip install -r requirements.txt
PYTHONPATH=$PYTHONPATH:/speculos pytest --headless --timeout=300
PYTHONPATH=$PYTHONPATH:/speculos pytest --headless --timeout=300 --model=nanos
job_perftests:
name: Performance report

needs: job_build_app_perftest
runs-on: ubuntu-latest

container:
image: ghcr.io/ledgerhq/app-bitcoin-new/speculos-bitcoin:latest
ports:
- 1234:1234
- 9999:9999
- 40000:40000
- 41000:41000
- 42000:42000
- 43000:43000
options: --entrypoint /bin/bash

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

- name: Download Bitcoin app binary for perftests
uses: actions/download-artifact@v2
with:
name: bitcoin-testnet-perftest-app-nanosp
path: bin

- name: Run tests
run: |
cd tests_perf
pip install -r requirements.txt
PYTHONPATH=$PYTHONPATH:/speculos pytest --headless --model=nanosp --benchmark-json=benchmarks.json
- name: Upload benchmarks summary
uses: actions/upload-artifact@v2
with:
name: benchmarks-log
path: tests_perf/benchmarks.json

job_test_js_lib:
name: Tests with the JS library
Expand Down Expand Up @@ -199,7 +258,7 @@ jobs:
- name: Download Bitcoin Testnet app binary
uses: actions/download-artifact@v2
with:
name: bitcoin-testnet-app-nanos
name: bitcoin-testnet-app-nanosp
path: bin

- name: Run tests
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/codeql-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ jobs:
strategy:
matrix:
include:
- SDK: "$NANOS_SDK"
artifact: boilerplate-app-nanoS
- SDK: "$NANOX_SDK"
artifact: boilerplate-app-nanoX
- SDK: "$NANOSP_SDK"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/sonarcloud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
gcovr --root .. --sonarqube coverage.xml
- name: Run build-wrapper
run: |
build-wrapper-linux-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} make clean all
build-wrapper-linux-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} make TARGET=nanosp
- name: Run sonar-scanner
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
5 changes: 4 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,8 @@
"*.h": "c"
},
"C_Cpp.clang_format_path": "/usr/bin/clang-format",
"editor.formatOnSave": true
"editor.formatOnSave": true,
"ledgerDevTools.appSettings": {
"selectedUseCase": "release"
}
}
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

Dates are in `dd-mm-yyyy` format.

## [2.2.4] - 09-07-2024

### Changed

- Major revamp of the UI for transaction signing and wallet policy registration on Stax. Changed "wallet policy" with the simpler wording "account".
- Slight performance improvements in the signing flow.
- Added a technical limit of at most 10 distinct cosigners in a wallet policy.

### Fixed

- OP_RETURN outputs with a `0x00` data push were incorrectly rejected.

## [2.2.3] - 06-05-2024

### Added
Expand Down
80 changes: 42 additions & 38 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ PATH_SLIP21_APP_LOAD_PARAMS = "LEDGER-Wallet policy"
# Application version
APPVERSION_M = 2
APPVERSION_N = 2
APPVERSION_P = 3
APPVERSION_P = 4
APPVERSION_SUFFIX = # if not empty, appended at the end. Do not add a dash.

ifeq ($(APPVERSION_SUFFIX),)
Expand All @@ -56,6 +56,13 @@ else
APPVERSION = "$(APPVERSION_M).$(APPVERSION_N).$(APPVERSION_P)-$(strip $(APPVERSION_SUFFIX))"
endif

# If set, the app will automatically approve all requests without user interaction. Useful for performance tests.
# It is critical that no such app is ever deployed in production.
AUTOAPPROVE_FOR_PERF_TESTS ?= 0
ifneq ($(AUTOAPPROVE_FOR_PERF_TESTS),0)
DEFINES += HAVE_AUTOAPPROVE_FOR_PERF_TESTS
endif

# Setting to allow building variant applications
VARIANT_PARAM = COIN
VARIANT_VALUES = bitcoin_testnet bitcoin
Expand All @@ -74,41 +81,50 @@ HAVE_APPLICATION_FLAG_BOLOS_SETTINGS = 1
HAVE_APPLICATION_FLAG_LIBRARY = 1

ifeq ($(COIN),bitcoin_testnet)

# Bitcoin testnet, no legacy support
DEFINES += BIP32_PUBKEY_VERSION=0x043587CF
DEFINES += BIP44_COIN_TYPE=1
DEFINES += COIN_P2PKH_VERSION=111
DEFINES += COIN_P2SH_VERSION=196
DEFINES += COIN_NATIVE_SEGWIT_PREFIX=\"tb\"
DEFINES += COIN_COINID_SHORT=\"TEST\"

APPNAME = "Bitcoin Test"

# Bitcoin testnet, no legacy support
DEFINES += BIP32_PUBKEY_VERSION=0x043587CF
DEFINES += BIP44_COIN_TYPE=1
DEFINES += COIN_P2PKH_VERSION=111
DEFINES += COIN_P2SH_VERSION=196
DEFINES += COIN_NATIVE_SEGWIT_PREFIX=\"tb\"
DEFINES += COIN_COINID_SHORT=\"TEST\"

APPNAME = "Bitcoin Test"
else ifeq ($(COIN),bitcoin)

# Bitcoin mainnet, no legacy support
DEFINES += BIP32_PUBKEY_VERSION=0x0488B21E
DEFINES += BIP44_COIN_TYPE=0
DEFINES += COIN_P2PKH_VERSION=0
DEFINES += COIN_P2SH_VERSION=5
DEFINES += COIN_NATIVE_SEGWIT_PREFIX=\"bc\"
DEFINES += COIN_COINID_SHORT=\"BTC\"

APPNAME = "Bitcoin"
# the version for performance tests automatically approves all requests
# there is no reason to ever compile the mainnet app with this flag
ifneq ($(AUTOAPPROVE_FOR_PERF_TESTS),0)
$(error Use testnet app for performance tests)
endif

# Bitcoin mainnet, no legacy support
DEFINES += BIP32_PUBKEY_VERSION=0x0488B21E
DEFINES += BIP44_COIN_TYPE=0
DEFINES += COIN_P2PKH_VERSION=0
DEFINES += COIN_P2SH_VERSION=5
DEFINES += COIN_NATIVE_SEGWIT_PREFIX=\"bc\"
DEFINES += COIN_COINID_SHORT=\"BTC\"

APPNAME = "Bitcoin"

else
ifeq ($(filter clean,$(MAKECMDGOALS)),)
$(error Unsupported COIN - use bitcoin_testnet, bitcoin)
ifeq ($(filter clean,$(MAKECMDGOALS)),)
$(error Unsupported COIN - use bitcoin_testnet, bitcoin)
endif
endif

ifneq (,$(filter-out clean,$(MAKECMDGOALS)))
ifeq ($(TARGET_NAME),TARGET_NANOS)
$(error This branch is not compatible with the Nano S device. Checkout the 'nanos' branch for the latest code for Nano S.)
endif
endif

# Application icons following guidelines:
# https://developers.ledger.com/docs/embedded-app/design-requirements/#device-icon
ICON_NANOS = icons/nanos_app_bitcoin.gif
ICON_NANOX = icons/nanox_app_bitcoin.gif
ICON_NANOSP = icons/nanox_app_bitcoin.gif
ICON_STAX = icons/stax_app_bitcoin.gif
ICON_FLEX = icons/flex_app_bitcoin.gif

########################################
# Application communication interfaces #
Expand All @@ -133,19 +149,7 @@ DISABLE_DEFAULT_IO_SEPROXY_BUFFER_SIZE = 1
DEFINES += HAVE_BOLOS_APP_STACK_CANARY


ifeq ($(TARGET_NAME),TARGET_NANOS)
DEFINES += IO_SEPROXYHAL_BUFFER_SIZE_B=72
DEFINES += HAVE_WALLET_ID_SDK
else
DEFINES += IO_SEPROXYHAL_BUFFER_SIZE_B=300
endif

ifeq ($(TARGET_NAME),TARGET_NANOS)
# enables optimizations using the shared 1K CXRAM region
DEFINES += USE_CXRAM_SECTION
# enables usage of the NVRAM to free up some RAM
DEFINES += USE_NVRAM_STASH
endif
DEFINES += IO_SEPROXYHAL_BUFFER_SIZE_B=300

# debugging helper functions and macros
CFLAGS += -include debug-helpers/debug.h
Expand Down
2 changes: 0 additions & 2 deletions bitcoin_client_js/src/__tests__/appClient.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,6 @@ describe("test AppClient", () => {
beforeEach(async () => {
sp = spawn(speculos_path, [
repoRootPath + "/bin/app.elf",
'-k', '2.1',
'--model', 'nanos',
'--display', 'headless'
]);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"version": 1,
"rules": [
{
"regexp": "Register wallet|Wallet name|Wallet policy|Key",
"regexp": "Register account|Account name|Wallet policy|Key",
"actions": [
["button", 2, true],
["button", 2, false]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"version": 1,
"rules": [
{
"regexp": "Spend from|Wallet name|Review|Amount|Address|Fees",
"regexp": "Spend from|Account name|Review|Amount|Address|Fees",
"actions": [
["button", 2, true],
["button", 2, false]
Expand Down
Binary file added icons/flex_app_bitcoin.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 removed icons/nanos_app_bitcoin.gif
Binary file not shown.
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 = ["nanos", "nanox", "nanos+", "stax"]
devices = ["nanox", "nanos+", "stax", "flex"]

[tests]
unit_directory = "./unit-tests/"
Expand Down
Loading

0 comments on commit acd94a2

Please sign in to comment.