Skip to content
Closed
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
11 changes: 9 additions & 2 deletions contracts/hot/fuzz/targets/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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);
}
}
Expand Down Expand Up @@ -205,6 +206,11 @@ fn run_sequence(ops: &[HotOp]) {
let result = catch_unwind(AssertUnwindSafe(|| client.unpause(&current_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());
}
Expand Down Expand Up @@ -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;
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion contracts/hot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};

// ---------------------------------------------------------------------------
Expand Down