Skip to content
Merged
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ incremented upon a breaking change and the patch version will be incremented for

**Added**

- add printers for printing account data, transaction results, and program details ([464](https://github.com/Ackee-Blockchain/trident/pull/464))
- add invariant macros for better invariant checking and error handling ([461](https://github.com/Ackee-Blockchain/trident/pull/461))
- introduce simple Fork Testing allowing forking and caching programs and accounts from desired clusters ([434](https://github.com/Ackee-Blockchain/trident/pull/434))
- add new random generation methods ([444](https://github.com/Ackee-Blockchain/trident/pull/444))
Expand Down
21 changes: 21 additions & 0 deletions crates/fuzz/src/invariant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -262,3 +262,24 @@ macro_rules! invariant_lte {
}
};
}

/// Progress-bar-safe print macro. Use this instead of `println!` or `eprintln!`
/// inside fuzz flows to avoid garbled output in parallel mode.
///
/// In parallel mode, the output is routed through the progress bar channel
/// so it never mixes with the progress bar or with prints from other threads.
/// In single-thread mode, it falls back to `eprintln!`.
///
/// # Examples
///
/// ```ignore
/// tprintln!("balance: {}", balance);
/// tprintln!("account: {:#?}", account_data);
/// tprintln!("before: {}, after: {}", before.amount, after.amount);
/// ```
#[macro_export]
macro_rules! tlog {
($($arg:tt)*) => {
$crate::trident::progress::send_user_log(format!($($arg)*))
};
}
2 changes: 2 additions & 0 deletions crates/fuzz/src/trident/flow_executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -640,6 +640,8 @@ fn run_thread_workload_impl<E: FlowExecutor>(
.trident_mut()
.set_master_seed_and_thread_id(master_seed, thread_id);

progress::set_user_log_sender(event_tx.clone());

// Track progress updates to avoid excessive bar updates
let mut last_update = Instant::now();
let mut local_counter = 0u64;
Expand Down
3 changes: 2 additions & 1 deletion crates/fuzz/src/trident/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ pub mod flow_executor;
mod system;

mod metrics;
mod progress;
mod print;
pub mod progress;
mod random;
mod seed;
#[cfg(feature = "stake")]
Expand Down
Loading
Loading