From a0b9593c54a6bd2de22f9a3a5ce389e1e81ff357 Mon Sep 17 00:00:00 2001 From: Elias Rohrer Date: Fri, 16 Oct 2026 12:04:55 +0200 Subject: [PATCH] Use manual downloads for test binaries Fresh builds fail because automatic test binary downloads require yanked zip releases. The no_download configuration still leaves these requirements in Cargo's dependency graph. Use the existing verified download script for local test binaries, including the VSS jobs, which share the Rust workflow's binary caches. Document the required environment so fresh builds and local tests work with the current harness releases. Upstream fix: https://git.rust-bitcoin.org/rust-bitcoin/corepc/pulls/720 Co-Authored-By: HAL 9000 --- .github/workflows/0fc-integration.yml | 2 +- .github/workflows/hrn-integration.yml | 4 ++-- .github/workflows/postgres-integration.yml | 2 +- .github/workflows/rust.yml | 4 ++-- .github/workflows/vss-integration.yml | 24 +++++++++++++++++++ .github/workflows/vss-no-auth-integration.yml | 24 +++++++++++++++++++ Cargo.toml | 6 ++--- README.md | 14 +++++++++++ tests/common/mod.rs | 10 +++----- tests/integration_tests_rust.rs | 10 ++------ 10 files changed, 75 insertions(+), 25 deletions(-) diff --git a/.github/workflows/0fc-integration.yml b/.github/workflows/0fc-integration.yml index 1eab8b3ae1..14bb31194a 100644 --- a/.github/workflows/0fc-integration.yml +++ b/.github/workflows/0fc-integration.yml @@ -46,4 +46,4 @@ jobs: echo "ELECTRS_EXE=$( pwd )/bin/electrs-${{ runner.os }}-${{ runner.arch }}" >> "$GITHUB_ENV" - name: Test with 0FC enabled run: | - RUSTFLAGS="--cfg no_download --cfg cycle_tests --cfg tokio_unstable --cfg zero_fee_commitment_tests" cargo test -- --test-threads=1 --no-capture + RUSTFLAGS="--cfg cycle_tests --cfg tokio_unstable --cfg zero_fee_commitment_tests" cargo test -- --test-threads=1 --no-capture diff --git a/.github/workflows/hrn-integration.yml b/.github/workflows/hrn-integration.yml index 732aad029f..37d3462451 100644 --- a/.github/workflows/hrn-integration.yml +++ b/.github/workflows/hrn-integration.yml @@ -42,5 +42,5 @@ jobs: echo "ELECTRS_EXE=$( pwd )/bin/electrs-${{ runner.os }}-${{ runner.arch }}" >> "$GITHUB_ENV" - name: Run HRN Integration Tests run: | - RUSTFLAGS="--cfg no_download --cfg hrn_tests $RUSTFLAGS" cargo test --test integration_tests_hrn - RUSTFLAGS="--cfg no_download --cfg hrn_tests $RUSTFLAGS" cargo test --test integration_tests_hrn --no-default-features --features uniffi-default + RUSTFLAGS="--cfg hrn_tests $RUSTFLAGS" cargo test --test integration_tests_hrn + RUSTFLAGS="--cfg hrn_tests $RUSTFLAGS" cargo test --test integration_tests_hrn --no-default-features --features uniffi-default diff --git a/.github/workflows/postgres-integration.yml b/.github/workflows/postgres-integration.yml index d27e3123ea..a3c8e053af 100644 --- a/.github/workflows/postgres-integration.yml +++ b/.github/workflows/postgres-integration.yml @@ -70,4 +70,4 @@ jobs: env: TEST_POSTGRES_URL: "host=localhost user=postgres password=postgres" run: | - RUSTFLAGS="--cfg no_download --cfg cycle_tests" cargo test --features storage-postgres --test integration_tests_postgres + RUSTFLAGS="--cfg cycle_tests" cargo test --features storage-postgres --test integration_tests_postgres diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index a23120bf9a..932c1d537d 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -87,11 +87,11 @@ jobs: - name: Test on Rust ${{ matrix.toolchain }} if: "matrix.platform != 'windows-latest'" run: | - RUSTFLAGS="--cfg no_download --cfg cycle_tests --cfg tokio_unstable" cargo test + RUSTFLAGS="--cfg cycle_tests --cfg tokio_unstable" cargo test - name: Test with UniFFI support on Rust ${{ matrix.toolchain }} if: "matrix.platform != 'windows-latest' && matrix.build-uniffi" run: | - RUSTFLAGS="--cfg no_download --cfg cycle_tests" cargo test --no-default-features --features uniffi-default + RUSTFLAGS="--cfg cycle_tests" cargo test --no-default-features --features uniffi-default linting: name: Linting diff --git a/.github/workflows/vss-integration.yml b/.github/workflows/vss-integration.yml index 6b66eacd48..3b08930273 100644 --- a/.github/workflows/vss-integration.yml +++ b/.github/workflows/vss-integration.yml @@ -37,6 +37,30 @@ jobs: repository: lightningdevkit/vss-server path: vss-server + - name: Enable caching for bitcoind + id: cache-bitcoind + uses: actions/cache@v4 + with: + path: bin/bitcoind-${{ runner.os }}-${{ runner.arch }} + key: bitcoind-31.1-${{ runner.os }}-${{ runner.arch }} + - name: Enable caching for electrs + id: cache-electrs + uses: actions/cache@v4 + with: + path: bin/electrs-${{ runner.os }}-${{ runner.arch }} + key: electrs-${{ runner.os }}-${{ runner.arch }} + - name: Download bitcoind/electrs + if: "steps.cache-bitcoind.outputs.cache-hit != 'true' || steps.cache-electrs.outputs.cache-hit != 'true'" + run: | + source ./ldk-node/scripts/download_bitcoind_electrs.sh + mkdir -p bin + mv "$BITCOIND_EXE" bin/bitcoind-${{ runner.os }}-${{ runner.arch }} + mv "$ELECTRS_EXE" bin/electrs-${{ runner.os }}-${{ runner.arch }} + - name: Set bitcoind/electrs environment variables + run: | + echo "BITCOIND_EXE=$( pwd )/bin/bitcoind-${{ runner.os }}-${{ runner.arch }}" >> "$GITHUB_ENV" + echo "ELECTRS_EXE=$( pwd )/bin/electrs-${{ runner.os }}-${{ runner.arch }}" >> "$GITHUB_ENV" + - name: Build and Deploy VSS Server run: | cd vss-server diff --git a/.github/workflows/vss-no-auth-integration.yml b/.github/workflows/vss-no-auth-integration.yml index 9e7fb6c51b..4c3432ce88 100644 --- a/.github/workflows/vss-no-auth-integration.yml +++ b/.github/workflows/vss-no-auth-integration.yml @@ -37,6 +37,30 @@ jobs: repository: lightningdevkit/vss-server path: vss-server + - name: Enable caching for bitcoind + id: cache-bitcoind + uses: actions/cache@v4 + with: + path: bin/bitcoind-${{ runner.os }}-${{ runner.arch }} + key: bitcoind-31.1-${{ runner.os }}-${{ runner.arch }} + - name: Enable caching for electrs + id: cache-electrs + uses: actions/cache@v4 + with: + path: bin/electrs-${{ runner.os }}-${{ runner.arch }} + key: electrs-${{ runner.os }}-${{ runner.arch }} + - name: Download bitcoind/electrs + if: "steps.cache-bitcoind.outputs.cache-hit != 'true' || steps.cache-electrs.outputs.cache-hit != 'true'" + run: | + source ./ldk-node/scripts/download_bitcoind_electrs.sh + mkdir -p bin + mv "$BITCOIND_EXE" bin/bitcoind-${{ runner.os }}-${{ runner.arch }} + mv "$ELECTRS_EXE" bin/electrs-${{ runner.os }}-${{ runner.arch }} + - name: Set bitcoind/electrs environment variables + run: | + echo "BITCOIND_EXE=$( pwd )/bin/bitcoind-${{ runner.os }}-${{ runner.arch }}" >> "$GITHUB_ENV" + echo "ELECTRS_EXE=$( pwd )/bin/electrs-${{ runner.os }}-${{ runner.arch }}" >> "$GITHUB_ENV" + - name: Build and Deploy VSS Server run: | cd vss-server diff --git a/Cargo.toml b/Cargo.toml index 502fa1a25f..f880b91162 100755 --- a/Cargo.toml +++ b/Cargo.toml @@ -147,10 +147,8 @@ criterion = { version = "0.7.0", features = ["async_tokio"] } ldk-node-062 = { package = "ldk-node", version = "=0.6.2" } ldk-node-070 = { package = "ldk-node", version = "=0.7.0" } -[target.'cfg(not(no_download))'.dev-dependencies] -electrsd = { version = "0.36.1", default-features = false, features = ["legacy", "esplora_a33e97e1", "corepc-node_29_0"] } - -[target.'cfg(no_download)'.dev-dependencies] +# Test binaries are provided via scripts/download_bitcoind_electrs.sh. +# Keep automatic downloads disabled to avoid the yanked zip dependency. electrsd = { version = "0.36.1", default-features = false, features = ["legacy"] } corepc-node = { version = "0.10.1", default-features = false, features = ["29_0"] } diff --git a/README.md b/README.md index b1d663ef67..1652541137 100644 --- a/README.md +++ b/README.md @@ -133,6 +133,20 @@ LDK Node itself is written in [Rust][rust] and may therefore be natively added a ## MSRV The Minimum Supported Rust Version (MSRV) is currently 1.85.0. +## Running Tests + +Rust integration tests and benchmarks require Bitcoin Core and Esplora-enabled `electrs` binaries. +On Linux and macOS, run the following from the repository root in Bash: + +```bash +source ./scripts/download_bitcoind_electrs.sh +RUSTFLAGS="--cfg tokio_unstable" cargo test +``` + +The script requires `curl`, `unzip`, `tar`, and `shasum`. It verifies the downloads and exports +`BITCOIND_EXE` and `ELECTRS_EXE` for the current shell. Alternatively, set these variables to +compatible binaries you already have. Cargo's automatic binary downloads are disabled. + [api_docs]: https://docs.rs/ldk-node/*/ldk_node/ [api_docs_node]: https://docs.rs/ldk-node/*/ldk_node/struct.Node.html [api_docs_builder]: https://docs.rs/ldk-node/*/ldk_node/struct.Builder.html diff --git a/tests/common/mod.rs b/tests/common/mod.rs index bb1f366b1c..93bab690f4 100644 --- a/tests/common/mod.rs +++ b/tests/common/mod.rs @@ -345,19 +345,15 @@ macro_rules! expect_payment_successful_event { pub(crate) use expect_payment_successful_event; pub(crate) fn setup_bitcoind_and_electrsd() -> (BitcoinD, ElectrsD) { - let bitcoind_exe = - env::var("BITCOIND_EXE").ok().or_else(|| corepc_node::downloaded_exe_path().ok()).expect( - "you need to provide an env var BITCOIND_EXE or specify a bitcoind version feature", - ); + let bitcoind_exe = env::var("BITCOIND_EXE") + .expect("set BITCOIND_EXE or source ./scripts/download_bitcoind_electrs.sh before testing"); let mut bitcoind_conf = corepc_node::Conf::default(); bitcoind_conf.network = "regtest"; bitcoind_conf.args.push("-rest"); let bitcoind = BitcoinD::with_conf(bitcoind_exe, &bitcoind_conf).unwrap(); let electrs_exe = env::var("ELECTRS_EXE") - .ok() - .or_else(electrsd::downloaded_exe_path) - .expect("you need to provide env var ELECTRS_EXE or specify an electrsd version feature"); + .expect("set ELECTRS_EXE or source ./scripts/download_bitcoind_electrs.sh before testing"); let mut electrsd_conf = electrsd::Conf::default(); electrsd_conf.http_enabled = true; electrsd_conf.network = "regtest"; diff --git a/tests/integration_tests_rust.rs b/tests/integration_tests_rust.rs index 080fb8c359..2c94803499 100644 --- a/tests/integration_tests_rust.rs +++ b/tests/integration_tests_rust.rs @@ -3123,11 +3123,7 @@ async fn run_rbf_splice_channel_test(confirm_original: bool) { // Use a custom bitcoind config with a lower incrementalrelayfee so that the +25 sat/kwu // (0.1 sat/vB) RBF feerate bump satisfies BIP125's absolute fee increase requirement. let bitcoind_exe = std::env::var("BITCOIND_EXE") - .ok() - .or_else(|| corepc_node::downloaded_exe_path().ok()) - .expect( - "you need to provide an env var BITCOIND_EXE or specify a bitcoind version feature", - ); + .expect("set BITCOIND_EXE or source ./scripts/download_bitcoind_electrs.sh before testing"); let mut bitcoind_conf = corepc_node::Conf::default(); bitcoind_conf.network = "regtest"; bitcoind_conf.args.push("-rest"); @@ -3135,9 +3131,7 @@ async fn run_rbf_splice_channel_test(confirm_original: bool) { let bitcoind = BitcoinD::with_conf(bitcoind_exe, &bitcoind_conf).unwrap(); let electrs_exe = std::env::var("ELECTRS_EXE") - .ok() - .or_else(electrsd::downloaded_exe_path) - .expect("you need to provide env var ELECTRS_EXE or specify an electrsd version feature"); + .expect("set ELECTRS_EXE or source ./scripts/download_bitcoind_electrs.sh before testing"); let mut electrsd_conf = electrsd::Conf::default(); electrsd_conf.http_enabled = true; electrsd_conf.network = "regtest";