Skip to content

Commit 96bdb61

Browse files
committed
fix: deprecate async-std-rt feature and document reqwless upgrade blocker
Replace async-std sleep implementation with a deprecation warning and runtime panic. Using compile_error! would break --all-features builds (including CI clippy checks), so instead we emit a deprecation warning at compile time and panic at runtime if the feature is actually exercised. Also document in Cargo.toml that the atomic-polyfill advisory (RUSTSEC-2023-0089) is blocked upstream on a reqwless update. Closes #126 Partially addresses #111
1 parent 36218d7 commit 96bdb61

File tree

8 files changed

+30
-18
lines changed

8 files changed

+30
-18
lines changed

Cargo.toml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ chrono = { version = "0.4.19", default-features = false, features = [
5656
] }
5757
hex = { version = "0.4.3", default-features = false, features = ["alloc"] }
5858
rand = { version = "0.8.5", default-features = false, features = ["getrandom"] }
59-
serde = { version = "1.0.130", default-features = false, features = ["derive"] }
59+
serde = { version = "1.0.130", default-features = false, features = ["derive", "alloc"] }
6060
serde_json = { version = "1.0.68", default-features = false, features = [
6161
"alloc",
6262
] }
@@ -78,6 +78,9 @@ embassy-time = { version = "0.3.2", optional = true }
7878
embedded-websocket-embedded-io = { version = "0.1.0", optional = true, default-features = false, features = [
7979
"embedded-io-async",
8080
] }
81+
# NOTE: reqwless 0.13.0 pins embedded-tls 0.17.0 which depends on atomic-polyfill
82+
# (RUSTSEC-2023-0089). Newer embedded-tls versions use portable-atomic instead, but
83+
# reqwless has not released a compatible update yet. Blocked upstream.
8184
reqwless = { version = "0.13.0", optional = true }
8285
reqwest = { version = "0.12.7", optional = true, features = ["json"] }
8386
tokio-tungstenite = { version = "0.24.0", optional = true, features = [
@@ -86,6 +89,8 @@ tokio-tungstenite = { version = "0.24.0", optional = true, features = [
8689
embassy-futures = { version = "0.1.1" }
8790
embedded-nal-async = { version = "0.8.0", optional = true }
8891
actix-rt = { version = "2.10.0", optional = true }
92+
# DEPRECATED: async-std has been discontinued (RUSTSEC-2025-0052). Use smol-rt instead.
93+
# Retained so the async-std-rt feature gate resolves; enabling it triggers a runtime panic.
8994
async-std = { version = "1.13.0", optional = true }
9095
futures-executor = { version = "0.3.30", optional = true }
9196
futures-timer = { version = "3.0.3", optional = true }

src/asynch/clients/exceptions.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#[cfg(not(feature = "std"))]
2+
use alloc::boxed::Box;
13
use thiserror_no_std::Error;
24

35
#[cfg(feature = "helpers")]

src/asynch/mod.rs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,17 @@ async fn wait_seconds(seconds: u64) {
3434
}
3535
#[cfg(feature = "async-std-rt")]
3636
{
37-
async_std::task::sleep(Duration::from_secs(seconds)).await;
38-
return;
37+
#[deprecated(
38+
since = "1.1.0",
39+
note = "async-std has been discontinued (RUSTSEC-2025-0052). Use the smol-rt feature instead."
40+
)]
41+
fn async_std_sleep_deprecated() {}
42+
#[allow(deprecated)]
43+
async_std_sleep_deprecated();
44+
panic!(
45+
"The async-std-rt feature is deprecated. async-std has been discontinued \
46+
(RUSTSEC-2025-0052). Use the smol-rt feature instead."
47+
);
3948
}
4049
#[cfg(feature = "futures-rt")]
4150
{

src/asynch/transaction/mod.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -435,10 +435,7 @@ where
435435
};
436436

437437
if is_valid_xaddress(&account_address) {
438-
let (address, tag, _) = match xaddress_to_classic_address(&account_address) {
439-
Ok(t) => t,
440-
Err(error) => return Err(error.into()),
441-
};
438+
let (address, tag, _) = xaddress_to_classic_address(&account_address)?;
442439
validate_transaction_has_field(prepared_transaction, account_field_name)?;
443440
set_transaction_field_value(prepared_transaction, account_field_name, address)?;
444441

src/models/results/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ pub mod tx;
4141
pub mod unsubscribe;
4242

4343
use super::{requests::XRPLRequest, Amount, XRPLModelException, XRPLModelResult};
44+
#[cfg(not(feature = "std"))]
45+
use alloc::boxed::Box;
4446
use alloc::{
4547
borrow::Cow,
4648
string::{String, ToString},

src/models/transactions/account_set.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -251,15 +251,12 @@ impl<'a> AccountSetError for AccountSet<'a> {
251251
}
252252

253253
fn _get_clear_flag_error(&self) -> Result<(), XRPLModelException> {
254-
if self.clear_flag.is_some() && self.set_flag.is_some() && self.clear_flag == self.set_flag
255-
{
256-
Err(XRPLAccountSetException::SetAndUnsetSameFlag {
257-
found: self.clear_flag.unwrap(),
254+
if let (Some(clear), Some(_set)) = (self.clear_flag, self.set_flag) {
255+
if self.clear_flag == self.set_flag {
256+
return Err(XRPLAccountSetException::SetAndUnsetSameFlag { found: clear }.into());
258257
}
259-
.into())
260-
} else {
261-
Ok(())
262258
}
259+
Ok(())
263260
}
264261

265262
fn _get_nftoken_minter_error(&self) -> Result<(), XRPLModelException> {

src/models/transactions/exceptions.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ pub enum XRPLSignerListSetException {
146146
/// A collection contains an invalid value.
147147
#[error("The field `{field:?}` contains an invalid value (found {found:?})")]
148148
CollectionInvalidItem { field: String, found: String },
149-
#[error("The field `signer_quorum` must be below or equal to the sum of `signer_weight` in `signer_entries`")]
149+
#[error("The field `signer_quorum` must be below or equal to the sum of `signer_weight` in `signer_entries` (max {max}, found {found})")]
150150
SignerQuorumExceedsSignerWeight { max: u32, found: u32 },
151151
}
152152

src/models/transactions/signer_list_set.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,8 @@ impl<'a> SignerListSetError for SignerListSet<'a> {
131131
fn _get_signer_quorum_error(&self) -> XRPLModelResult<()> {
132132
let mut accounts = Vec::new();
133133
let mut signer_weight_sum: u32 = 0;
134-
if self.signer_entries.is_some() {
135-
for signer_entry in self.signer_entries.as_ref().unwrap() {
134+
if let Some(entries) = &self.signer_entries {
135+
for signer_entry in entries {
136136
accounts.push(&signer_entry.account);
137137
let weight: u32 = signer_entry.signer_weight.into();
138138
signer_weight_sum += weight;
@@ -363,7 +363,7 @@ mod tests {
363363

364364
assert_eq!(
365365
signer_list_set.validate().unwrap_err().to_string().as_str(),
366-
"The field `signer_quorum` must be below or equal to the sum of `signer_weight` in `signer_entries`"
366+
"The field `signer_quorum` must be below or equal to the sum of `signer_weight` in `signer_entries` (max 3, found 10)"
367367
);
368368

369369
signer_list_set.signer_entries = Some(vec![

0 commit comments

Comments
 (0)