Skip to content

Commit 0829353

Browse files
committed
Move lightning-transaction-sync tests to dedicated script
.. and bump its MSRV to 1.75. Recently, `rustls` bumped their MSRV to 1.71. As we depend on them and don't want to continuously pin this security-critical dependency back, we have no choice left but to bump the MSRV for `lightning-transaction-sync` to a version >= 1.71, too. Here, we hence move the `lightning-transaction-sync` tests to a dedicated script and propose to introduce a secondary MSRV of 1.75. We chose this particular version, because: a) it's > 1 year old b) it provides a buffer to 1.71, i.e., if some crate bumped to a version > 1.71, there is a chance we don't immediately have to react again c) it stabilized `async fn`s in traits (see https://blog.rust-lang.org/2023/12/21/async-fn-rpit-in-traits.html), which might become handy for related (BDK) crates, which hopefully will adopt the same target.
1 parent f92c4dc commit 0829353

File tree

3 files changed

+63
-39
lines changed

3 files changed

+63
-39
lines changed

.github/workflows/build.yml

+24-3
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
fail-fast: false
1919
matrix:
2020
platform: [ ubuntu-latest, windows-latest, macos-latest ]
21-
toolchain: [ stable, beta, 1.63.0 ] # 1.63.0 is the MSRV for all crates.
21+
toolchain: [ stable, beta, 1.63.0 ] # 1.63.0 is the MSRV for all crates but `lightning-transaction-sync`.
2222
exclude:
2323
- platform: windows-latest
2424
toolchain: 1.63.0
@@ -44,6 +44,27 @@ jobs:
4444
- name: Set RUSTFLAGS to deny warnings
4545
if: "matrix.toolchain == '1.63.0'"
4646
run: echo "RUSTFLAGS=-D warnings" >> "$GITHUB_ENV"
47+
- name: Run CI script
48+
shell: bash # Default on Winblows is powershell
49+
run: CI_ENV=1 CI_MINIMIZE_DISK_USAGE=1 ./ci/ci-tests.sh
50+
51+
build-tx-sync:
52+
strategy:
53+
fail-fast: false
54+
matrix:
55+
platform: [ ubuntu-latest, macos-latest ]
56+
toolchain: [ stable, beta, 1.75.0 ] # 1.75.0 is the MSRV for `lightning-transaction-sync`.
57+
runs-on: ${{ matrix.platform }}
58+
steps:
59+
- name: Checkout source code
60+
uses: actions/checkout@v4
61+
- name: Install Rust ${{ matrix.toolchain }} toolchain
62+
run: |
63+
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile=minimal --default-toolchain ${{ matrix.toolchain }}
64+
rustup override set ${{ matrix.toolchain }}
65+
- name: Set RUSTFLAGS to deny warnings
66+
if: "matrix.toolchain == '1.75.0'"
67+
run: echo "RUSTFLAGS=-D warnings" >> "$GITHUB_ENV"
4768
- name: Enable caching for bitcoind
4869
id: cache-bitcoind
4970
uses: actions/cache@v4
@@ -57,7 +78,7 @@ jobs:
5778
path: bin/electrs-${{ runner.os }}-${{ runner.arch }}
5879
key: electrs-${{ runner.os }}-${{ runner.arch }}
5980
- name: Download bitcoind/electrs
60-
if: "matrix.platform != 'windows-latest' && (steps.cache-bitcoind.outputs.cache-hit != 'true' || steps.cache-electrs.outputs.cache-hit != 'true')"
81+
if: "steps.cache-bitcoind.outputs.cache-hit != 'true' || steps.cache-electrs.outputs.cache-hit != 'true'"
6182
run: |
6283
source ./contrib/download_bitcoind_electrs.sh
6384
mkdir bin
@@ -69,7 +90,7 @@ jobs:
6990
echo "ELECTRS_EXE=$( pwd )/bin/electrs-${{ runner.os }}-${{ runner.arch }}" >> "$GITHUB_ENV"
7091
- name: Run CI script
7192
shell: bash # Default on Winblows is powershell
72-
run: CI_ENV=1 CI_MINIMIZE_DISK_USAGE=1 ./ci/ci-tests.sh
93+
run: CI_ENV=1 CI_MINIMIZE_DISK_USAGE=1 ./ci/ci-tx-sync-tests.sh
7394

7495
coverage:
7596
strategy:

ci/ci-tests.sh

+4-36
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
set -eox pipefail
33

44
RUSTC_MINOR_VERSION=$(rustc --version | awk '{ split($2,a,"."); print a[2] }')
5-
HOST_PLATFORM="$(rustc --version --verbose | grep "host:" | awk '{ print $2 }')"
65

76
# Some crates require pinning to meet our MSRV even for our downstream users,
87
# which we do here.
@@ -14,16 +13,6 @@ function PIN_RELEASE_DEPS {
1413
# Starting with version 0.7.12, the `tokio-util` crate has an MSRV of rustc 1.70.0
1514
[ "$RUSTC_MINOR_VERSION" -lt 70 ] && cargo update -p tokio-util --precise "0.7.11" --verbose
1615

17-
# url 2.5.3 switched to idna 1.0.3 and ICU4X, which requires rustc 1.67 or newer.
18-
# Here we opt to keep using unicode-rs by pinning idna_adapter as described here: https://docs.rs/crate/idna_adapter/1.2.0
19-
[ "$RUSTC_MINOR_VERSION" -lt 67 ] && cargo update -p idna_adapter --precise "1.1.0" --verbose
20-
21-
# indexmap 2.6.0 upgraded to hashbrown 0.15, which unfortunately bumped their MSRV to rustc 1.65 with the 0.15.1 release (and 2.7.0 was released since).
22-
[ "$RUSTC_MINOR_VERSION" -lt 65 ] && cargo update -p [email protected] --precise "2.5.0" --verbose
23-
24-
# Starting with version 0.23.20, the `rustls` crate has an MSRV of rustc 1.71.0
25-
[ "$RUSTC_MINOR_VERSION" -lt 71 ] && cargo update -p [email protected] --precise "0.23.19" --verbose
26-
2716
return 0 # Don't fail the script if our rustc is higher than the last check
2817
}
2918

@@ -35,15 +24,12 @@ PIN_RELEASE_DEPS # pin the release dependencies in our main workspace
3524
# The addr2line v0.21 crate (a dependency of `backtrace` starting with 0.3.69) relies on rustc 1.65
3625
[ "$RUSTC_MINOR_VERSION" -lt 65 ] && cargo update -p backtrace --precise "0.3.68" --verbose
3726

38-
# Starting with version 0.5.9 (there is no .6-.8), the `home` crate has an MSRV of rustc 1.70.0.
39-
[ "$RUSTC_MINOR_VERSION" -lt 70 ] && cargo update -p home --precise "0.5.5" --verbose
40-
4127
# proptest 1.3.0 requires rustc 1.64.0
4228
[ "$RUSTC_MINOR_VERSION" -lt 64 ] && cargo update -p proptest --precise "1.2.0" --verbose
4329

4430
export RUST_BACKTRACE=1
4531

46-
echo -e "\n\nChecking the full workspace."
32+
echo -e "\n\nChecking the workspace, except lightning-transaction-sync."
4733
cargo check --verbose --color always
4834

4935
# When the workspace members change, make sure to update the list here as well
@@ -58,7 +44,6 @@ WORKSPACE_MEMBERS=(
5844
lightning-background-processor
5945
lightning-rapid-gossip-sync
6046
lightning-custom-message
61-
lightning-transaction-sync
6247
lightning-macros
6348
lightning-dns-resolver
6449
lightning-liquidity
@@ -83,25 +68,6 @@ cargo check -p lightning-block-sync --verbose --color always --features rpc-clie
8368
cargo test -p lightning-block-sync --verbose --color always --features rpc-client,rest-client,tokio
8469
cargo check -p lightning-block-sync --verbose --color always --features rpc-client,rest-client,tokio
8570

86-
if [[ "$HOST_PLATFORM" != *windows* ]]; then
87-
echo -e "\n\nChecking Transaction Sync Clients with features."
88-
cargo check -p lightning-transaction-sync --verbose --color always --features esplora-blocking
89-
cargo check -p lightning-transaction-sync --verbose --color always --features esplora-async
90-
cargo check -p lightning-transaction-sync --verbose --color always --features esplora-async-https
91-
cargo check -p lightning-transaction-sync --verbose --color always --features electrum
92-
93-
if [ -z "$CI_ENV" ] && [[ -z "$BITCOIND_EXE" || -z "$ELECTRS_EXE" ]]; then
94-
echo -e "\n\nSkipping testing Transaction Sync Clients due to BITCOIND_EXE or ELECTRS_EXE being unset."
95-
cargo check -p lightning-transaction-sync --tests
96-
else
97-
echo -e "\n\nTesting Transaction Sync Clients with features."
98-
cargo test -p lightning-transaction-sync --verbose --color always --features esplora-blocking
99-
cargo test -p lightning-transaction-sync --verbose --color always --features esplora-async
100-
cargo test -p lightning-transaction-sync --verbose --color always --features esplora-async-https
101-
cargo test -p lightning-transaction-sync --verbose --color always --features electrum
102-
fi
103-
fi
104-
10571
echo -e "\n\nTest futures builds"
10672
cargo test -p lightning-background-processor --verbose --color always --features futures
10773
cargo test -p lightning-background-processor --verbose --color always --features futures --no-default-features
@@ -123,7 +89,9 @@ cargo test -p lightning --verbose --color always --no-default-features
12389
echo -e "\n\nTesting c_bindings builds"
12490
# Note that because `$RUSTFLAGS` is not passed through to doctest builds we cannot selectively
12591
# disable doctests in `c_bindings` so we skip doctests entirely here.
126-
RUSTFLAGS="$RUSTFLAGS --cfg=c_bindings" cargo test --verbose --color always --lib --bins --tests
92+
for DIR in "${WORKSPACE_MEMBERS[@]}"; do
93+
RUSTFLAGS="$RUSTFLAGS --cfg=c_bindings" cargo test -p "$DIR" --verbose --color always --lib --bins
94+
done
12795

12896
for DIR in lightning-invoice lightning-rapid-gossip-sync; do
12997
# check if there is a conflict between no_std and the c_bindings cfg

ci/ci-tx-sync-tests.sh

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/bin/bash
2+
set -eox pipefail
3+
4+
RUSTC_MINOR_VERSION=$(rustc --version | awk '{ split($2,a,"."); print a[2] }')
5+
6+
# Some crates require pinning to meet our MSRV even for our downstream users,
7+
# which we do here.
8+
# Further crates which appear only as dev-dependencies are pinned further down.
9+
function PIN_RELEASE_DEPS {
10+
return 0 # Don't fail the script if our rustc is higher than the last check
11+
}
12+
13+
PIN_RELEASE_DEPS # pin the release dependencies
14+
15+
# Starting with version 0.5.11, the `home` crate has an MSRV of rustc 1.81.0.
16+
[ "$RUSTC_MINOR_VERSION" -lt 81 ] && cargo update -p home --precise "0.5.9" --verbose
17+
18+
export RUST_BACKTRACE=1
19+
20+
echo -e "\n\nChecking Transaction Sync Clients with features."
21+
cargo check -p lightning-transaction-sync --verbose --color always --features esplora-blocking
22+
cargo check -p lightning-transaction-sync --verbose --color always --features esplora-async
23+
cargo check -p lightning-transaction-sync --verbose --color always --features esplora-async-https
24+
cargo check -p lightning-transaction-sync --verbose --color always --features electrum
25+
26+
if [ -z "$CI_ENV" ] && [[ -z "$BITCOIND_EXE" || -z "$ELECTRS_EXE" ]]; then
27+
echo -e "\n\nSkipping testing Transaction Sync Clients due to BITCOIND_EXE or ELECTRS_EXE being unset."
28+
cargo check -p lightning-transaction-sync --tests
29+
else
30+
echo -e "\n\nTesting Transaction Sync Clients with features."
31+
cargo test -p lightning-transaction-sync --verbose --color always --features esplora-blocking
32+
cargo test -p lightning-transaction-sync --verbose --color always --features esplora-async
33+
cargo test -p lightning-transaction-sync --verbose --color always --features esplora-async-https
34+
cargo test -p lightning-transaction-sync --verbose --color always --features electrum
35+
fi

0 commit comments

Comments
 (0)