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

Sync master to 2.3.0 release. #292

Merged
merged 36 commits into from
Oct 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
1a437f2
Fix sign_psbt ragger instructions not propagating the save_screenshot…
bigspider Jul 16, 2024
6367fb2
Merge pull request #271 from LedgerHQ/fix-instructions
bigspider Jul 16, 2024
c8170da
Add a test for signing a 64 bytes message.
bigspider Aug 6, 2024
9f0d720
Fix sign_message overflow during message visualization
bigspider Aug 6, 2024
23d0ddf
Update CHANGELOG
bigspider Aug 6, 2024
4c60d06
Merge pull request #273 from LedgerHQ/fix-signmessage
bigspider Aug 7, 2024
19d6c5e
Add payin_extra_id to G_swap_state; process destination_address_extra…
bigspider Jun 21, 2024
af3c336
Extend Swap protocol for cross-chain swaps
bigspider Jul 15, 2024
629d423
Add more debug code in case of address mismatch during swap
bigspider Jul 15, 2024
e89e67c
Read sign_transaction_params->destination_address_extra_id before wip…
fbeutin-ledger Jun 24, 2024
f18fb4a
Improve swap error handling
bigspider Jul 15, 2024
50cc569
Bump version to 2.2.5; update CHANGELOG
bigspider Aug 19, 2024
6fde678
Update dashboard snapshots
bigspider Aug 19, 2024
0d4106d
Merge pull request #275 from LedgerHQ/swap-release
bigspider Aug 19, 2024
eb0cbbd
client_rs: bump bitcoin 0.32 and miniscript 12.2
edouardparis Aug 22, 2024
916670a
ledger_hwi: bump rust-bitcoin 0.32
edouardparis Aug 23, 2024
fa94082
New version 0.5.0 for crate ledger_bitcoin_client
edouardparis Aug 23, 2024
5499c3e
Merge pull request #278 from edouardparis/client_rs-bump-bitcoin-0.32
bigspider Aug 23, 2024
e066314
Implement a faster, unsafe version of secp256k1_point
bigspider Aug 20, 2024
6131f7a
Add a cache to avoid repeated key derivations
bigspider Aug 20, 2024
5f6afe9
Add explanatory comment on usage of secp256k1_point_unsafe
bigspider Aug 26, 2024
df2240b
Merge pull request #276 from LedgerHQ/perf-opts
bigspider Aug 26, 2024
b30cb59
Bump version to 2.3.0; upate CHANGELOG and ragger snapshots
bigspider Aug 26, 2024
ec81a03
Merge pull request #279 from LedgerHQ/release230
bigspider Aug 26, 2024
248c045
Always return to main menu at the end of get_wallet_address
bigspider Sep 9, 2024
eab72e8
Update snapshots
bigspider Sep 9, 2024
bb6f2c9
Replace lint workflow with reusable one
bigspider Sep 9, 2024
8751400
Merge pull request #282 from LedgerHQ/processing-glitch
bigspider Sep 9, 2024
3606a87
Update snapshots
bigspider Sep 9, 2024
ee4ca1f
Fix bitcoin build instructions
bigspider Sep 9, 2024
a40b100
Merge pull request #284 from LedgerHQ/fix-ci
bigspider Sep 10, 2024
08d208f
Update ci action versions, and Node version
bigspider Oct 7, 2024
cc30b8b
Update some snapshots for flex/stax due to sdk changes
bigspider Oct 7, 2024
9f75ae5
Fix JS CI job
bigspider Oct 7, 2024
6fe785e
Update all flex snapshots
bigspider Oct 7, 2024
c9144de
Merge pull request #291 from LedgerHQ/update-ci-actions
bigspider Oct 7, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
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

Check warning on line 10 in .github/workflows/Dockerfile

View check run for this annotation

Ledger Wiz (CSPM & secret detection) / Wiz IaC Scanner

Run Using apt

Rule ID: 853ed0e2-f329-4e58-95bb-9094a29691a7 Severity: Medium Resource: FROM={{ghcr.io/ledgerhq/speculos:latest}}.{{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}} apt is discouraged by the Linux distributions as an unattended tool as its interface may suffer changes between versions. Better use the more stable apt-get and apt-cache
Raw output
Expected: RUN instructions should not use the 'apt' program
Found: RUN instruction is invoking the 'apt' program

# 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/

Check warning on line 22 in .github/workflows/Dockerfile

View check run for this annotation

Ledger Wiz (CSPM & secret detection) / Wiz IaC Scanner

COPY '--from' Without FROM Alias Defined Previously

Rule ID: 3cc68033-2ce9-4f64-9949-a0d36aeff197 Severity: Medium Resource: FROM={{ghcr.io/ledgerhq/speculos:latest}}.{{COPY --from=0 /usr/local/bin/ /usr/local/bin/}} COPY command with the flag '--from' should mention a previously defined FROM alias
Raw output
Expected: COPY '--from' should reference a previously defined FROM alias
Found: COPY '--from' does not reference a previously defined FROM alias

# 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/clang-format-lint-action@v0.12
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 <m@edouard.paris>"]
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
Loading