Skip to content

Commit

Permalink
use u32 for timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
smartcontracts committed Nov 25, 2024
1 parent b2a5f8d commit a9003b3
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions crates/config/src/fuzz.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ pub struct FuzzConfig {
/// show `console.log` in fuzz test, defaults to `false`
pub show_logs: bool,
/// Optional timeout (in seconds) for each property test
pub timeout: Option<u64>,
pub timeout: Option<u32>,
}

impl Default for FuzzConfig {
Expand Down Expand Up @@ -94,7 +94,7 @@ impl InlineConfigParser for FuzzConfig {
}
"failure-persist-file" => conf_clone.failure_persist_file = Some(value),
"show-logs" => conf_clone.show_logs = parse_config_bool(key, value)?,
"timeout" => conf_clone.timeout = Some(parse_config_u64(key, value)?),
"timeout" => conf_clone.timeout = Some(parse_config_u32(key, value)?),
_ => Err(InlineConfigParserError::InvalidConfigProperty(key))?,
}
}
Expand Down
4 changes: 2 additions & 2 deletions crates/config/src/invariant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ pub struct InvariantConfig {
/// Whether to collect and display fuzzed selectors metrics.
pub show_metrics: bool,
/// Optional timeout (in seconds) for each invariant test.
pub timeout: Option<u64>,
pub timeout: Option<u32>,
}

impl Default for InvariantConfig {
Expand Down Expand Up @@ -112,7 +112,7 @@ impl InlineConfigParser for InvariantConfig {
}
"shrink-run-limit" => conf_clone.shrink_run_limit = parse_config_u32(key, value)?,
"show-metrics" => conf_clone.show_metrics = parse_config_bool(key, value)?,
"timeout" => conf_clone.timeout = Some(parse_config_u64(key, value)?),
"timeout" => conf_clone.timeout = Some(parse_config_u32(key, value)?),
_ => Err(InlineConfigParserError::InvalidConfigProperty(key.to_string()))?,
}
}
Expand Down
2 changes: 1 addition & 1 deletion crates/evm/evm/src/executors/fuzz/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ impl FuzzedExecutor {

// Start a timer if timeout is set.
let start_time = self.config.timeout.map(|timeout| {
(std::time::Instant::now(), std::time::Duration::from_secs(timeout))
(std::time::Instant::now(), std::time::Duration::from_secs(timeout.into()))
});

let run_result = self.runner.clone().run(&strategy, |calldata| {
Expand Down
2 changes: 1 addition & 1 deletion crates/evm/evm/src/executors/invariant/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ impl<'a> InvariantExecutor<'a> {

// Start a timer if timeout is set.
let start_time = self.config.timeout.map(|timeout| {
(std::time::Instant::now(), std::time::Duration::from_secs(timeout))
(std::time::Instant::now(), std::time::Duration::from_secs(timeout.into()))
});

let _ = self.runner.run(&invariant_strategy, |first_input| {
Expand Down

0 comments on commit a9003b3

Please sign in to comment.