From ebd0e7384ee9e6b19badab780ec501c58ffb4a06 Mon Sep 17 00:00:00 2001 From: Josh Megnauth Date: Wed, 21 Jan 2026 14:47:37 -0500 Subject: [PATCH] chore: sync Rust ver with core; reduce deps `freenet-core`'s minimum version is 1.80 while `freenet-stdlib`'s version is 1.71. 1.71 was released three years ago. Bumping to 1.80 allows dropping `once_cell` in favor of using the standard lib. I disabled the default features for `chrono`, `futures`, and `semver` because they weren't used. Chrono is only used in one place and the type is constructed through FFI rather than calling its functions. Futures is used for its traits so the rest of it isn't needed. I removed `serde_bytes` in favor of `serde_with`. `serde_with` includes its own version of `Bytes` and `serde_bytes` was only used twice in the code. --- rust/Cargo.toml | 12 +++++------- rust/src/contract_interface/tests.rs | 5 +++-- rust/src/contract_interface/wrapped.rs | 5 +++-- typescript/Cargo.lock | 4 ++-- typescript/Cargo.toml | 2 +- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/rust/Cargo.toml b/rust/Cargo.toml index ce433f2..f795652 100644 --- a/rust/Cargo.toml +++ b/rust/Cargo.toml @@ -2,7 +2,7 @@ name = "freenet-stdlib" version = "0.1.30" edition = "2021" -rust-version = "1.71.1" +rust-version = "1.80" publish = true description = "Freeenet standard library" license = "LGPL-3.0-only" @@ -14,16 +14,14 @@ bincode = "1" byteorder = "1" blake3 = { version = "1", features = ["std", "traits-preview"] } bs58 = "0.5" -chrono = { version = "0.4", default-features = false, features = ["alloc", "serde"] } +chrono = { version = "0.4", default-features = false } flatbuffers = "24.3" -futures = "0.3" -semver = { version = "1", features = ["serde"] } +futures = { version = "0.3", default-features = false } +semver = { version = "1", default-features = false } serde = { version = "1", features = ["derive"] } -serde_bytes = "0.11" serde_json = "1" serde_with = { version = "3", default-features = false, features = ["macros", "alloc"] } -once_cell = "1" -thiserror = "1" +thiserror = "2" tracing = "0.1" tracing-subscriber = { version = "0.3", features = ["default", "env-filter"] } diff --git a/rust/src/contract_interface/tests.rs b/rust/src/contract_interface/tests.rs index 3b17c68..a183b14 100644 --- a/rust/src/contract_interface/tests.rs +++ b/rust/src/contract_interface/tests.rs @@ -1,9 +1,10 @@ +use std::sync::LazyLock; + use super::*; use crate::parameters::Parameters; -use once_cell::sync::Lazy; use rand::{rng, rngs::SmallRng, Rng, SeedableRng}; -static RND_BYTES: Lazy<[u8; 1024]> = Lazy::new(|| { +static RND_BYTES: LazyLock<[u8; 1024]> = LazyLock::new(|| { let mut bytes = [0; 1024]; let mut rng = SmallRng::from_rng(&mut rng()); rng.fill(&mut bytes); diff --git a/rust/src/contract_interface/wrapped.rs b/rust/src/contract_interface/wrapped.rs index 340d4ca..679f39e 100644 --- a/rust/src/contract_interface/wrapped.rs +++ b/rust/src/contract_interface/wrapped.rs @@ -9,6 +9,7 @@ use std::ops::Deref; use std::sync::Arc; use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::{Bytes, DeserializeAs, SerializeAs}; use crate::parameters::Parameters; @@ -41,14 +42,14 @@ impl WrappedState { where S: serde::Serializer, { - serde_bytes::serialize(&**data, ser) + Bytes::serialize_as(&**data, ser) } fn deser_state<'de, D>(deser: D) -> Result>, D::Error> where D: Deserializer<'de>, { - let data: Vec = serde_bytes::deserialize(deser)?; + let data: Vec = Bytes::deserialize_as(deser)?; Ok(Arc::new(data)) } } diff --git a/typescript/Cargo.lock b/typescript/Cargo.lock index c15f645..51be11a 100644 --- a/typescript/Cargo.lock +++ b/typescript/Cargo.lock @@ -262,7 +262,7 @@ dependencies = [ [[package]] name = "freenet-macros" -version = "0.1.1" +version = "0.1.2" dependencies = [ "proc-macro2", "quote", @@ -271,7 +271,7 @@ dependencies = [ [[package]] name = "freenet-stdlib" -version = "0.1.3" +version = "0.1.30" dependencies = [ "bincode", "blake3", diff --git a/typescript/Cargo.toml b/typescript/Cargo.toml index c4a1db0..e53d443 100644 --- a/typescript/Cargo.toml +++ b/typescript/Cargo.toml @@ -2,7 +2,7 @@ name = "freenet-js-stdlib" version = "0.0.0" edition = "2021" -rust-version = "1.71.1" +rust-version = "1.80" resolver = "2" publish = false