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
17 changes: 6 additions & 11 deletions crates/cheatcodes/src/credible.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,7 @@ pub fn execute_assertion(
let db = ThreadSafeDb::new(*ecx.db_mut());

// Prepare assertion store

let config =
ExecutorConfig { spec_id: spec_id.into(), chain_id, assertion_gas_limit: TX_GAS_LIMIT_CAP };
let config = ExecutorConfig { spec_id, chain_id, assertion_gas_limit: TX_GAS_LIMIT_CAP };

let store = AssertionStore::new_ephemeral();

Expand All @@ -168,9 +166,11 @@ pub fn execute_assertion(
});

store.insert(assertion.adopter, assertion_state).expect("Failed to store assertions");
// transaction gas limit should respect new hardfork rules of max 16m gas
let tx_gas_limit = block.gas_limit.min(TX_GAS_LIMIT_CAP);
let tx_env = TxEnv {
caller: tx_attributes.caller,
gas_limit: block.gas_limit.try_into().unwrap_or(u64::MAX),
gas_limit: tx_gas_limit,
gas_price: block.basefee.into(),
chain_id: Some(chain_id),
value: tx_attributes.value,
Expand Down Expand Up @@ -223,12 +223,7 @@ pub fn execute_assertion(
if let Some(expected) = &mut cheats.expected_revert {
expected.max_depth = max(ecx.journaled_state.depth(), expected.max_depth);
}
// Get a new inspector for logging
let mut inspector = executor.get_inspector(cheats);
inspector.console_log(&format!(
"Expected 1 assertion fn to be executed, but {total_assertions_ran} were executed."
));
bail!("Assertion Fn number mismatch");
bail!("Expected 1 assertion to be executed, but {total_assertions_ran} were executed.");
}

//Expect is safe because we validate above that 1 assertion was ran.
Expand All @@ -244,7 +239,7 @@ pub fn execute_assertion(

if !assertion_fn_result.console_logs.is_empty() {
inspector.console_log("Assertion function logs: ");
for log in assertion_fn_result.console_logs.iter() {
for log in &assertion_fn_result.console_logs {
inspector.console_log(log);
}
}
Expand Down
5 changes: 1 addition & 4 deletions crates/cli/src/opts/global.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
use clap::{ArgAction, Parser};
use foundry_common::{
shell::{ColorChoice, OutputFormat, OutputMode, Shell, Verbosity},
version::{IS_NIGHTLY_VERSION, NIGHTLY_VERSION_WARNING_MESSAGE},
};
use foundry_common::shell::{ColorChoice, OutputFormat, OutputMode, Shell, Verbosity};
use serde::{Deserialize, Serialize};

/// Global arguments for the CLI.
Expand Down
Loading