Skip to content

Commit

Permalink
Bump MSRV to rustc 1.63.0
Browse files Browse the repository at this point in the history
.. which is a reasonable common ground, also supported by Debian stable.
  • Loading branch information
tnull committed Oct 25, 2023
1 parent d2242f6 commit ffa9ff8
Show file tree
Hide file tree
Showing 11 changed files with 56 additions and 102 deletions.
14 changes: 1 addition & 13 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)).
Expand Down
99 changes: 35 additions & 64 deletions ci/ci-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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..."
Expand All @@ -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
Expand All @@ -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

Expand All @@ -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

Expand Down
5 changes: 2 additions & 3 deletions lightning-background-processor/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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))]
Expand Down
5 changes: 2 additions & 3 deletions lightning-block-sync/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
5 changes: 2 additions & 3 deletions lightning-invoice/src/lib.rs
Original file line number Diff line number Diff line change
@@ -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)]
Expand Down
5 changes: 2 additions & 3 deletions lightning-net-tokio/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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))]
Expand Down
7 changes: 3 additions & 4 deletions lightning-persister/src/lib.rs
Original file line number Diff line number Diff line change
@@ -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)]

Expand Down
5 changes: 2 additions & 3 deletions lightning-rapid-gossip-sync/src/lib.rs
Original file line number Diff line number Diff line change
@@ -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)]
Expand Down
7 changes: 4 additions & 3 deletions lightning-transaction-sync/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand All @@ -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"))]
Expand Down
4 changes: 2 additions & 2 deletions no-std-check/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand All @@ -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 }

0 comments on commit ffa9ff8

Please sign in to comment.