From a9003b3a478fdce1fedff209d4169b25cd076ac3 Mon Sep 17 00:00:00 2001 From: Kelvin Fichter Date: Mon, 25 Nov 2024 12:00:35 -0500 Subject: [PATCH] use u32 for timeout --- crates/config/src/fuzz.rs | 4 ++-- crates/config/src/invariant.rs | 4 ++-- crates/evm/evm/src/executors/fuzz/mod.rs | 2 +- crates/evm/evm/src/executors/invariant/mod.rs | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/crates/config/src/fuzz.rs b/crates/config/src/fuzz.rs index db0803643a6d..36b6d0823d87 100644 --- a/crates/config/src/fuzz.rs +++ b/crates/config/src/fuzz.rs @@ -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, + pub timeout: Option, } impl Default for FuzzConfig { @@ -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))?, } } diff --git a/crates/config/src/invariant.rs b/crates/config/src/invariant.rs index 6ca854d21bec..f7ddb84f04f7 100644 --- a/crates/config/src/invariant.rs +++ b/crates/config/src/invariant.rs @@ -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, + pub timeout: Option, } impl Default for InvariantConfig { @@ -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()))?, } } diff --git a/crates/evm/evm/src/executors/fuzz/mod.rs b/crates/evm/evm/src/executors/fuzz/mod.rs index 13c91d39a373..9d7147115390 100644 --- a/crates/evm/evm/src/executors/fuzz/mod.rs +++ b/crates/evm/evm/src/executors/fuzz/mod.rs @@ -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| { diff --git a/crates/evm/evm/src/executors/invariant/mod.rs b/crates/evm/evm/src/executors/invariant/mod.rs index 3bc8b59124c4..3f693b1b9535 100644 --- a/crates/evm/evm/src/executors/invariant/mod.rs +++ b/crates/evm/evm/src/executors/invariant/mod.rs @@ -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| {