From: Elias Rohrer Date: Tue, 24 Oct 2023 13:16:38 +0000 (+0200) Subject: Bump MSRV to rustc 1.63.0 and edition to 2021 X-Git-Tag: v0.0.119~16^2~2 X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=ddf25092273df2d592e25663dc6e2d0ecae41a0a;p=rust-lightning Bump MSRV to rustc 1.63.0 and edition to 2021 .. which is a reasonable common ground, also supported by Debian stable. --- diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 00ef76f78..50981f74d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -18,19 +18,7 @@ jobs: fail-fast: false matrix: platform: [ ubuntu-latest, windows-latest, macos-latest ] - toolchain: [ stable, beta ] - include: - - toolchain: stable - platform: ubuntu-latest - # 1.48.0 is the MSRV for all crates except lightning-transaction-sync and Win/Mac - - toolchain: 1.48.0 - platform: ubuntu-latest - # Windows requires 1.49.0 because that's the MSRV for supported Tokio - - toolchain: 1.49.0 - platform: windows-latest - # MacOS-latest requires 1.54.0 because that's what's required for linking to work properly - - toolchain: 1.54.0 - platform: macos-latest + toolchain: [ stable, beta, 1.63.0 ] # 1.63.0 is the MSRV for all crates. runs-on: ${{ matrix.platform }} steps: - name: Checkout source code @@ -168,13 +156,13 @@ jobs: run: | cargo check --release cargo check --no-default-features --features=no-std --release - cargo check --no-default-features --features=futures --release + cargo check --no-default-features --features=futures,std --release cargo doc --release - name: Run cargo check for Taproot build. run: | cargo check --release cargo check --no-default-features --features=no-std --release - cargo check --no-default-features --features=futures --release + cargo check --no-default-features --features=futures,std --release cargo doc --release env: RUSTFLAGS: '--cfg=taproot' diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 350415af2..78c515007 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -88,7 +88,7 @@ be covered by functional tests. When refactoring, structure your PR to make it easy to review and don't hesitate to split it into multiple small, focused PRs. -The Minimum Supported Rust Version (MSRV) currently is 1.48.0 (enforced by +The Minimum Supported Rust Version (MSRV) currently is 1.63.0 (enforced by our GitHub Actions). We support reading serialized LDK objects written by any version of LDK 0.0.99 and above. We support LDK versions 0.0.113 and above reading serialized LDK objects written by modern LDK. Any expected issues with diff --git a/Cargo.toml b/Cargo.toml index 8614cb48c..d3b502403 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,4 +1,5 @@ [workspace] +resolver = "2" members = [ "lightning", diff --git a/bench/Cargo.toml b/bench/Cargo.toml index e582d29da..05354890c 100644 --- a/bench/Cargo.toml +++ b/bench/Cargo.toml @@ -2,7 +2,7 @@ name = "lightning-bench" version = "0.0.1" authors = ["Matt Corallo"] -edition = "2018" +edition = "2021" [[bench]] name = "bench" diff --git a/ci/ci-tests.sh b/ci/ci-tests.sh index 2db32a108..8dfb43266 100755 --- a/ci/ci-tests.sh +++ b/ci/ci-tests.sh @@ -8,38 +8,16 @@ HOST_PLATFORM="$(rustc --version --verbose | grep "host:" | awk '{ print $2 }')" # which we do here. # Further crates which appear only as dev-dependencies are pinned further down. function PIN_RELEASE_DEPS { - # Tokio MSRV on versions 1.17 through 1.26 is rustc 1.49. Above 1.26 MSRV is 1.56. - [ "$RUSTC_MINOR_VERSION" -lt 49 ] && cargo update -p tokio --precise "1.14.1" --verbose - [[ "$RUSTC_MINOR_VERSION" -gt 48 && "$RUSTC_MINOR_VERSION" -lt 56 ]] && cargo update -p tokio --precise "1.25.1" --verbose - - # Sadly the log crate is always a dependency of tokio until 1.20, and has no reasonable MSRV guarantees - [ "$RUSTC_MINOR_VERSION" -lt 49 ] && cargo update -p log --precise "0.4.18" --verbose - - # The serde_json crate switched to Rust edition 2021 starting with v1.0.101, i.e., has MSRV of 1.56 - [ "$RUSTC_MINOR_VERSION" -lt 56 ] && cargo update -p serde_json --precise "1.0.100" --verbose - return 0 # Don't fail the script if our rustc is higher than the last check } PIN_RELEASE_DEPS # pin the release dependencies in our main workspace -# The addr2line v0.20 crate (a dependency of `backtrace` starting with 0.3.68) relies on 1.55+ -[ "$RUSTC_MINOR_VERSION" -lt 55 ] && cargo update -p backtrace --precise "0.3.67" --verbose - -# The quote crate switched to Rust edition 2021 starting with v1.0.31, i.e., has MSRV of 1.56 -[ "$RUSTC_MINOR_VERSION" -lt 56 ] && cargo update -p quote --precise "1.0.30" --verbose - -# The syn crate depends on too-new proc-macro2 starting with v2.0.33, i.e., has MSRV of 1.56 -if [ "$RUSTC_MINOR_VERSION" -lt 56 ]; then - SYN_2_DEP=$(grep -o '"syn 2.*' Cargo.lock | tr -d '",' | tr ' ' ':') - cargo update -p "$SYN_2_DEP" --precise "2.0.32" --verbose -fi +# Starting with version 1.10.0, the `regex` crate has an MSRV of rustc 1.65.0. +[ "$RUSTC_MINOR_VERSION" -lt 65 ] && cargo update -p regex --precise "1.9.6" --verbose -# The proc-macro2 crate switched to Rust edition 2021 starting with v1.0.66, i.e., has MSRV of 1.56 -[ "$RUSTC_MINOR_VERSION" -lt 56 ] && cargo update -p proc-macro2 --precise "1.0.65" --verbose - -# The memchr crate switched to an MSRV of 1.60 starting with v2.6.0 -[ "$RUSTC_MINOR_VERSION" -lt 60 ] && cargo update -p memchr --precise "2.5.0" --verbose +# The addr2line v0.21 crate (a dependency of `backtrace` starting with 0.3.69) relies on rustc 1.65 +[ "$RUSTC_MINOR_VERSION" -lt 65 ] && cargo update -p backtrace --precise "0.3.68" --verbose export RUST_BACKTRACE=1 @@ -59,9 +37,19 @@ cargo test --verbose --color always --features rpc-client,rest-client,tokio cargo check --verbose --color always --features rpc-client,rest-client,tokio popd -if [[ $RUSTC_MINOR_VERSION -gt 67 && "$HOST_PLATFORM" != *windows* ]]; then +if [[ "$HOST_PLATFORM" != *windows* ]]; then echo -e "\n\nBuilding and testing Transaction Sync Clients with features" pushd lightning-transaction-sync + + # zstd-sys 2.0.9+zstd.1.5.5 requires rustc 1.64.0 + [ "$RUSTC_MINOR_VERSION" -lt 64 ] && cargo update -p zstd-sys --precise "2.0.8+zstd.1.5.5" --verbose + # reqwest 0.11.21 had a regression that broke its 1.63.0 MSRV + [ "$RUSTC_MINOR_VERSION" -lt 65 ] && cargo update -p reqwest --precise "0.11.20" --verbose + # jobserver 0.1.27 requires rustc 1.66.0 + [ "$RUSTC_MINOR_VERSION" -lt 66 ] && cargo update -p jobserver --precise "0.1.26" --verbose + # Starting with version 1.10.0, the `regex` crate has an MSRV of rustc 1.65.0. + [ "$RUSTC_MINOR_VERSION" -lt 65 ] && cargo update -p regex --precise "1.9.6" --verbose + cargo test --verbose --color always --features esplora-blocking cargo check --verbose --color always --features esplora-blocking cargo test --verbose --color always --features esplora-async @@ -70,6 +58,7 @@ if [[ $RUSTC_MINOR_VERSION -gt 67 && "$HOST_PLATFORM" != *windows* ]]; then cargo check --verbose --color always --features esplora-async-https cargo test --verbose --color always --features electrum cargo check --verbose --color always --features electrum + popd fi @@ -78,20 +67,16 @@ pushd lightning-background-processor cargo test --verbose --color always --features futures popd -if [ "$RUSTC_MINOR_VERSION" -gt 55 ]; then - echo -e "\n\nTest Custom Message Macros" - pushd lightning-custom-message - cargo test --verbose --color always - [ "$CI_MINIMIZE_DISK_USAGE" != "" ] && cargo clean - popd -fi +echo -e "\n\nTest Custom Message Macros" +pushd lightning-custom-message +cargo test --verbose --color always +[ "$CI_MINIMIZE_DISK_USAGE" != "" ] && cargo clean +popd -if [ "$RUSTC_MINOR_VERSION" -gt 51 ]; then # Current `object` MSRV, subject to change - echo -e "\n\nTest backtrace-debug builds" - pushd lightning - cargo test --verbose --color always --features backtrace - popd -fi +echo -e "\n\nTest backtrace-debug builds" +pushd lightning +cargo test --verbose --color always --features backtrace +popd echo -e "\n\nBuilding with all Log-Limiting features" pushd lightning @@ -102,13 +87,14 @@ popd echo -e "\n\nTesting no-std flags in various combinations" for DIR in lightning lightning-invoice lightning-rapid-gossip-sync; do - [ "$RUSTC_MINOR_VERSION" -gt 50 ] && cargo test -p $DIR --verbose --color always --no-default-features --features no-std + cargo test -p $DIR --verbose --color always --no-default-features --features no-std # check if there is a conflict between no-std and the default std feature - [ "$RUSTC_MINOR_VERSION" -gt 50 ] && cargo test -p $DIR --verbose --color always --features no-std + cargo test -p $DIR --verbose --color always --features no-std done + for DIR in lightning lightning-invoice lightning-rapid-gossip-sync; do # check if there is a conflict between no-std and the c_bindings cfg - [ "$RUSTC_MINOR_VERSION" -gt 50 ] && RUSTFLAGS="--cfg=c_bindings" cargo test -p $DIR --verbose --color always --no-default-features --features=no-std + RUSTFLAGS="--cfg=c_bindings" cargo test -p $DIR --verbose --color always --no-default-features --features=no-std done RUSTFLAGS="--cfg=c_bindings" cargo test --verbose --color always @@ -125,16 +111,7 @@ popd echo -e "\n\nTesting no-std build on a downstream no-std crate" # check no-std compatibility across dependencies pushd no-std-check -if [[ $RUSTC_MINOR_VERSION -gt 67 ]]; then - # lightning-transaction-sync's MSRV is 1.67 - cargo check --verbose --color always --features lightning-transaction-sync -else - # The memchr crate switched to an MSRV of 1.60 starting with v2.6.0 - # This is currently only a release dependency via core2, which we intend to work with - # rust-bitcoin to remove soon. - [ "$RUSTC_MINOR_VERSION" -lt 60 ] && cargo update -p memchr --precise "2.5.0" --verbose - cargo check --verbose --color always -fi +cargo check --verbose --color always --features lightning-transaction-sync [ "$CI_MINIMIZE_DISK_USAGE" != "" ] && cargo clean popd diff --git a/fuzz/Cargo.toml b/fuzz/Cargo.toml index 573096efd..0c279a015 100644 --- a/fuzz/Cargo.toml +++ b/fuzz/Cargo.toml @@ -3,7 +3,7 @@ name = "lightning-fuzz" version = "0.0.1" authors = ["Automatically generated"] publish = false -edition = "2018" +edition = "2021" # Because the function is unused it gets dropped before we link lightning, so # we have to duplicate build.rs here. Note that this is only required for # fuzzing mode. diff --git a/lightning-background-processor/Cargo.toml b/lightning-background-processor/Cargo.toml index 933cbc466..53358d43c 100644 --- a/lightning-background-processor/Cargo.toml +++ b/lightning-background-processor/Cargo.toml @@ -7,7 +7,7 @@ repository = "https://github.com/lightningdevkit/rust-lightning" description = """ Utilities to perform required background tasks for Rust Lightning. """ -edition = "2018" +edition = "2021" [package.metadata.docs.rs] all-features = true diff --git a/lightning-background-processor/src/lib.rs b/lightning-background-processor/src/lib.rs index 449891ba0..689407047 100644 --- a/lightning-background-processor/src/lib.rs +++ b/lightning-background-processor/src/lib.rs @@ -2,9 +2,8 @@ //! running properly, and (2) either can or should be run in the background. See docs for //! [`BackgroundProcessor`] for more details on the nitty-gritty. -// Prefix these with `rustdoc::` when we update our MSRV to be >= 1.52 to remove warnings. -#![deny(broken_intra_doc_links)] -#![deny(private_intra_doc_links)] +#![deny(rustdoc::broken_intra_doc_links)] +#![deny(rustdoc::private_intra_doc_links)] #![deny(missing_docs)] #![cfg_attr(not(feature = "futures"), deny(unsafe_code))] diff --git a/lightning-block-sync/Cargo.toml b/lightning-block-sync/Cargo.toml index 5a8f887c1..c7f7191ed 100644 --- a/lightning-block-sync/Cargo.toml +++ b/lightning-block-sync/Cargo.toml @@ -7,7 +7,7 @@ repository = "https://github.com/lightningdevkit/rust-lightning" description = """ Utilities to fetch the chain data from a block source and feed them into Rust Lightning. """ -edition = "2018" +edition = "2021" [package.metadata.docs.rs] all-features = true @@ -21,7 +21,7 @@ rpc-client = [ "serde_json", "chunked_transfer" ] bitcoin = "0.30.2" hex = { package = "hex-conservative", version = "0.1.1", default-features = false } lightning = { version = "0.0.118", path = "../lightning" } -tokio = { version = "1.0", features = [ "io-util", "net", "time" ], optional = true } +tokio = { version = "1.0", features = [ "io-util", "net", "time", "rt" ], optional = true } serde_json = { version = "1.0", optional = true } chunked_transfer = { version = "1.4", optional = true } diff --git a/lightning-block-sync/src/lib.rs b/lightning-block-sync/src/lib.rs index 77ff3f081..4a01d4673 100644 --- a/lightning-block-sync/src/lib.rs +++ b/lightning-block-sync/src/lib.rs @@ -13,9 +13,8 @@ //! Both features support either blocking I/O using `std::net::TcpStream` or, with feature `tokio`, //! non-blocking I/O using `tokio::net::TcpStream` from inside a Tokio runtime. -// Prefix these with `rustdoc::` when we update our MSRV to be >= 1.52 to remove warnings. -#![deny(broken_intra_doc_links)] -#![deny(private_intra_doc_links)] +#![deny(rustdoc::broken_intra_doc_links)] +#![deny(rustdoc::private_intra_doc_links)] #![deny(missing_docs)] #![deny(unsafe_code)] diff --git a/lightning-invoice/Cargo.toml b/lightning-invoice/Cargo.toml index 0b45fa41e..5377b7ef3 100644 --- a/lightning-invoice/Cargo.toml +++ b/lightning-invoice/Cargo.toml @@ -8,7 +8,7 @@ license = "MIT OR Apache-2.0" keywords = [ "lightning", "bitcoin", "invoice", "BOLT11" ] readme = "README.md" repository = "https://github.com/lightningdevkit/rust-lightning/" -edition = "2018" +edition = "2021" [package.metadata.docs.rs] all-features = true diff --git a/lightning-invoice/fuzz/Cargo.toml b/lightning-invoice/fuzz/Cargo.toml index 0d5fbb365..746fe63ba 100644 --- a/lightning-invoice/fuzz/Cargo.toml +++ b/lightning-invoice/fuzz/Cargo.toml @@ -3,7 +3,7 @@ name = "lightning-invoice-fuzz" version = "0.0.1" authors = ["Automatically generated"] publish = false -edition = "2018" +edition = "2021" [package.metadata] cargo-fuzz = true diff --git a/lightning-invoice/fuzz/fuzz_targets/serde_data_part.rs b/lightning-invoice/fuzz/fuzz_targets/serde_data_part.rs index 406f96764..871c6c7d7 100644 --- a/lightning-invoice/fuzz/fuzz_targets/serde_data_part.rs +++ b/lightning-invoice/fuzz/fuzz_targets/serde_data_part.rs @@ -48,9 +48,9 @@ mod tests { for (idx, c) in hex.as_bytes().iter().filter(|&&c| c != b'\n').enumerate() { b <<= 4; match *c { - b'A'...b'F' => b |= c - b'A' + 10, - b'a'...b'f' => b |= c - b'a' + 10, - b'0'...b'9' => b |= c - b'0', + b'A'..=b'F' => b |= c - b'A' + 10, + b'a'..=b'f' => b |= c - b'a' + 10, + b'0'..=b'9' => b |= c - b'0', _ => panic!("Bad hex"), } if (idx & 1) == 1 { diff --git a/lightning-invoice/src/lib.rs b/lightning-invoice/src/lib.rs index d87c6c893..89763aa75 100644 --- a/lightning-invoice/src/lib.rs +++ b/lightning-invoice/src/lib.rs @@ -1,6 +1,5 @@ -// Prefix these with `rustdoc::` when we update our MSRV to be >= 1.52 to remove warnings. -#![deny(broken_intra_doc_links)] -#![deny(private_intra_doc_links)] +#![deny(rustdoc::broken_intra_doc_links)] +#![deny(rustdoc::private_intra_doc_links)] #![deny(missing_docs)] #![deny(non_upper_case_globals)] diff --git a/lightning-net-tokio/Cargo.toml b/lightning-net-tokio/Cargo.toml index 247481fcf..e491dec5d 100644 --- a/lightning-net-tokio/Cargo.toml +++ b/lightning-net-tokio/Cargo.toml @@ -8,7 +8,7 @@ description = """ Implementation of the rust-lightning network stack using Tokio. For Rust-Lightning clients which wish to make direct connections to Lightning P2P nodes, this is a simple alternative to implementing the required network stack, especially for those already using Tokio. """ -edition = "2018" +edition = "2021" [package.metadata.docs.rs] all-features = true diff --git a/lightning-net-tokio/src/lib.rs b/lightning-net-tokio/src/lib.rs index d02f23fdd..1aa2cc25a 100644 --- a/lightning-net-tokio/src/lib.rs +++ b/lightning-net-tokio/src/lib.rs @@ -22,9 +22,8 @@ //! //! [`PeerManager`]: lightning::ln::peer_handler::PeerManager -// Prefix these with `rustdoc::` when we update our MSRV to be >= 1.52 to remove warnings. -#![deny(broken_intra_doc_links)] -#![deny(private_intra_doc_links)] +#![deny(rustdoc::broken_intra_doc_links)] +#![deny(rustdoc::private_intra_doc_links)] #![deny(missing_docs)] #![cfg_attr(docsrs, feature(doc_auto_cfg))] diff --git a/lightning-persister/Cargo.toml b/lightning-persister/Cargo.toml index 387366bff..4206b5f22 100644 --- a/lightning-persister/Cargo.toml +++ b/lightning-persister/Cargo.toml @@ -7,7 +7,7 @@ repository = "https://github.com/lightningdevkit/rust-lightning" description = """ Utilities for LDK data persistence and retrieval. """ -edition = "2018" +edition = "2021" [package.metadata.docs.rs] all-features = true diff --git a/lightning-persister/src/lib.rs b/lightning-persister/src/lib.rs index ae258e137..8e7d9055a 100644 --- a/lightning-persister/src/lib.rs +++ b/lightning-persister/src/lib.rs @@ -1,8 +1,7 @@ //! Provides utilities for LDK data persistence and retrieval. -// -// TODO: Prefix these with `rustdoc::` when we update our MSRV to be >= 1.52 to remove warnings. -#![deny(broken_intra_doc_links)] -#![deny(private_intra_doc_links)] + +#![deny(rustdoc::broken_intra_doc_links)] +#![deny(rustdoc::private_intra_doc_links)] #![deny(missing_docs)] diff --git a/lightning-rapid-gossip-sync/Cargo.toml b/lightning-rapid-gossip-sync/Cargo.toml index 2018e3b24..006725b19 100644 --- a/lightning-rapid-gossip-sync/Cargo.toml +++ b/lightning-rapid-gossip-sync/Cargo.toml @@ -4,7 +4,7 @@ version = "0.0.118" authors = ["Arik Sosman "] license = "MIT OR Apache-2.0" repository = "https://github.com/lightningdevkit/rust-lightning" -edition = "2018" +edition = "2021" description = """ Utility to process gossip routing data from Rapid Gossip Sync Server. """ diff --git a/lightning-rapid-gossip-sync/src/lib.rs b/lightning-rapid-gossip-sync/src/lib.rs index c15eedabb..0561975f8 100644 --- a/lightning-rapid-gossip-sync/src/lib.rs +++ b/lightning-rapid-gossip-sync/src/lib.rs @@ -1,6 +1,5 @@ -// Prefix these with `rustdoc::` when we update our MSRV to be >= 1.52 to remove warnings. -#![deny(broken_intra_doc_links)] -#![deny(private_intra_doc_links)] +#![deny(rustdoc::broken_intra_doc_links)] +#![deny(rustdoc::private_intra_doc_links)] #![deny(missing_docs)] #![deny(unsafe_code)] diff --git a/lightning-transaction-sync/Cargo.toml b/lightning-transaction-sync/Cargo.toml index 20e03ce6c..ca46953a2 100644 --- a/lightning-transaction-sync/Cargo.toml +++ b/lightning-transaction-sync/Cargo.toml @@ -7,7 +7,7 @@ repository = "https://github.com/lightningdevkit/rust-lightning" description = """ Utilities for syncing LDK via the transaction-based `Confirm` interface. """ -edition = "2018" +edition = "2021" [package.metadata.docs.rs] all-features = true @@ -22,7 +22,7 @@ electrum = ["electrum-client"] async-interface = [] [dependencies] -lightning = { version = "0.0.118", path = "../lightning", default-features = false } +lightning = { version = "0.0.118", path = "../lightning", default-features = false, features = ["std"] } bitcoin = { version = "0.30.2", default-features = false } bdk-macros = "0.6" futures = { version = "0.3", optional = true } @@ -30,6 +30,6 @@ esplora-client = { version = "0.6", default-features = false, optional = true } electrum-client = { version = "0.18.0", optional = true } [dev-dependencies] -lightning = { version = "0.0.118", path = "../lightning", features = ["std", "_test_utils"] } +lightning = { version = "0.0.118", path = "../lightning", default-features = false, features = ["std", "_test_utils"] } electrsd = { version = "0.26.0", features = ["legacy", "esplora_a33e97e1", "bitcoind_25_0"] } tokio = { version = "1.14.0", features = ["full"] } diff --git a/lightning-transaction-sync/src/lib.rs b/lightning-transaction-sync/src/lib.rs index 21b6a4e97..7bd4b4aee 100644 --- a/lightning-transaction-sync/src/lib.rs +++ b/lightning-transaction-sync/src/lib.rs @@ -58,9 +58,8 @@ //! [`ChainMonitor`]: lightning::chain::chainmonitor::ChainMonitor //! [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager -// Prefix these with `rustdoc::` when we update our MSRV to be >= 1.52 to remove warnings. -#![deny(broken_intra_doc_links)] -#![deny(private_intra_doc_links)] +#![deny(rustdoc::broken_intra_doc_links)] +#![deny(rustdoc::private_intra_doc_links)] #![deny(missing_docs)] #![deny(unsafe_code)] diff --git a/lightning/Cargo.toml b/lightning/Cargo.toml index 76d751af3..3c3912e2b 100644 --- a/lightning/Cargo.toml +++ b/lightning/Cargo.toml @@ -9,7 +9,7 @@ A Bitcoin Lightning library in Rust. Does most of the hard work, without implying a specific runtime, requiring clients implement basic network logic, chain interactions and disk storage. Still missing tons of error-handling. See GitHub issues for suggested projects if you want to contribute. Don't have to bother telling you not to use this for anything serious, because you'd have to build a client around it to even try. """ -edition = "2018" +edition = "2021" [package.metadata.docs.rs] features = ["std"] diff --git a/lightning/src/chain/channelmonitor.rs b/lightning/src/chain/channelmonitor.rs index ce1ef9128..ce0ec7f20 100644 --- a/lightning/src/chain/channelmonitor.rs +++ b/lightning/src/chain/channelmonitor.rs @@ -2284,7 +2284,7 @@ macro_rules! fail_unbroadcast_htlcs { // broadcastable commitment transaction has the HTLC in it, but it // cannot currently change after channel initialization, so we don't // need to here. - let confirmed_htlcs_iter: &mut Iterator)> = &mut $confirmed_htlcs_list; + let confirmed_htlcs_iter: &mut dyn Iterator)> = &mut $confirmed_htlcs_list; let mut matched_htlc = false; for (ref broadcast_htlc, ref broadcast_source) in confirmed_htlcs_iter { diff --git a/lightning/src/chain/mod.rs b/lightning/src/chain/mod.rs index 2a9583f2e..dafce03dd 100644 --- a/lightning/src/chain/mod.rs +++ b/lightning/src/chain/mod.rs @@ -357,7 +357,7 @@ pub struct WatchedOutput { pub script_pubkey: ScriptBuf, } -impl Listen for core::ops::Deref { +impl Listen for dyn core::ops::Deref { fn filtered_block_connected(&self, header: &Header, txdata: &TransactionData, height: u32) { (**self).filtered_block_connected(header, txdata, height); } diff --git a/lightning/src/ln/channel.rs b/lightning/src/ln/channel.rs index 8d6144fc2..ffde167ca 100644 --- a/lightning/src/ln/channel.rs +++ b/lightning/src/ln/channel.rs @@ -5514,7 +5514,7 @@ impl Channel where // larger. If we don't know that time has moved forward, we can just set it to the last // time we saw and it will be ignored. let best_time = self.context.update_time_counter; - match self.do_best_block_updated(reorg_height, best_time, None::<(ChainHash, &&NodeSigner, &UserConfig)>, logger) { + match self.do_best_block_updated(reorg_height, best_time, None::<(ChainHash, &&dyn NodeSigner, &UserConfig)>, logger) { Ok((channel_ready, timed_out_htlcs, announcement_sigs)) => { assert!(channel_ready.is_none(), "We can't generate a funding with 0 confirmations?"); assert!(timed_out_htlcs.is_empty(), "We can't have accepted HTLCs with a timeout before our funding confirmation?"); @@ -8815,7 +8815,7 @@ mod tests { assert_eq!(decoded_chan.context.holding_cell_htlc_updates, holding_cell_htlc_updates); } - #[cfg(feature = "_test_vectors")] + #[cfg(all(feature = "_test_vectors", not(feature = "grind_signatures")))] #[test] fn outbound_commitment_test() { use bitcoin::sighash; @@ -8836,7 +8836,7 @@ mod tests { // Test vectors from BOLT 3 Appendices C and F (anchors): let feeest = TestFeeEstimator{fee_est: 15000}; - let logger : Arc = Arc::new(test_utils::TestLogger::new()); + let logger : Arc = Arc::new(test_utils::TestLogger::new()); let secp_ctx = Secp256k1::new(); let mut signer = InMemorySigner::new( diff --git a/lightning/src/ln/channelmanager.rs b/lightning/src/ln/channelmanager.rs index ff1bd164a..9a1a9df2e 100644 --- a/lightning/src/ln/channelmanager.rs +++ b/lightning/src/ln/channelmanager.rs @@ -1521,13 +1521,11 @@ pub const MIN_FINAL_CLTV_EXPIRY_DELTA: u16 = HTLC_FAIL_BACK_BUFFER as u16 + 3; // then waiting ANTI_REORG_DELAY to be reorg-safe on the outbound HLTC and // failing the corresponding htlc backward, and us now seeing the last block of ANTI_REORG_DELAY before // LATENCY_GRACE_PERIOD_BLOCKS. -#[deny(const_err)] #[allow(dead_code)] const CHECK_CLTV_EXPIRY_SANITY: u32 = MIN_CLTV_EXPIRY_DELTA as u32 - LATENCY_GRACE_PERIOD_BLOCKS - CLTV_CLAIM_BUFFER - ANTI_REORG_DELAY - LATENCY_GRACE_PERIOD_BLOCKS; // Check for ability of an attacker to make us fail on-chain by delaying an HTLC claim. See // ChannelMonitor::should_broadcast_holder_commitment_txn for a description of why this is needed. -#[deny(const_err)] #[allow(dead_code)] const CHECK_CLTV_EXPIRY_SANITY_2: u32 = MIN_CLTV_EXPIRY_DELTA as u32 - LATENCY_GRACE_PERIOD_BLOCKS - 2*CLTV_CLAIM_BUFFER; diff --git a/lightning/src/ln/payment_tests.rs b/lightning/src/ln/payment_tests.rs index a5654b30f..b3805a760 100644 --- a/lightning/src/ln/payment_tests.rs +++ b/lightning/src/ln/payment_tests.rs @@ -3334,6 +3334,7 @@ fn test_threaded_payment_retries() { // We really want std::thread::scope, but its not stable until 1.63. Until then, we get unsafe. let node_ref = NodePtr::from_node(&nodes[0]); move || { + let _ = &node_ref; let node_a = unsafe { &*node_ref.0 }; while Instant::now() < end_time { node_a.node.get_and_clear_pending_events(); // wipe the PendingHTLCsForwardable diff --git a/lightning/src/ln/peer_handler.rs b/lightning/src/ln/peer_handler.rs index 6a935acf0..a4e004241 100644 --- a/lightning/src/ln/peer_handler.rs +++ b/lightning/src/ln/peer_handler.rs @@ -2488,7 +2488,6 @@ impl + logger: Arc } impl WrapperLog { - fn new(logger: Arc) -> WrapperLog { + fn new(logger: Arc) -> WrapperLog { WrapperLog { logger, } @@ -278,7 +278,7 @@ mod tests { fn test_logging_macros() { let mut logger = TestLogger::new(); logger.enable(Level::Gossip); - let logger : Arc = Arc::new(logger); + let logger : Arc = Arc::new(logger); let wrapper = WrapperLog::new(Arc::clone(&logger)); wrapper.call_macros(); } diff --git a/lightning/src/util/ser.rs b/lightning/src/util/ser.rs index 0d5cfc819..484d60340 100644 --- a/lightning/src/util/ser.rs +++ b/lightning/src/util/ser.rs @@ -371,14 +371,14 @@ impl Writeable for BigSize { #[inline] fn write(&self, writer: &mut W) -> Result<(), io::Error> { match self.0 { - 0...0xFC => { + 0..=0xFC => { (self.0 as u8).write(writer) }, - 0xFD...0xFFFF => { + 0xFD..=0xFFFF => { 0xFDu8.write(writer)?; (self.0 as u16).write(writer) }, - 0x10000...0xFFFFFFFF => { + 0x10000..=0xFFFFFFFF => { 0xFEu8.write(writer)?; (self.0 as u32).write(writer) }, diff --git a/lightning/src/util/test_utils.rs b/lightning/src/util/test_utils.rs index 9bbbec0d7..e23cce95f 100644 --- a/lightning/src/util/test_utils.rs +++ b/lightning/src/util/test_utils.rs @@ -227,7 +227,7 @@ pub struct TestChainMonitor<'a> { pub added_monitors: Mutex)>>, pub monitor_updates: Mutex>>, pub latest_monitor_update_id: Mutex>, - pub chain_monitor: chainmonitor::ChainMonitor>, + pub chain_monitor: chainmonitor::ChainMonitor>, pub keys_manager: &'a TestKeysInterface, /// If this is set to Some(), the next update_channel call (not watch_channel) must be a /// ChannelForceClosed event for the given channel_id with should_broadcast set to the given @@ -238,7 +238,7 @@ pub struct TestChainMonitor<'a> { pub expect_monitor_round_trip_fail: Mutex>, } impl<'a> TestChainMonitor<'a> { - pub fn new(chain_source: Option<&'a TestChainSource>, broadcaster: &'a chaininterface::BroadcasterInterface, logger: &'a TestLogger, fee_estimator: &'a TestFeeEstimator, persister: &'a chainmonitor::Persist, keys_manager: &'a TestKeysInterface) -> Self { + pub fn new(chain_source: Option<&'a TestChainSource>, broadcaster: &'a dyn chaininterface::BroadcasterInterface, logger: &'a TestLogger, fee_estimator: &'a TestFeeEstimator, persister: &'a dyn chainmonitor::Persist, keys_manager: &'a TestKeysInterface) -> Self { Self { added_monitors: Mutex::new(Vec::new()), monitor_updates: Mutex::new(HashMap::new()), diff --git a/msrv-no-dev-deps-check/Cargo.toml b/msrv-no-dev-deps-check/Cargo.toml index d73360749..0f391b198 100644 --- a/msrv-no-dev-deps-check/Cargo.toml +++ b/msrv-no-dev-deps-check/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "msrv-check" version = "0.1.0" -edition = "2018" +edition = "2021" [dependencies] lightning = { path = "../lightning" } diff --git a/no-std-check/Cargo.toml b/no-std-check/Cargo.toml index 16d2fc110..c9d404c92 100644 --- a/no-std-check/Cargo.toml +++ b/no-std-check/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "no-std-check" version = "0.1.0" -edition = "2018" +edition = "2021" [features] default = ["lightning/no-std", "lightning-invoice/no-std", "lightning-rapid-gossip-sync/no-std"]