Skip to content

Commit cdd1298

Browse files
authored
Merge pull request lightningdevkit#3289 from tnull/2024-09-fix-rgs-bp-builds
Fix builds of `lightning-rapid-gossip-sync` and `lightning-background-processor` crates
2 parents ca27a85 + 545b037 commit cdd1298

File tree

32 files changed

+139
-169
lines changed

32 files changed

+139
-169
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -149,16 +149,11 @@ jobs:
149149
run: |
150150
cd lightning
151151
RUSTFLAGS="--cfg=require_route_graph_test" cargo test
152-
RUSTFLAGS="--cfg=require_route_graph_test" cargo test --features hashbrown
153152
cd ..
154153
- name: Run benchmarks on Rust ${{ matrix.toolchain }}
155154
run: |
156155
cd bench
157156
RUSTFLAGS="--cfg=ldk_bench --cfg=require_route_graph_test" cargo bench
158-
- name: Run benchmarks with hashbrown on Rust ${{ matrix.toolchain }}
159-
run: |
160-
cd bench
161-
RUSTFLAGS="--cfg=ldk_bench --cfg=require_route_graph_test" cargo bench --features hashbrown
162157
163158
check_commits:
164159
runs-on: ubuntu-latest
@@ -199,15 +194,15 @@ jobs:
199194
- name: Run cargo check for release build.
200195
run: |
201196
cargo check --release
202-
cargo check --no-default-features --features=no-std --release
203197
cargo check --no-default-features --features=futures,std --release
204198
cargo doc --release
205199
- name: Run cargo check for Taproot build.
206200
run: |
207201
cargo check --release
208-
cargo check --no-default-features --features=no-std --release
202+
cargo check --no-default-features --release
209203
cargo check --no-default-features --features=futures,std --release
210204
cargo doc --release
205+
cargo doc --no-default-features --release
211206
env:
212207
RUSTFLAGS: '--cfg=taproot'
213208
RUSTDOCFLAGS: '--cfg=taproot'

Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
[workspace]
22
resolver = "2"
33

4+
# When the workspace members change, make sure to update the list here as well
5+
# as in `ci/ci-tests.sh`.
46
members = [
57
"lightning",
68
"lightning-types",

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Crates
2727
-----------
2828
1. [lightning](./lightning)
2929
The core of the LDK library, implements the Lightning protocol, channel state machine,
30-
and on-chain logic. Supports `no-std` and exposes only relatively low-level interfaces.
30+
and on-chain logic. Supports `no_std` and exposes only relatively low-level interfaces.
3131
2. [lightning-background-processor](./lightning-background-processor)
3232
Utilities to perform required background tasks for Rust Lightning.
3333
3. [lightning-block-sync](./lightning-block-sync)

bench/Cargo.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@ edition = "2021"
88
name = "bench"
99
harness = false
1010

11-
[features]
12-
hashbrown = ["lightning/hashbrown"]
13-
1411
[dependencies]
1512
lightning = { path = "../lightning", features = ["_test_utils", "criterion"] }
1613
lightning-persister = { path = "../lightning-persister", features = ["criterion"] }

bench/README.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
11
This crate uses criterion to benchmark various LDK functions.
22

33
It can be run as `RUSTFLAGS=--cfg=ldk_bench cargo bench`.
4-
5-
For routing or other HashMap-bottlenecked functions, the `hashbrown` feature
6-
should also be benchmarked.

ci/check-compiles.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ cargo check
66
cargo doc
77
cargo doc --document-private-items
88
cd fuzz && RUSTFLAGS="--cfg=fuzzing --cfg=secp256k1_fuzz --cfg=hashes_fuzz" cargo check --features=stdin_fuzz
9-
cd ../lightning && cargo check --no-default-features --features=no-std
9+
cd ../lightning && cargo check --no-default-features
1010
cd .. && RUSTC_BOOTSTRAP=1 RUSTFLAGS="--cfg=c_bindings" cargo check -Z avoid-dev-deps

ci/ci-tests.sh

Lines changed: 31 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,33 @@ PIN_RELEASE_DEPS # pin the release dependencies in our main workspace
3030

3131
export RUST_BACKTRACE=1
3232

33-
echo -e "\n\nBuilding and testing all workspace crates..."
34-
cargo test --verbose --color always
33+
echo -e "\n\nChecking the full workspace."
3534
cargo check --verbose --color always
3635

37-
echo -e "\n\nBuilding and testing Block Sync Clients with features"
36+
# When the workspace members change, make sure to update the list here as well
37+
# as in `Cargo.toml`.
38+
WORKSPACE_MEMBERS=(
39+
lightning
40+
lightning-types
41+
lightning-block-sync
42+
lightning-invoice
43+
lightning-net-tokio
44+
lightning-persister
45+
lightning-background-processor
46+
lightning-rapid-gossip-sync
47+
lightning-custom-message
48+
lightning-transaction-sync
49+
possiblyrandom
50+
)
51+
52+
echo -e "\n\nChecking, testing, and building docs for all workspace members individually..."
53+
for DIR in "${WORKSPACE_MEMBERS[@]}"; do
54+
cargo test -p "$DIR" --verbose --color always
55+
cargo check -p "$DIR" --verbose --color always
56+
cargo doc -p "$DIR" --document-private-items
57+
done
58+
59+
echo -e "\n\nChecking and testing Block Sync Clients with features"
3860

3961
cargo test -p lightning-block-sync --verbose --color always --features rest-client
4062
cargo check -p lightning-block-sync --verbose --color always --features rest-client
@@ -80,38 +102,36 @@ grep '^max_level_' lightning/Cargo.toml | awk '{ print $1 }'| while read -r FEAT
80102
RUSTFLAGS="$RUSTFLAGS -A unused_variables -A unused_macros -A unused_imports -A dead_code" cargo check -p lightning --verbose --color always --features "$FEATURE"
81103
done
82104

83-
echo -e "\n\nTesting no-std builds"
105+
echo -e "\n\nTesting no_std builds"
84106
for DIR in lightning-invoice lightning-rapid-gossip-sync; do
85107
cargo test -p $DIR --verbose --color always --no-default-features
86108
done
87109

88-
cargo test -p lightning --verbose --color always --no-default-features --features no-std
89-
# check if there is a conflict between no-std and the default std feature
90-
cargo test -p lightning --verbose --color always --features no-std
110+
cargo test -p lightning --verbose --color always --no-default-features
91111

92112
echo -e "\n\nTesting c_bindings builds"
93113
# Note that because `$RUSTFLAGS` is not passed through to doctest builds we cannot selectively
94114
# disable doctests in `c_bindings` so we skip doctests entirely here.
95115
RUSTFLAGS="$RUSTFLAGS --cfg=c_bindings" cargo test --verbose --color always --lib --bins --tests
96116

97117
for DIR in lightning-invoice lightning-rapid-gossip-sync; do
98-
# check if there is a conflict between no-std and the c_bindings cfg
118+
# check if there is a conflict between no_std and the c_bindings cfg
99119
RUSTFLAGS="$RUSTFLAGS --cfg=c_bindings" cargo test -p $DIR --verbose --color always --no-default-features
100120
done
101121

102122
# Note that because `$RUSTFLAGS` is not passed through to doctest builds we cannot selectively
103123
# disable doctests in `c_bindings` so we skip doctests entirely here.
104124
RUSTFLAGS="$RUSTFLAGS --cfg=c_bindings" cargo test -p lightning-background-processor --verbose --color always --features futures --no-default-features --lib --bins --tests
105-
RUSTFLAGS="$RUSTFLAGS --cfg=c_bindings" cargo test -p lightning --verbose --color always --no-default-features --features=no-std --lib --bins --tests
125+
RUSTFLAGS="$RUSTFLAGS --cfg=c_bindings" cargo test -p lightning --verbose --color always --no-default-features --lib --bins --tests
106126

107127
echo -e "\n\nTesting other crate-specific builds"
108128
# Note that outbound_commitment_test only runs in this mode because of hardcoded signature values
109129
RUSTFLAGS="$RUSTFLAGS --cfg=ldk_test_vectors" cargo test -p lightning --verbose --color always --no-default-features --features=std
110130
# This one only works for lightning-invoice
111-
# check that compile with no-std and serde works in lightning-invoice
131+
# check that compile with no_std and serde works in lightning-invoice
112132
cargo test -p lightning-invoice --verbose --color always --no-default-features --features serde
113133

114-
echo -e "\n\nTesting no-std build on a downstream no-std crate"
134+
echo -e "\n\nTesting no_std build on a downstream no-std crate"
115135
# check no-std compatibility across dependencies
116136
pushd no-std-check
117137
cargo check --verbose --color always --features lightning-transaction-sync

fuzz/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ libfuzzer_fuzz = ["libfuzzer-sys"]
1818
stdin_fuzz = []
1919

2020
[dependencies]
21-
lightning = { path = "../lightning", features = ["regex", "hashbrown", "_test_utils"] }
21+
lightning = { path = "../lightning", features = ["regex", "_test_utils"] }
2222
lightning-invoice = { path = "../lightning-invoice" }
2323
lightning-rapid-gossip-sync = { path = "../lightning-rapid-gossip-sync" }
2424
bech32 = "0.9.1"

lightning-background-processor/Cargo.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,14 @@ rustdoc-args = ["--cfg", "docsrs"]
1515

1616
[features]
1717
futures = [ ]
18-
std = []
18+
std = ["lightning/std", "bitcoin-io/std", "bitcoin_hashes/std"]
1919

2020
default = ["std"]
2121

2222
[dependencies]
2323
bitcoin = { version = "0.32.2", default-features = false }
24+
bitcoin_hashes = { version = "0.14.0", default-features = false }
25+
bitcoin-io = { version = "0.1.2", default-features = false }
2426
lightning = { version = "0.0.124", path = "../lightning", default-features = false }
2527
lightning-rapid-gossip-sync = { version = "0.0.124", path = "../lightning-rapid-gossip-sync", default-features = false }
2628

lightning-background-processor/src/lib.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
//! Utilities that take care of tasks that (1) need to happen periodically to keep Rust-Lightning
2-
//! running properly, and (2) either can or should be run in the background. See docs for
3-
//! [`BackgroundProcessor`] for more details on the nitty-gritty.
4-
2+
//! running properly, and (2) either can or should be run in the background.
3+
#![cfg_attr(feature = "std", doc = "See docs for [`BackgroundProcessor`] for more details.")]
54
#![deny(rustdoc::broken_intra_doc_links)]
65
#![deny(rustdoc::private_intra_doc_links)]
76
#![deny(missing_docs)]

0 commit comments

Comments
 (0)