Skip to content

Commit

Permalink
revert fmt changes
Browse files Browse the repository at this point in the history
  • Loading branch information
mm-zk committed Sep 7, 2023
1 parent cc71e4f commit fce17c6
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 40 deletions.
4 changes: 2 additions & 2 deletions cli/src/cmd/forge/test/filter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,10 @@ impl FileFilter for FilterArgs {
fn is_match(&self, file: &Path) -> bool {
if let Some(file) = file.as_os_str().to_str() {
if let Some(ref glob) = self.path_pattern {
return glob.is_match(file);
return glob.is_match(file)
}
if let Some(ref glob) = self.path_pattern_inverse {
return !glob.is_match(file);
return !glob.is_match(file)
}
}
file.is_sol_test()
Expand Down
18 changes: 9 additions & 9 deletions cli/src/cmd/forge/test/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,8 @@ impl TestArgs {
let mut project = config.project()?;

// install missing dependencies
if install::install_missing_dependencies(&mut config, self.build_args().silent)
&& config.auto_detect_remappings
if install::install_missing_dependencies(&mut config, self.build_args().silent) &&
config.auto_detect_remappings
{
// need to re-configure here to also catch additional remappings
config = self.load_config();
Expand Down Expand Up @@ -374,7 +374,7 @@ impl TestOutcome {
pub fn ensure_ok(&self) -> eyre::Result<()> {
let failures = self.failures().count();
if self.allow_failure || failures == 0 {
return Ok(());
return Ok(())
}

if !shell::verbosity().is_normal() {
Expand All @@ -387,7 +387,7 @@ impl TestOutcome {
for (suite_name, suite) in self.results.iter() {
let failures = suite.failures().count();
if failures == 0 {
continue;
continue
}

let term = if failures > 1 { "tests" } else { "test" };
Expand Down Expand Up @@ -582,7 +582,7 @@ async fn test(

// If the test failed, we want to stop processing the rest of the tests
if fail_fast && result.status == TestStatus::Failure {
break 'outer;
break 'outer
}

// We only display logs at level 2 and above
Expand Down Expand Up @@ -623,12 +623,12 @@ async fn test(
// tests At verbosity level 5, we display
// all traces for all tests
TraceKind::Setup => {
(verbosity >= 5)
|| (verbosity == 4 && result.status == TestStatus::Failure)
(verbosity >= 5) ||
(verbosity == 4 && result.status == TestStatus::Failure)
}
TraceKind::Execution => {
verbosity > 3
|| (verbosity == 3 && result.status == TestStatus::Failure)
verbosity > 3 ||
(verbosity == 3 && result.status == TestStatus::Failure)
}
_ => false,
};
Expand Down
10 changes: 5 additions & 5 deletions cli/src/cmd/forge/zksolc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ impl ZkSolc {

// Skip this file if it's not in the 'sources' directory or its subdirectories
if !is_in_sources_dir {
continue;
continue
}

// Step 3: Parse JSON Input for each Source
Expand Down Expand Up @@ -605,9 +605,9 @@ impl ZkSolc {
/// self.prepare_compiler_input(contract_path)?;
/// ```
///
/// In this example, the `prepare_compiler_input` function is called with the contract source path. It
/// generates the JSON input for the contract, configures the Solidity compiler, and saves
/// the input to the artifacts directory.
/// In this example, the `prepare_compiler_input` function is called with the contract source
/// path. It generates the JSON input for the contract, configures the Solidity compiler,
/// and saves the input to the artifacts directory.
fn prepare_compiler_input(&mut self, contract_path: &PathBuf) -> Result<()> {
// Step 1: Configure File Output Selection
let mut file_output_selection: FileOutputSelection = BTreeMap::default();
Expand Down Expand Up @@ -847,7 +847,7 @@ mod tests {
let data = include_str!("testdata/artifacts.json").as_bytes().to_vec();
let mut displayed_warnings = HashSet::new();
let source = "src/Counter.sol".to_owned();
let result = ZkSolc::handle_output(data, source, &mut displayed_warnings, None);
let result = ZkSolc::handle_output(data, &source, &mut displayed_warnings, None);

let artifacts = result.get("Counter").unwrap();
assert_eq!(artifacts.len(), 1);
Expand Down
32 changes: 16 additions & 16 deletions evm/src/executor/backend/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ pub trait DatabaseExt: Database<Error = DatabaseError> {
/// Returns an error if [`Self::has_cheatcode_access`] returns `false`
fn ensure_cheatcode_access(&self, account: Address) -> Result<(), NoCheatcodeAccessError> {
if !self.has_cheatcode_access(account) {
return Err(NoCheatcodeAccessError(account));
return Err(NoCheatcodeAccessError(account))
}
Ok(())
}
Expand All @@ -302,7 +302,7 @@ pub trait DatabaseExt: Database<Error = DatabaseError> {
account: Address,
) -> Result<(), NoCheatcodeAccessError> {
if self.is_forked_mode() {
return self.ensure_cheatcode_access(account);
return self.ensure_cheatcode_access(account)
}
Ok(())
}
Expand Down Expand Up @@ -555,9 +555,8 @@ impl Backend {
/// Checks if the test contract associated with this backend failed, See
/// [Self::is_failed_test_contract]
pub fn is_failed(&self) -> bool {
self.has_snapshot_failure()
|| self
.test_contract_address()
self.has_snapshot_failure() ||
self.test_contract_address()
.map(|addr| self.is_failed_test_contract(addr))
.unwrap_or_default()
}
Expand Down Expand Up @@ -598,7 +597,7 @@ impl Backend {
.cloned()
.unwrap_or_default()
.present_value();
return value.as_le_bytes()[1] != 0;
return value.as_le_bytes()[1] != 0
}

false
Expand All @@ -612,7 +611,7 @@ impl Backend {
U256::from_str_radix(GLOBAL_FAILURE_SLOT, 16).expect("This is a bug.").into();
if let Some(account) = current_state.state.get(&h160_to_b160(CHEATCODE_ADDRESS)) {
let value = account.storage.get(&index).cloned().unwrap_or_default().present_value();
return value == revm::primitives::U256::from(1);
return value == revm::primitives::U256::from(1)
}

false
Expand Down Expand Up @@ -714,7 +713,7 @@ impl Backend {
all_logs.extend(f.journaled_state.logs.clone())
}
});
return all_logs;
return all_logs
}

logs
Expand Down Expand Up @@ -751,7 +750,8 @@ impl Backend {
{
self.initialize(env);

let result: EVMResult<DatabaseError> = era_revm::transactions::run_era_transaction(env, self, inspector);
let result: EVMResult<DatabaseError> =
era_revm::transactions::run_era_transaction(env, self, inspector);

Ok(result.unwrap())
}
Expand Down Expand Up @@ -848,7 +848,7 @@ impl Backend {
for tx in full_block.transactions.into_iter() {
if tx.hash().eq(&tx_hash) {
// found the target transaction
return Ok(Some(tx));
return Ok(Some(tx))
}
trace!(tx=?tx.hash, "committing transaction");

Expand Down Expand Up @@ -973,7 +973,7 @@ impl DatabaseExt for Backend {
trace!(?id, "select fork");
if self.is_active_fork(id) {
// nothing to do
return Ok(());
return Ok(())
}

let fork_id = self.ensure_fork_id(id).cloned()?;
Expand Down Expand Up @@ -1190,7 +1190,7 @@ impl DatabaseExt for Backend {
fn ensure_fork(&self, id: Option<LocalForkId>) -> eyre::Result<LocalForkId> {
if let Some(id) = id {
if self.inner.issued_local_fork_ids.contains_key(&id) {
return Ok(id);
return Ok(id)
}
eyre::bail!("Requested fork `{}` does not exit", id)
}
Expand All @@ -1216,7 +1216,7 @@ impl DatabaseExt for Backend {
if self.inner.forks.len() == 1 {
// we only want to provide additional diagnostics here when in multifork mode with > 1
// forks
return None;
return None
}

if !active_fork.is_contract(callee) && !is_contract_in_state(journaled_state, callee) {
Expand All @@ -1243,7 +1243,7 @@ impl DatabaseExt for Backend {
active: active_id,
available_on,
})
};
}
}
None
}
Expand Down Expand Up @@ -1416,7 +1416,7 @@ impl Fork {
pub fn is_contract(&self, acc: Address) -> bool {
if let Ok(Some(acc)) = self.db.basic(h160_to_b160(acc)) {
if acc.code_hash != KECCAK_EMPTY {
return true;
return true
}
}
is_contract_in_state(&self.journaled_state, acc)
Expand Down Expand Up @@ -1736,7 +1736,7 @@ fn merge_db_account_data<ExtDB: DatabaseRef>(
acc
} else {
// Account does not exist
return;
return
};

if let Some(code) = active.contracts.get(&acc.info.code_hash).cloned() {
Expand Down
8 changes: 4 additions & 4 deletions evm/src/executor/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ impl Executor {
/// XXXX
pub fn deploy_create2_deployer(&mut self) -> eyre::Result<()> {
trace!("deploying local create2 deployer");
return Ok(());
return Ok(())
/*
let create2_deployer_account = self
.backend_mut()
Expand Down Expand Up @@ -480,7 +480,7 @@ impl Executor {
state_changeset: None,
transactions: None,
script_wallets,
})));
})))
}
};

Expand Down Expand Up @@ -551,7 +551,7 @@ impl Executor {
) -> Result<bool, DatabaseError> {
if self.backend().has_snapshot_failure() {
// a failure occurred in a reverted snapshot, which is considered a failed test
return Ok(should_fail);
return Ok(should_fail)
}

// Construct a new VM with the state changeset
Expand Down Expand Up @@ -912,7 +912,7 @@ fn convert_call_result<D: Detokenize>(
let reason = decode::decode_revert(result.as_ref(), abi, Some(status))
.unwrap_or_else(|_| format!("{status:?}"));
if reason == "SKIPPED" {
return Err(EvmError::SkipError);
return Err(EvmError::SkipError)
}
Err(EvmError::Execution(Box::new(ExecutionErr {
reverted,
Expand Down
8 changes: 4 additions & 4 deletions forge/src/runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ impl<'a> ContractRunner<'a> {
)]
.into(),
warnings,
);
)
}

let has_invariants = self.contract.functions().any(|func| func.is_invariant_test());
Expand Down Expand Up @@ -239,7 +239,7 @@ impl<'a> ContractRunner<'a> {
)]
.into(),
warnings,
);
)
}

let mut test_results = self
Expand Down Expand Up @@ -435,7 +435,7 @@ impl<'a> ContractRunner<'a> {
labeled_addresses,
kind: TestKind::Standard(0),
..Default::default()
}];
}]
};

let mut evm = InvariantExecutor::new(
Expand Down Expand Up @@ -556,7 +556,7 @@ impl<'a> ContractRunner<'a> {
labeled_addresses,
kind: TestKind::Standard(0),
..Default::default()
};
}
}

let kind = TestKind::Fuzz {
Expand Down

0 comments on commit fce17c6

Please sign in to comment.