From 8e6373bbb6cd74a527d1c70b5bb4664bece17685 Mon Sep 17 00:00:00 2001 From: Elias Rohrer Date: Tue, 19 Aug 2025 11:33:11 +0200 Subject: [PATCH 1/4] Bump MSRV to 1.75.0 --- .github/workflows/build.yml | 9 +++------ README.md | 2 +- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d3e9745..9a441bf 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -6,11 +6,11 @@ jobs: build: strategy: matrix: - toolchain: [ stable, beta, 1.63.0 ] # 1.63.0 is current MSRV for vss-client + toolchain: [ stable, beta, 1.75.0 ] # 1.75.0 is current MSRV for vss-client include: - toolchain: stable check-fmt: true - - toolchain: 1.63.0 + - toolchain: 1.75.0 msrv: true runs-on: ubuntu-latest steps: @@ -25,10 +25,7 @@ jobs: - name: Pin packages to allow for MSRV if: matrix.msrv run: | - cargo update -p proptest --precise "1.2.0" --verbose # proptest 1.3.0 requires rustc 1.64.0 - cargo update -p regex --precise "1.9.6" --verbose # regex 1.10.0 requires rustc 1.65.0 - cargo update -p tokio --precise "1.38.1" --verbose # tokio v1.39.0 requires rustc 1.70 or newer - cargo update -p tokio-util --precise "0.7.11" --verbose # tokio-util v0.7.12 requires rustc 1.70 or newer + cargo update -p idna_adapter --precise 1.1.0 # This has us use `unicode-normalization` which has a more conservative MSRV - name: Build on Rust ${{ matrix.toolchain }} run: cargo build --verbose --color always - name: Check formatting diff --git a/README.md b/README.md index 89efac0..42c5b79 100644 --- a/README.md +++ b/README.md @@ -9,4 +9,4 @@ and manage the essential state required for Lightning Network (LN) operations. Learn more [here](https://github.com/lightningdevkit/vss-server/blob/main/README.md). ## MSRV -The Minimum Supported Rust Version (MSRV) is currently 1.63.0. \ No newline at end of file +The Minimum Supported Rust Version (MSRV) is currently 1.75.0. From fc51f4756afcc0754444449a9d7b8e41d4791026 Mon Sep 17 00:00:00 2001 From: Elias Rohrer Date: Tue, 27 May 2025 10:59:34 +0200 Subject: [PATCH 2/4] Add `genproto` to list of allowed `cfg`s .. to avoid the warning --- Cargo.toml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index 6ec2cb0..fa26cb9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -38,3 +38,10 @@ reqwest = { version = "0.11.13", default-features = false, features = ["rustls- mockito = "0.28.0" proptest = "1.1.0" tokio = { version = "1.22.0", features = ["macros"]} + +[lints.rust.unexpected_cfgs] +level = "forbid" +# When adding a new cfg attribute, ensure that it is added to this list. +check-cfg = [ + "cfg(genproto)", +] From c5599bcf2b9cc27b4bd25d1569a2e810cf901f03 Mon Sep 17 00:00:00 2001 From: Elias Rohrer Date: Tue, 27 May 2025 10:58:23 +0200 Subject: [PATCH 3/4] Bump `reqwest` dep to v0.12 and `base64` to v0.22 --- Cargo.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index fa26cb9..f3477fb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -18,13 +18,13 @@ lnurl-auth = ["dep:bitcoin", "dep:url", "dep:serde", "dep:serde_json", "reqwest/ [dependencies] prost = "0.11.6" -reqwest = { version = "0.11.13", default-features = false, features = ["rustls-tls"] } +reqwest = { version = "0.12", default-features = false, features = ["rustls-tls"] } tokio = { version = "1", default-features = false, features = ["time"] } rand = "0.8.5" async-trait = "0.1.77" bitcoin = { version = "0.32.2", default-features = false, features = ["std", "rand-std"], optional = true } url = { version = "2.5.0", default-features = false, optional = true } -base64 = { version = "0.21.7", default-features = false} +base64 = { version = "0.22", default-features = false} serde = { version = "1.0.196", default-features = false, features = ["serde_derive"], optional = true } serde_json = { version = "1.0.113", default-features = false, optional = true } @@ -32,7 +32,7 @@ bitcoin_hashes = "0.14.0" [target.'cfg(genproto)'.build-dependencies] prost-build = { version = "0.11.3" } -reqwest = { version = "0.11.13", default-features = false, features = ["rustls-tls", "blocking"] } +reqwest = { version = "0.12", default-features = false, features = ["rustls-tls", "blocking"] } [dev-dependencies] mockito = "0.28.0" From 5e83c2b57a6c5370dc43956636e1d8172c725338 Mon Sep 17 00:00:00 2001 From: Elias Rohrer Date: Tue, 19 Aug 2025 11:14:09 +0200 Subject: [PATCH 4/4] Enable `reqwest` client-level timeouts While the `RetryPolicy` has a `MaxTotalDelayRetryPolicy`, the retry `loop` would only check this configured delay once the operation future actually returns a value. However, without client-side timeouts, we're not super sure the operation is actually guaranteed to return anything (even an error, IIUC). So here, we enable some coarse client-side default timeouts to ensure the polled futures eventualy return either the response *or* an error we can handle via our retry logic. --- src/client.rs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/client.rs b/src/client.rs index c6bf32e..5cf5388 100644 --- a/src/client.rs +++ b/src/client.rs @@ -14,6 +14,7 @@ use crate::types::{ use crate::util::retry::{retry, RetryPolicy}; const APPLICATION_OCTET_STREAM: &str = "application/octet-stream"; +const DEFAULT_TIMEOUT: std::time::Duration = std::time::Duration::from_secs(10); /// Thin-client to access a hosted instance of Versioned Storage Service (VSS). /// The provided [`VssClient`] API is minimalistic and is congruent to the VSS server-side API. @@ -31,7 +32,12 @@ where impl> VssClient { /// Constructs a [`VssClient`] using `base_url` as the VSS server endpoint. pub fn new(base_url: String, retry_policy: R) -> Self { - let client = Client::new(); + let client = Client::builder() + .timeout(DEFAULT_TIMEOUT) + .connect_timeout(DEFAULT_TIMEOUT) + .read_timeout(DEFAULT_TIMEOUT) + .build() + .unwrap(); Self::from_client(base_url, client, retry_policy) } @@ -51,7 +57,12 @@ impl> VssClient { pub fn new_with_headers( base_url: String, retry_policy: R, header_provider: Arc, ) -> Self { - let client = Client::new(); + let client = Client::builder() + .timeout(DEFAULT_TIMEOUT) + .connect_timeout(DEFAULT_TIMEOUT) + .read_timeout(DEFAULT_TIMEOUT) + .build() + .unwrap(); Self { base_url, client, retry_policy, header_provider } }