Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down
13 changes: 10 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,30 @@ 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 }

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"
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)",
]
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
The Minimum Supported Rust Version (MSRV) is currently 1.75.0.
15 changes: 13 additions & 2 deletions src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -31,7 +32,12 @@ where
impl<R: RetryPolicy<E = VssError>> VssClient<R> {
/// 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)
Comment on lines +36 to +38
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you seems like we could just do with the single global timeout here, no need for connect and read ?

But we can leave it as is and potentially tweak the inner timeouts later.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, no strong opinion here.

.build()
.unwrap();
Self::from_client(base_url, client, retry_policy)
}

Expand All @@ -51,7 +57,12 @@ impl<R: RetryPolicy<E = VssError>> VssClient<R> {
pub fn new_with_headers(
base_url: String, retry_policy: R, header_provider: Arc<dyn VssHeaderProvider>,
) -> 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 }
}

Expand Down