Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions .github/workflows/benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
uses: actions/cache@v4
with:
path: bin/bitcoind-${{ runner.os }}-${{ runner.arch }}
key: bitcoind-${{ runner.os }}-${{ runner.arch }}
key: bitcoind-29.0-${{ runner.os }}-${{ runner.arch }}
- name: Enable caching for electrs
id: cache-electrs
uses: actions/cache@v4
Expand All @@ -34,7 +34,7 @@ jobs:
if: "(steps.cache-bitcoind.outputs.cache-hit != 'true' || steps.cache-electrs.outputs.cache-hit != 'true')"
run: |
source ./scripts/download_bitcoind_electrs.sh
mkdir bin
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
Expand Down
64 changes: 55 additions & 9 deletions .github/workflows/cln-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,64 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install dependencies
- name: Create temporary directory for CLN data
run: echo "CLN_DATA_DIR=$(mktemp -d)" >> $GITHUB_ENV

- name: Start bitcoind and electrs
run: docker compose -f docker-compose-cln.yml up -d bitcoin electrs
env:
CLN_DATA_DIR: ${{ env.CLN_DATA_DIR }}

- name: Wait for bitcoind to be healthy
run: |
for i in $(seq 1 30); do
if docker compose -f docker-compose-cln.yml exec bitcoin bitcoin-cli -regtest -rpcuser=user -rpcpassword=pass getblockchaininfo > /dev/null 2>&1; then
echo "bitcoind is ready"
exit 0
fi
echo "Waiting for bitcoind... ($i/30)"
sleep 2
done
echo "ERROR: bitcoind not ready"
exit 1

- name: Mine initial block for CLN
run: |
sudo apt-get update -y
sudo apt-get install -y socat
docker compose -f docker-compose-cln.yml exec bitcoin bitcoin-cli -regtest -rpcuser=user -rpcpassword=pass createwallet miner
ADDR=$(docker compose -f docker-compose-cln.yml exec bitcoin bitcoin-cli -regtest -rpcuser=user -rpcpassword=pass -rpcwallet=miner getnewaddress)
docker compose -f docker-compose-cln.yml exec bitcoin bitcoin-cli -regtest -rpcuser=user -rpcpassword=pass generatetoaddress 1 "$ADDR"
docker compose -f docker-compose-cln.yml exec bitcoin bitcoin-cli -regtest -rpcuser=user -rpcpassword=pass unloadwallet miner

- name: Start lightningd
run: docker compose -f docker-compose-cln.yml up -d cln
env:
CLN_DATA_DIR: ${{ env.CLN_DATA_DIR }}

- name: Start bitcoind, electrs, and lightningd
run: docker compose -f docker-compose-cln.yml up -d
- name: Wait for CLN to be ready
run: |
for i in $(seq 1 30); do
if docker compose -f docker-compose-cln.yml exec cln test -S /root/.lightning/regtest/lightning-rpc 2>/dev/null; then
echo "CLN RPC socket found"
break
fi
echo "Waiting for CLN RPC socket... ($i/30)"
sleep 2
done
docker compose -f docker-compose-cln.yml exec cln test -S /root/.lightning/regtest/lightning-rpc || {
echo "ERROR: CLN RPC socket not found after 60 seconds"
docker compose -f docker-compose-cln.yml logs cln
exit 1
}

- name: Forward lightningd RPC socket
- name: Set permissions for CLN data directory
run: |
docker exec ldk-node-cln-1 sh -c "socat -d -d TCP-LISTEN:9937,fork,reuseaddr UNIX-CONNECT:/root/.lightning/regtest/lightning-rpc&"
socat -d -d UNIX-LISTEN:/tmp/lightning-rpc,reuseaddr,fork TCP:127.0.0.1:9937&
sudo chown -R $(id -u):$(id -g) $CLN_DATA_DIR
sudo chmod -R 755 $CLN_DATA_DIR
env:
CLN_DATA_DIR: ${{ env.CLN_DATA_DIR }}

- name: Run CLN integration tests
run: RUSTFLAGS="--cfg cln_test" cargo test --test integration_tests_cln
run: CLN_SOCKET_PATH=$CLN_DATA_DIR/regtest/lightning-rpc
RUSTFLAGS="--cfg cln_test" cargo test --test integration_tests_cln -- --show-output --test-threads=1
env:
CLN_DATA_DIR: ${{ env.CLN_DATA_DIR }}
56 changes: 56 additions & 0 deletions .github/workflows/eclair-integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: CI Checks - Eclair Integration Tests

on: [push, pull_request]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
check-eclair:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Start bitcoind and electrs
run: docker compose -f docker-compose-eclair.yml up -d bitcoin electrs

- name: Wait for bitcoind to be healthy
run: |
for i in $(seq 1 30); do
if docker compose -f docker-compose-eclair.yml exec bitcoin bitcoin-cli -regtest -rpcuser=user -rpcpassword=pass getblockchaininfo > /dev/null 2>&1; then
echo "bitcoind is ready"
exit 0
fi
echo "Waiting for bitcoind... ($i/30)"
sleep 2
done
echo "ERROR: bitcoind not ready"
exit 1

- name: Create wallets on bitcoind
run: |
docker compose -f docker-compose-eclair.yml exec bitcoin bitcoin-cli -regtest -rpcuser=user -rpcpassword=pass createwallet eclair
docker compose -f docker-compose-eclair.yml exec bitcoin bitcoin-cli -regtest -rpcuser=user -rpcpassword=pass -rpcwallet=eclair getnewaddress
docker compose -f docker-compose-eclair.yml exec bitcoin bitcoin-cli -regtest -rpcuser=user -rpcpassword=pass createwallet ldk_node_test

- name: Start Eclair
run: docker compose -f docker-compose-eclair.yml up -d eclair

- name: Wait for Eclair to be ready
run: |
for i in $(seq 1 60); do
if curl -s -u :eclairpassword -X POST http://127.0.0.1:8080/getinfo > /dev/null 2>&1; then
echo "Eclair is ready"
exit 0
fi
echo "Waiting for Eclair... ($i/60)"
sleep 5
done
echo "Eclair failed to start"
docker compose -f docker-compose-eclair.yml logs eclair
exit 1

- name: Run Eclair integration tests
run: RUSTFLAGS="--cfg eclair_test" cargo test --test integration_tests_eclair -- --show-output --test-threads=1
43 changes: 35 additions & 8 deletions .github/workflows/lnd-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ jobs:
uses: actions/checkout@v4

- name: Check and install CMake if needed
# lnd_grpc_rust (via prost-build v0.10.4) requires CMake >= 3.5 but is incompatible with CMake >= 4.0.
# This step checks if CMake is missing, below 3.5, or 4.0 or higher, and installs CMake 3.31.6 if needed,
# ensuring compatibility with prost-build in ubuntu-latest.
run: |
if ! command -v cmake &> /dev/null ||
[ "$(cmake --version | head -n1 | cut -d' ' -f3)" \< "3.5" ] ||
Expand All @@ -33,24 +30,54 @@ jobs:
fi

- name: Create temporary directory for LND data
id: create-temp-dir
run: echo "LND_DATA_DIR=$(mktemp -d)" >> $GITHUB_ENV

- name: Start bitcoind, electrs, and LND
run: docker compose -f docker-compose-lnd.yml up -d
env:
LND_DATA_DIR: ${{ env.LND_DATA_DIR }}

- name: Wait for LND to be ready
run: |
for i in $(seq 1 30); do
if docker exec ldk-node-lnd test -f /root/.lnd/data/chain/bitcoin/regtest/admin.macaroon 2>/dev/null; then
echo "LND macaroon found"
break
fi
echo "Waiting for LND macaroon... ($i/30)"
sleep 2
done
docker exec ldk-node-lnd test -f /root/.lnd/data/chain/bitcoin/regtest/admin.macaroon || {
echo "ERROR: LND macaroon not found after 60 seconds"
docker compose -f docker-compose-lnd.yml logs lnd
exit 1
}

- name: Set permissions for LND data directory
# In PR 4622 (https://github.com/lightningnetwork/lnd/pull/4622),
# LND sets file permissions to 0700, preventing test code from accessing them.
# This step ensures the test suite has the necessary permissions.
run: sudo chmod -R 755 $LND_DATA_DIR
env:
LND_DATA_DIR: ${{ env.LND_DATA_DIR }}

- name: Wait for LND gRPC to be ready
run: |
for i in $(seq 1 15); do
if docker exec ldk-node-lnd lncli \
--rpcserver=localhost:8081 \
--tlscertpath=/root/.lnd/tls.cert \
--macaroonpath=/root/.lnd/data/chain/bitcoin/regtest/admin.macaroon \
--network=regtest getinfo 2>/dev/null; then
echo "LND gRPC is ready"
exit 0
fi
echo "Waiting for LND gRPC... ($i/15)"
sleep 2
done
echo "ERROR: LND gRPC not ready after 30 seconds"
docker compose -f docker-compose-lnd.yml logs lnd
exit 1

- name: Run LND integration tests
run: LND_CERT_PATH=$LND_DATA_DIR/tls.cert LND_MACAROON_PATH=$LND_DATA_DIR/data/chain/bitcoin/regtest/admin.macaroon
RUSTFLAGS="--cfg lnd_test" cargo test --test integration_tests_lnd -- --exact --show-output
RUSTFLAGS="--cfg lnd_test" cargo test --test integration_tests_lnd -- --show-output --test-threads=1
env:
LND_DATA_DIR: ${{ env.LND_DATA_DIR }}
4 changes: 2 additions & 2 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
uses: actions/cache@v4
with:
path: bin/bitcoind-${{ runner.os }}-${{ runner.arch }}
key: bitcoind-${{ runner.os }}-${{ runner.arch }}
key: bitcoind-29.0-${{ runner.os }}-${{ runner.arch }}
- name: Enable caching for electrs
id: cache-electrs
uses: actions/cache@v4
Expand All @@ -60,7 +60,7 @@ jobs:
if: "matrix.platform != 'windows-latest' && (steps.cache-bitcoind.outputs.cache-hit != 'true' || steps.cache-electrs.outputs.cache-hit != 'true')"
run: |
source ./scripts/download_bitcoind_electrs.sh
mkdir bin
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
Expand Down
11 changes: 8 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -88,24 +88,28 @@ winapi = { version = "0.3", features = ["winbase"] }
lightning = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "98393b3de3d8aec897e9ab783cb2418da504e204", features = ["std", "_test_utils"] }
rand = { version = "0.9.2", default-features = false, features = ["std", "thread_rng", "os_rng"] }
proptest = "1.0.0"
paste = "1.0"
regex = "1.5.6"
criterion = { version = "0.7.0", features = ["async_tokio"] }
ldk-node-062 = { package = "ldk-node", version = "=0.6.2" }

[target.'cfg(not(no_download))'.dev-dependencies]
electrsd = { version = "0.36.1", default-features = false, features = ["legacy", "esplora_a33e97e1", "corepc-node_27_2"] }
electrsd = { version = "0.36.1", default-features = false, features = ["legacy", "esplora_a33e97e1", "corepc-node_29_0"] }

[target.'cfg(no_download)'.dev-dependencies]
electrsd = { version = "0.36.1", default-features = false, features = ["legacy"] }
corepc-node = { version = "0.10.0", default-features = false, features = ["27_2"] }
corepc-node = { version = "0.10.0", default-features = false, features = ["29_0"] }

[target.'cfg(cln_test)'.dev-dependencies]
clightningrpc = { version = "0.3.0-beta.8", default-features = false }

[target.'cfg(lnd_test)'.dev-dependencies]
lnd_grpc_rust = { version = "2.10.0", default-features = false }
lnd_grpc_rust = { version = "2.14.0", default-features = false }
tokio = { version = "1.37", features = ["fs"] }

[target.'cfg(eclair_test)'.dev-dependencies]
reqwest = { version = "0.12", default-features = false, features = ["json", "rustls-tls"] }

[build-dependencies]
uniffi = { version = "0.29.5", features = ["build"], optional = true }

Expand All @@ -124,6 +128,7 @@ check-cfg = [
"cfg(tokio_unstable)",
"cfg(cln_test)",
"cfg(lnd_test)",
"cfg(eclair_test)",
"cfg(cycle_tests)",
]

Expand Down
22 changes: 22 additions & 0 deletions Dockerfile.eclair
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Repackage acinq/eclair:latest onto a glibc-based runtime.
# The official image uses Alpine (musl libc), which causes SIGSEGV in
# secp256k1-jni because the native library is compiled against glibc.
FROM acinq/eclair:latest AS source

FROM eclipse-temurin:21-jre-jammy
WORKDIR /app

RUN apt-get update && apt-get install -y --no-install-recommends \
bash jq curl unzip && \
rm -rf /var/lib/apt/lists/*

COPY --from=source /sbin/eclair-cli /sbin/eclair-cli
COPY --from=source /app/eclair-node /app/eclair-node

ENV ECLAIR_DATADIR=/data
ENV JAVA_OPTS=

RUN mkdir -p "$ECLAIR_DATADIR"
VOLUME [ "/data" ]

ENTRYPOINT JAVA_OPTS="${JAVA_OPTS}" eclair-node/bin/eclair-node.sh "-Declair.datadir=${ECLAIR_DATADIR}"
21 changes: 15 additions & 6 deletions docker-compose-cln.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
services:
bitcoin:
image: blockstream/bitcoind:27.2
image: blockstream/bitcoind:30.2
platform: linux/amd64
command:
[
Expand All @@ -11,11 +11,16 @@ services:
"-rpcbind=0.0.0.0",
"-rpcuser=user",
"-rpcpassword=pass",
"-fallbackfee=0.00001"
"-fallbackfee=0.00001",
"-rest",
"-zmqpubrawblock=tcp://0.0.0.0:28332",
"-zmqpubrawtx=tcp://0.0.0.0:28333"
]
ports:
- "18443:18443" # Regtest RPC port
- "18444:18444" # Regtest P2P port
- "18443:18443"
- "18444:18444"
- "28332:28332"
- "28333:28333"
networks:
- bitcoin-electrs
healthcheck:
Expand Down Expand Up @@ -48,19 +53,23 @@ services:
- bitcoin-electrs

cln:
image: blockstream/lightningd:v23.08
image: elementsproject/lightningd:v24.08.2
platform: linux/amd64
depends_on:
bitcoin:
condition: service_healthy
volumes:
- ${CLN_DATA_DIR:-/tmp/cln-data}:/root/.lightning
command:
[
"--bitcoin-rpcconnect=bitcoin",
"--bitcoin-rpcport=18443",
"--bitcoin-rpcuser=user",
"--bitcoin-rpcpassword=pass",
"--regtest",
"--experimental-anchors",
"--experimental-splicing",
"--allow-deprecated-apis=true",
"--rpc-file-mode=0666",
]
ports:
- "19846:19846"
Expand Down
Loading
Loading