Skip to content

Commit

Permalink
random logs
Browse files Browse the repository at this point in the history
  • Loading branch information
elfedy committed Jan 23, 2025
1 parent abe48fe commit cae794a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
1 change: 0 additions & 1 deletion .github/workflows/nextest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,5 +96,4 @@ jobs:
HTTP_ARCHIVE_URLS: ${{ secrets.HTTP_ARCHIVE_URLS }}
WS_ARCHIVE_URLS: ${{ secrets.WS_ARCHIVE_URLS }}
RUST_BACKTRACE: full
RUST_LOG: debug
run: cargo nextest run -E 'kind(test) & !test(/issue|forge_std|ext_integration|zk|test_zk_aave_di/) & test(/invariant_roll_fork/)' --no-capture
17 changes: 10 additions & 7 deletions crates/evm/evm/src/executors/invariant/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -324,9 +324,10 @@ impl<'a> InvariantExecutor<'a> {
deployed_libs: &[Address],
progress: Option<&ProgressBar>,
) -> Result<InvariantFuzzTestResult> {
println!("invariant fuzz");
// Throw an error to abort test run if the invariant function accepts input params
if !invariant_contract.invariant_function.inputs.is_empty() {
return Err(eyre!("Invariant test function should have no inputs"))
return Err(eyre!("Invariant test function should have no inputs"));
}

let (invariant_test, invariant_strategy) =
Expand All @@ -337,6 +338,7 @@ impl<'a> InvariantExecutor<'a> {

let _ = self.runner.run(&invariant_strategy, |first_input| {
// Create current invariant run data.
println!("inside invariant");
let mut current_run = InvariantTestRun::new(
first_input,
// Before each run, we must reset the backend state.
Expand All @@ -346,10 +348,11 @@ impl<'a> InvariantExecutor<'a> {

// We stop the run immediately if we have reverted, and `fail_on_revert` is set.
if self.config.fail_on_revert && invariant_test.reverts() > 0 {
return Err(TestCaseError::fail("Revert occurred."))
return Err(TestCaseError::fail("Revert occurred."));
}

while current_run.depth < self.config.depth {
println!("current_run: {current_run:?}");
// Check if the timeout has been reached.
if timer.is_timed_out() {
// Since we never record a revert here the test is still considered
Expand Down Expand Up @@ -392,7 +395,7 @@ impl<'a> InvariantExecutor<'a> {
invariant_test.set_error(InvariantFuzzError::MaxAssumeRejects(
self.config.max_assume_rejects,
));
return Err(TestCaseError::fail("Max number of vm.assume rejects reached."))
return Err(TestCaseError::fail("Max number of vm.assume rejects reached."));
}
} else {
// Commit executed call result.
Expand Down Expand Up @@ -444,7 +447,7 @@ impl<'a> InvariantExecutor<'a> {
}
// If test cannot continue then stop current run and exit test suite.
if !result.can_continue {
return Err(TestCaseError::fail("Test cannot continue."))
return Err(TestCaseError::fail("Test cannot continue."));
}

invariant_test.set_last_call_results(result.call_result);
Expand Down Expand Up @@ -566,7 +569,7 @@ impl<'a> InvariantExecutor<'a> {
&mut failures,
)?;
if let Some(error) = failures.error {
return Err(eyre!(error.revert_reason().unwrap_or_default()))
return Err(eyre!(error.revert_reason().unwrap_or_default()));
}

Ok((
Expand Down Expand Up @@ -672,7 +675,7 @@ impl<'a> InvariantExecutor<'a> {
.wrap_err(format!("{contract} does not have the selector {selector:?}"))?;
}

return Ok(artifact.identifier())
return Ok(artifact.identifier());
}
eyre::bail!("{contract} not found in the project. Allowed format: `contract_name` or `contract_path:contract_name`.");
}
Expand Down Expand Up @@ -830,7 +833,7 @@ impl<'a> InvariantExecutor<'a> {
) -> eyre::Result<()> {
// Do not add address in target contracts if no function selected.
if selectors.is_empty() {
return Ok(())
return Ok(());
}

let contract = match targeted_contracts.entry(address) {
Expand Down

0 comments on commit cae794a

Please sign in to comment.