From ffa9ff83d2f46915175ffe10be4102f9903d3f18 Mon Sep 17 00:00:00 2001 From: Elias Rohrer Date: Tue, 24 Oct 2023 15:16:38 +0200 Subject: [PATCH] Bump MSRV to rustc 1.63.0 .. which is a reasonable common ground, also supported by Debian stable. --- .github/workflows/build.yml | 14 +--- CONTRIBUTING.md | 2 +- ci/ci-tests.sh | 99 ++++++++--------------- lightning-background-processor/src/lib.rs | 5 +- lightning-block-sync/src/lib.rs | 5 +- lightning-invoice/src/lib.rs | 5 +- lightning-net-tokio/src/lib.rs | 5 +- lightning-persister/src/lib.rs | 7 +- lightning-rapid-gossip-sync/src/lib.rs | 5 +- lightning-transaction-sync/src/lib.rs | 7 +- no-std-check/Cargo.toml | 4 +- 11 files changed, 56 insertions(+), 102 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 00ef76f787e..0b76a0015b0 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 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e795ecb9fba..0204fe7f2a8 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.41.1 (enforced by +The Minimum Supported Rust Version (MSRV) currently is 1.63.0 (enforced by our GitHub Actions). Also, the compatibility for LDK object serialization is currently ensured back to and including crate version 0.0.99 (see the [changelog](CHANGELOG.md)). diff --git a/ci/ci-tests.sh b/ci/ci-tests.sh index 00fc54774d3..c1fa3165057 100755 --- a/ci/ci-tests.sh +++ b/ci/ci-tests.sh @@ -2,45 +2,22 @@ set -eox pipefail RUSTC_MINOR_VERSION=$(rustc --version | awk '{ split($2,a,"."); print a[2] }') -HOST_PLATFORM="$(rustc --version --verbose | grep "host:" | awk '{ print $2 }')" # Some crates require pinning to meet our MSRV even for our downstream users, # 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 + # 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 - # 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 + # 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 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 - -# 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 - export RUST_BACKTRACE=1 echo -e "\n\nBuilding and testing all workspace crates..." @@ -59,37 +36,39 @@ 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 - echo -e "\n\nBuilding and testing Transaction Sync Clients with features" - pushd lightning-transaction-sync - cargo test --verbose --color always --features esplora-blocking - cargo check --verbose --color always --features esplora-blocking - cargo test --verbose --color always --features esplora-async - cargo check --verbose --color always --features esplora-async - cargo test --verbose --color always --features esplora-async-https - cargo check --verbose --color always --features esplora-async-https - popd -fi +echo -e "\n\nBuilding and testing Transaction Sync Clients with features" +pushd lightning-transaction-sync + +# jobserver 0.1.27 requires rustc 1.66.0 +[ "$RUSTC_MINOR_VERSION" -lt 66 ] && cargo update -p jobserver --precise "0.1.26" --verbose +# 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 + +cargo test --verbose --color always --features esplora-blocking +cargo check --verbose --color always --features esplora-blocking +cargo test --verbose --color always --features esplora-async +cargo check --verbose --color always --features esplora-async +cargo test --verbose --color always --features esplora-async-https +cargo check --verbose --color always --features esplora-async-https +popd echo -e "\n\nTest futures builds" 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 @@ -100,13 +79,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 @@ -123,16 +103,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 [ "$CI_MINIMIZE_DISK_USAGE" != "" ] && cargo clean popd diff --git a/lightning-background-processor/src/lib.rs b/lightning-background-processor/src/lib.rs index aa6d0b0615e..4c9bef7c73f 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/src/lib.rs b/lightning-block-sync/src/lib.rs index 3561a1b5d76..08acf970ab8 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/src/lib.rs b/lightning-invoice/src/lib.rs index d953795cf8e..b88f65c83b8 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/src/lib.rs b/lightning-net-tokio/src/lib.rs index bac18b2b398..3b7456f918b 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/src/lib.rs b/lightning-persister/src/lib.rs index ae258e137d7..8e7d9055a6a 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/src/lib.rs b/lightning-rapid-gossip-sync/src/lib.rs index 5a61be7990e..d27d06d242c 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/src/lib.rs b/lightning-transaction-sync/src/lib.rs index ca3ce3f8ad6..89c0124de46 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)] @@ -77,7 +76,9 @@ mod esplora; #[cfg(any(feature = "esplora-blocking", feature = "esplora-async"))] mod common; +#[cfg(any(feature = "esplora-blocking", feature = "esplora-async"))] mod error; +#[cfg(any(feature = "esplora-blocking", feature = "esplora-async"))] pub use error::TxSyncError; #[cfg(any(feature = "esplora-blocking", feature = "esplora-async"))] diff --git a/no-std-check/Cargo.toml b/no-std-check/Cargo.toml index 16d2fc110e2..94ff1ba36b9 100644 --- a/no-std-check/Cargo.toml +++ b/no-std-check/Cargo.toml @@ -4,7 +4,7 @@ version = "0.1.0" edition = "2018" [features] -default = ["lightning/no-std", "lightning-invoice/no-std", "lightning-rapid-gossip-sync/no-std"] +default = ["lightning/no-std", "lightning-invoice/no-std", "lightning-rapid-gossip-sync/no-std", "lightning-transaction-sync"] [dependencies] lightning = { path = "../lightning", default-features = false } @@ -14,4 +14,4 @@ lightning-background-processor = { path = "../lightning-background-processor", f # Obviously lightning-transaction-sync doesn't support no-std, but it should build # even if lightning is built with no-std. -lightning-transaction-sync = { path = "../lightning-transaction-sync", optional = true } +lightning-transaction-sync = { path = "../lightning-transaction-sync", default-features = false, optional = true }