Skip to content

Commit

Permalink
Merge pull request #292 from LedgerHQ/develop
Browse files Browse the repository at this point in the history
Sync master to 2.3.0 release.
  • Loading branch information
bigspider authored Oct 8, 2024
2 parents acd94a2 + c9144de commit ac0272e
Show file tree
Hide file tree
Showing 267 changed files with 534 additions and 149 deletions.
14 changes: 6 additions & 8 deletions .github/workflows/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,22 @@ FROM ghcr.io/ledgerhq/speculos:latest
RUN apt update -y && apt install -y git curl

# install autotools bitcoin-core build dependencies
RUN apt install -y automake autotools-dev bsdmainutils build-essential ccache git libboost-dev libboost-filesystem-dev libboost-system-dev libboost-test-dev libevent-dev libminiupnpc-dev libnatpmp-dev libqt5gui5 libqt5core5a libqt5dbus5 libsqlite3-dev libtool libzmq3-dev pkg-config python3 qttools5-dev qttools5-dev-tools qtwayland5 systemtap-sdt-dev
RUN apt install -y bsdmainutils build-essential cmake pkg-config ccache git libboost-dev libboost-filesystem-dev libboost-system-dev libboost-test-dev libevent-dev libminiupnpc-dev libnatpmp-dev libqt5gui5 libqt5core5a libqt5dbus5 libsqlite3-dev libtool libzmq3-dev pkg-config python3 qttools5-dev qttools5-dev-tools qtwayland5 systemtap-sdt-dev

# clone bitcoin-core from github and compile it
RUN cd / && \
git clone --depth=1 https://github.com/bitcoin/bitcoin.git && \
cd bitcoin && \
./autogen.sh && \
./configure --enable-suppress-external-warnings && \
make -j "$(($(nproc)+1))" && \
mkdir bin && \
cp src/bitcoind src/bitcoin-cli src/bitcoin-tx src/bitcoin-util src/bitcoin-wallet ./bin
cmake -B build && \
cmake --build build && \
cmake --install build


FROM ghcr.io/ledgerhq/speculos:latest
COPY --from=0 /bitcoin/bin /bitcoin/bin
COPY --from=0 /usr/local/bin/ /usr/local/bin/

# install runtime dependencies for bitcoind
RUN apt update -y && apt install -y libminiupnpc-dev libminiupnpc-dev libnatpmp-dev libevent-dev libzmq3-dev

# Add bitcoin binaries to path
ENV PATH=/bitcoin/bin:$PATH
ENV PATH=/usr/local/bin/:$PATH
2 changes: 1 addition & 1 deletion .github/workflows/builder-image-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:

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

- name: Build and push speculos-bitcoin to GitHub Packages
uses: docker/build-push-action@v1
Expand Down
38 changes: 19 additions & 19 deletions .github/workflows/ci-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,21 @@ jobs:

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

- name: Build
run: |
make DEBUG=0 COIN=bitcoin BOLOS_SDK=${{ matrix.SDK }} && mv bin/ bitcoin-bin/
make clean
make DEBUG=0 COIN=bitcoin_testnet BOLOS_SDK=${{ matrix.SDK }} && mv bin/ bitcoin-testnet-bin/
- name: Upload Bitcoin app binary
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: bitcoin-app-${{ matrix.model }}
path: bitcoin-bin

- name: Upload Bitcoin Testnet app binary
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: bitcoin-testnet-app-${{ matrix.model }}
path: bitcoin-testnet-bin
Expand All @@ -63,14 +63,14 @@ jobs:

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

- 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
uses: actions/upload-artifact@v4
with:
name: bitcoin-testnet-perftest-app-nanosp
path: bin
Expand All @@ -85,7 +85,7 @@ jobs:

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

- name: Build unit tests
run: |
Expand All @@ -99,7 +99,7 @@ jobs:
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@v2
- uses: actions/upload-artifact@v4
with:
name: code-coverage
path: unit-tests/coverage
Expand All @@ -117,7 +117,7 @@ jobs:
- name: HTML documentation
run: doxygen .doxygen/Doxyfile

- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v4
with:
name: documentation
path: doc/html
Expand Down Expand Up @@ -148,10 +148,10 @@ jobs:

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

- name: Download Bitcoin app binary
uses: actions/download-artifact@v2
uses: actions/download-artifact@v4
with:
name: bitcoin-app-${{matrix.model}}
path: bin
Expand Down Expand Up @@ -180,7 +180,7 @@ jobs:

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

- name: Run tests
run: |
Expand All @@ -207,10 +207,10 @@ jobs:

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

- name: Download Bitcoin app binary for perftests
uses: actions/download-artifact@v2
uses: actions/download-artifact@v4
with:
name: bitcoin-testnet-perftest-app-nanosp
path: bin
Expand All @@ -221,7 +221,7 @@ jobs:
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
uses: actions/upload-artifact@v4
with:
name: benchmarks-log
path: tests_perf/benchmarks.json
Expand All @@ -244,19 +244,19 @@ jobs:

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

- name: Install node
uses: actions/setup-node@v2
uses: actions/setup-node@v4
with:
node-version: '16'
node-version: 20

- name: Install yarn
run: |
npm install -g yarn
- name: Download Bitcoin Testnet app binary
uses: actions/download-artifact@v2
uses: actions/download-artifact@v4
with:
name: bitcoin-testnet-app-nanosp
path: bin
Expand All @@ -278,7 +278,7 @@ jobs:

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

- name: Run tests
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:

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

- name: Initialize CodeQL
uses: github/codeql-action/init@v2
Expand Down
48 changes: 23 additions & 25 deletions .github/workflows/lint-workflow.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,26 @@
name: Code style check
---
name: Code style check

on:
workflow_dispatch:
push:
branches:
- master
- develop
pull_request:
branches:
- master
- develop
# 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.

jobs:
job_lint:
name: Lint
runs-on: ubuntu-latest
on:
workflow_dispatch:
push:
branches:
- master
- main
- develop
pull_request:

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

- name: Lint
uses: DoozyX/[email protected]
with:
source: './src'
extensions: 'h,c'
clangFormatVersion: 12
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: 12
2 changes: 1 addition & 1 deletion .github/workflows/sonarcloud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
env:
BUILD_WRAPPER_OUT_DIR: build_wrapper_output_directory # Directory where build-wrapper output will be placed
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
# Disabling shallow clone is recommended for improving relevancy of reporting
fetch-depth: 0
Expand Down
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

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

## [2.3.0] - 26-08-2024

### Added

- Support for crosschain swap protocol.

### Changed

- Improvements in signing performance, especially for large transactions.

### Fixed

- `signMessage` would fail since version 2.2.2 for certain message lengths.

## [2.2.4] - 09-07-2024

### Changed
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ PATH_SLIP21_APP_LOAD_PARAMS = "LEDGER-Wallet policy"

# Application version
APPVERSION_M = 2
APPVERSION_N = 2
APPVERSION_P = 4
APPVERSION_N = 3
APPVERSION_P = 0
APPVERSION_SUFFIX = # if not empty, appended at the end. Do not add a dash.

ifeq ($(APPVERSION_SUFFIX),)
Expand Down
9 changes: 9 additions & 0 deletions bitcoin_client_js/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module.exports = {
presets: [
['@babel/preset-env', {
targets: {
node: 'current'
}
}]
],
};
10 changes: 8 additions & 2 deletions bitcoin_client_js/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
};
transform: {
'^.+\\.tsx?$': 'ts-jest',
'^.+\\.js$': 'babel-jest',
},
transformIgnorePatterns: [
"node_modules/(?!(axios)/)"
]
};
2 changes: 2 additions & 0 deletions bitcoin_client_js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,14 @@
"bitcoinjs-lib": "^6.1.3"
},
"devDependencies": {
"@babel/preset-env": "^7.25.7",
"@ledgerhq/hw-transport-node-speculos-http": "^6.24.1",
"@ledgerhq/logs": "^6.10.0",
"@types/jest": "^27.4.0",
"@types/node": "^17.0.10",
"@typescript-eslint/eslint-plugin": "^4.0.1",
"@typescript-eslint/parser": "^4.0.1",
"babel-jest": "^29.7.0",
"codecov": "^3.5.0",
"cspell": "^4.1.0",
"eslint": "^7.8.0",
Expand Down
6 changes: 3 additions & 3 deletions bitcoin_client_rs/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ledger_bitcoin_client"
version = "0.4.1"
version = "0.5.0"
authors = ["Edouard Paris <[email protected]>"]
edition = "2018"
description = "Ledger Bitcoin application client"
Expand All @@ -21,8 +21,8 @@ paranoid_client = ["miniscript"]

[dependencies]
async-trait = { version = "0.1", optional = true }
bitcoin = { version = "0.31", default-features = false, features = ["no-std"] }
miniscript = { version = "11.0", optional = true, default-features = false, features = ["no-std"] }
bitcoin = { version = "0.32", default-features = false }
miniscript = { version = "12.2", optional = true, default-features = false, features = ["no-std"] }

[workspace]
members = ["examples/ledger_hwi"]
Expand Down
2 changes: 1 addition & 1 deletion bitcoin_client_rs/examples/ledger_hwi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ edition = "2018"
clap = { version = "4.0.18", features = ["derive"] }
ledger_bitcoin_client = { path = "../.." }
async-trait = { version = "0.1"}
bitcoin = { version = "0.31", default-features = false, features = ["no-std"] }
bitcoin = { version = "0.32", default-features = false }
hex = "0.4"
base64 = "0.13.0"
ledger-apdu = "0.10"
Expand Down
2 changes: 1 addition & 1 deletion bitcoin_client_rs/src/async_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ impl<T: Transport> BitcoinClient<T> {
BitcoinClientError::ClientError("Failed to derive descriptor".to_string())
})?
.script_pubkey()
!= expected_address.payload().script_pubkey()
!= expected_address.assume_checked_ref().script_pubkey()
{
return Err(BitcoinClientError::InvalidResponse("Invalid address. Please update your Bitcoin app. If the problem persists, report a bug at https://github.com/LedgerHQ/app-bitcoin-new".to_string()));
}
Expand Down
2 changes: 1 addition & 1 deletion bitcoin_client_rs/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ impl<T: Transport> BitcoinClient<T> {
BitcoinClientError::ClientError("Failed to derive descriptor".to_string())
})?
.script_pubkey()
!= expected_address.payload().script_pubkey()
!= expected_address.assume_checked_ref().script_pubkey()
{
return Err(BitcoinClientError::InvalidResponse("Invalid address. Please update your Bitcoin app. If the problem persists, report a bug at https://github.com/LedgerHQ/app-bitcoin-new".to_string()));
}
Expand Down
2 changes: 1 addition & 1 deletion bitcoin_client_rs/src/psbt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use bitcoin::{
consensus::encode::{deserialize, serialize, VarInt},
ecdsa,
hashes::Hash,
key::Error as KeyError,
key::FromSliceError as KeyError,
psbt::{raw, Input, Output, Psbt},
secp256k1::{self, XOnlyPublicKey},
taproot,
Expand Down
Loading

0 comments on commit ac0272e

Please sign in to comment.