From c9feab0c1e29bb20769d89d1d02005175820ace2 Mon Sep 17 00:00:00 2001 From: Philip Kannegaard Hayes Date: Tue, 22 Sep 2026 22:43:23 +0000 Subject: [PATCH 1/2] rust: use MSRV-aware resolver Help make MSRV CI more reliable. - Migrate edition 2021 -> 2024 - Change resolver v2 -> v3 These two changes together enable the MSRV-aware resolver by default: --- Cargo.toml | 4 ++-- api/src/auth.rs | 2 +- api/src/kv_store_tests.rs | 12 ++++++------ auth-impls/src/jwt.rs | 8 ++++---- auth-impls/src/signature.rs | 2 +- impls/src/postgres_store.rs | 8 ++++---- server/src/vss_service.rs | 5 +---- 7 files changed, 19 insertions(+), 22 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 10c11898..92dd52ae 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,12 +1,12 @@ [workspace] -resolver = "2" +resolver = "3" members = ["server", "api", "impls", "auth-impls"] default-members = ["server"] [workspace.package] version = "0.1.0-alpha.0" rust-version = "1.85.0" -edition = "2021" +edition = "2024" authors = ["Leo Nash ", "Elias Rohrer "] license = "MIT OR Apache-2.0" homepage = "https://lightningdevkit.org/" diff --git a/api/src/auth.rs b/api/src/auth.rs index a8290ee9..2d2a2e68 100644 --- a/api/src/auth.rs +++ b/api/src/auth.rs @@ -16,7 +16,7 @@ pub trait Authorizer: Send + Sync { /// Returns [`AuthResponse`] for an authenticated and authorized user or [`VssError::AuthError`] /// for an unauthorized request. async fn verify(&self, headers_map: &HashMap) - -> Result; + -> Result; } /// A no-operation authorizer, which lets any user-request go through. diff --git a/api/src/kv_store_tests.rs b/api/src/kv_store_tests.rs index 0a829f03..6d3792b9 100644 --- a/api/src/kv_store_tests.rs +++ b/api/src/kv_store_tests.rs @@ -1,5 +1,5 @@ use crate::error::VssError; -use crate::kv_store::{KvStore, GLOBAL_VERSION_KEY}; +use crate::kv_store::{GLOBAL_VERSION_KEY, KvStore}; use crate::types::{ DeleteObjectRequest, GetObjectRequest, KeyValue, ListKeyVersionsRequest, ListKeyVersionsResponse, PutObjectRequest, @@ -7,7 +7,7 @@ use crate::types::{ use async_trait::async_trait; use bytes::Bytes; use rand::distributions::Alphanumeric; -use rand::{thread_rng, Rng}; +use rand::{Rng, thread_rng}; /// Defines KvStoreTestSuite which is required for an implementation to be VSS protocol compliant. #[macro_export] @@ -150,8 +150,8 @@ pub trait KvStoreTestSuite { Ok(()) } - async fn put_multi_object_should_fail_when_single_key_version_mismatched( - ) -> Result<(), VssError> { + async fn put_multi_object_should_fail_when_single_key_version_mismatched() + -> Result<(), VssError> { let kv_store = Self::create_store().await; let ctx = TestContext::new(&kv_store); @@ -467,8 +467,8 @@ pub trait KvStoreTestSuite { Ok(()) } - async fn list_should_return_zero_global_version_when_global_versioning_not_enabled( - ) -> Result<(), VssError> { + async fn list_should_return_zero_global_version_when_global_versioning_not_enabled() + -> Result<(), VssError> { let kv_store = Self::create_store().await; let ctx = TestContext::new(&kv_store); diff --git a/auth-impls/src/jwt.rs b/auth-impls/src/jwt.rs index ecae8b6f..1480974e 100644 --- a/auth-impls/src/jwt.rs +++ b/auth-impls/src/jwt.rs @@ -5,8 +5,8 @@ use api::auth::{AuthResponse, Authorizer}; use api::error::VssError; use async_trait::async_trait; -use base64::engine::general_purpose::{STANDARD, URL_SAFE_NO_PAD}; use base64::Engine; +use base64::engine::general_purpose::{STANDARD, URL_SAFE_NO_PAD}; use openssl::hash::MessageDigest; use openssl::pkey::Public; use openssl::pkey::{Id, PKey}; @@ -87,7 +87,7 @@ impl JWTAuthorizer { _ => { return Err(VssError::AuthError(String::from( "Token does not have three parts", - ))) + ))); }, }; @@ -241,7 +241,7 @@ mod tests { -----END PRIVATE KEY-----"; fn create_token(encoding_key: &str, claims: T) -> String { - use jsonwebtoken::{encode, Algorithm, EncodingKey, Header}; + use jsonwebtoken::{Algorithm, EncodingKey, Header, encode}; let valid_encoding_key = EncodingKey::from_rsa_pem(encoding_key.as_bytes()) .expect("Failed to create Encoding Key."); encode(&Header::new(Algorithm::RS256), &claims, &valid_encoding_key).unwrap() @@ -280,7 +280,7 @@ mod tests { } fn jsonwebtoken_decode(token: &str, rsa_pem: &str) -> Result { - use jsonwebtoken::{decode, Algorithm, DecodingKey, Validation}; + use jsonwebtoken::{Algorithm, DecodingKey, Validation, decode}; let jwt_issuer_key = DecodingKey::from_rsa_pem(rsa_pem.as_bytes()).unwrap(); let claims = decode::(token, &jwt_issuer_key, &Validation::new(Algorithm::RS256)) .map_err(|e| VssError::AuthError(format!("Authentication failure. {}", e)))? diff --git a/auth-impls/src/signature.rs b/auth-impls/src/signature.rs index 0b62bb1a..3586d7e5 100644 --- a/auth-impls/src/signature.rs +++ b/auth-impls/src/signature.rs @@ -89,7 +89,7 @@ impl Authorizer for SignatureValidatingAuthorizer { #[cfg(test)] mod tests { - use crate::signature::{SignatureValidatingAuthorizer, SIGNING_CONSTANT}; + use crate::signature::{SIGNING_CONSTANT, SignatureValidatingAuthorizer}; use api::auth::Authorizer; use api::error::VssError; use secp256k1::{Message, PublicKey, SecretKey}; diff --git a/impls/src/postgres_store.rs b/impls/src/postgres_store.rs index 765099ea..41dd9210 100644 --- a/impls/src/postgres_store.rs +++ b/impls/src/postgres_store.rs @@ -1,7 +1,7 @@ use crate::migrations::*; use api::error::VssError; -use api::kv_store::{KvStore, GLOBAL_VERSION_KEY, INITIAL_RECORD_VERSION}; +use api::kv_store::{GLOBAL_VERSION_KEY, INITIAL_RECORD_VERSION, KvStore}; use api::types::{ DeleteObjectRequest, DeleteObjectResponse, GetObjectRequest, GetObjectResponse, KeyValue, ListKeyVersionsRequest, ListKeyVersionsResponse, PutObjectRequest, PutObjectResponse, @@ -15,7 +15,7 @@ use std::cmp::min; use std::io::{self, Error, ErrorKind}; use tokio::sync::Mutex; use tokio_postgres::tls::{MakeTlsConnect, TlsConnect}; -use tokio_postgres::{error, Client, NoTls, Socket, Transaction}; +use tokio_postgres::{Client, NoTls, Socket, Transaction, error}; use log::{debug, info, warn}; @@ -693,7 +693,7 @@ where let key_like = format!("{}%", key_prefix.as_deref().unwrap_or_default()); - let rows = if let Some(ref token) = page_token { + let rows = if let Some(token) = page_token { let page_sort_order = decode_page_token(token)?; let stmt = "SELECT key, version, sort_order FROM vss_db WHERE user_token = $1 AND store_id = $2 AND sort_order < $3 AND key LIKE $4 AND key != $5 ORDER BY sort_order DESC LIMIT $6"; let params: Vec<&(dyn tokio_postgres::types::ToSql + Sync)> = vec![ @@ -743,7 +743,7 @@ where #[cfg(test)] mod tests { - use super::{decode_page_token, drop_database, encode_page_token, DUMMY_MIGRATION, MIGRATIONS}; + use super::{DUMMY_MIGRATION, MIGRATIONS, decode_page_token, drop_database, encode_page_token}; use crate::postgres_store::PostgresPlaintextBackend; use api::define_kv_store_tests; use api::kv_store::KvStore; diff --git a/server/src/vss_service.rs b/server/src/vss_service.rs index 0af1904d..eca7d2c4 100644 --- a/server/src/vss_service.rs +++ b/server/src/vss_service.rs @@ -190,10 +190,7 @@ async fn handle_list_object_request( let request_id: u64 = rand::random(); trace!( "Handling ListKeyVersionsRequest {} for key_prefix {:?}, page_size {:?}, page_token {:?}", - request_id, - request.key_prefix, - request.page_size, - request.page_token + request_id, request.key_prefix, request.page_size, request.page_token ); let result = store.list_key_versions(user_token, request).await; if let Err(ref e) = result { From 1605213ff09d05e952778c39455c464467a49929 Mon Sep 17 00:00:00 2001 From: Philip Kannegaard Hayes Date: Tue, 22 Sep 2026 16:32:04 -0700 Subject: [PATCH 2/2] ci: use MSRV-aware resolver when building ldk-node Reduce the amount of dependency pinning we need to do when building `ldk-node` in the integration tests by using the MSRV-aware resolver. --- .github/workflows/ldk-node-integration-tests.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ldk-node-integration-tests.yml b/.github/workflows/ldk-node-integration-tests.yml index 0b0a0e7d..92601244 100644 --- a/.github/workflows/ldk-node-integration-tests.yml +++ b/.github/workflows/ldk-node-integration-tests.yml @@ -51,8 +51,11 @@ jobs: cd vss-server RUSTFLAGS="--cfg noop_authorizer" cargo build --no-default-features ./target/debug/vss-server server/vss-server-config.toml& - - name: Pin packages to allow for MSRV + - name: Pin ldk-node packages to allow for MSRV if: "matrix.toolchain == '1.85.0'" + env: + # Use MSRV-aware resolver for ldk-node + CARGO_RESOLVER_INCOMPATIBLE_RUST_VERSIONS: fallback run: | cd ldk-node cargo update -p idna_adapter --precise "1.2.0" --verbose # idna_adapter 1.2.1 uses ICU4X 2.2.0, requiring 1.86 and newer