From 919f34324e2295bcc1b70621faba79290dfccb71 Mon Sep 17 00:00:00 2001 From: Liam Phung Date: Fri, 16 Oct 2026 14:26:50 +0700 Subject: [PATCH] fix(hot): re-export HotError and fix try_init return handling in fuzz target (#1185) --- contracts/hot/fuzz/targets/main.rs | 11 +++++++++-- contracts/hot/src/lib.rs | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/contracts/hot/fuzz/targets/main.rs b/contracts/hot/fuzz/targets/main.rs index 9d39bce2..95f58b99 100644 --- a/contracts/hot/fuzz/targets/main.rs +++ b/contracts/hot/fuzz/targets/main.rs @@ -137,6 +137,7 @@ fn run_sequence(ops: &[HotOp]) { let mut current_admin = admin.clone(); let mut current_signer = signer.clone(); let mut cooldown = FUZZ_COOLDOWN; + let mut unpaused_in_window = false; for op in ops { match *op { @@ -159,9 +160,9 @@ fn run_sequence(ops: &[HotOp]) { HotOp::DoubleInit => { if initialized { let result = catch_unwind(AssertUnwindSafe(|| { - client.try_init(&admin, &signer, &Some(FUZZ_COOLDOWN)); + client.try_init(&admin, &signer, &Some(FUZZ_COOLDOWN)) })); - if let Ok(Err(e)) = result { + if let Ok(Err(Ok(e))) = result { assert_eq!(e, HotError::AlreadyInitialized); } } @@ -205,6 +206,11 @@ fn run_sequence(ops: &[HotOp]) { let result = catch_unwind(AssertUnwindSafe(|| client.unpause(¤t_admin))); match result { Ok(()) => { + assert!( + !unpaused_in_window, + "two unpause calls must never both succeed inside one cooldown window" + ); + unpaused_in_window = true; paused = false; assert!(!client.is_paused()); } @@ -341,6 +347,7 @@ fn run_sequence(ops: &[HotOp]) { // Advance ledger timestamp so cooldowns may expire. let now = env.ledger().timestamp(); env.ledger().set_timestamp(now + cooldown + 1); + unpaused_in_window = false; } } } diff --git a/contracts/hot/src/lib.rs b/contracts/hot/src/lib.rs index c7c528bb..4807e0fa 100644 --- a/contracts/hot/src/lib.rs +++ b/contracts/hot/src/lib.rs @@ -20,7 +20,7 @@ pub mod errors; pub mod events; pub mod pause; -use errors::HotError; +pub use errors::HotError; use soroban_sdk::{contract, contractimpl, contracttype, Address, Env, Symbol}; // ---------------------------------------------------------------------------