-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(evm): use completely separated storage sections in multifork (#2301
) * refactor: completely separate fork states * refactor: turn fuzz wrapper into cow * refactor: add subroutine to trait * feat: track subroutine * copy sender and receiver * test: extend fork test * fix: initialize accounts on setup * test: add create select test * Update evm/src/executor/backend/fuzz.rs Co-authored-by: Georgios Konstantopoulos <me@gakonst.com> * update docs * fix: clone cheat code address and add traces * test: add another test * introduce persistent accounts * feat: add persistent cheatcodes * add persistent tests * test: add persistent test * feat: add revert error multifork diagnostic * feat: better diagnostic * docs * feat: fork revert diagnostic * test: remove uncommented left over Co-authored-by: Georgios Konstantopoulos <me@gakonst.com>
- Loading branch information
Showing
19 changed files
with
1,058 additions
and
439 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
use crate::{ | ||
executor::{backend::LocalForkId, inspector::Cheatcodes}, | ||
Address, | ||
}; | ||
use foundry_common::fmt::UIfmt; | ||
|
||
/// Represents possible diagnostic cases on revert | ||
#[derive(Debug, Clone)] | ||
pub enum RevertDiagnostic { | ||
/// The `contract` does not exist on the `active` fork but exist on other fork(s) | ||
ContractExistsOnOtherForks { | ||
contract: Address, | ||
active: LocalForkId, | ||
available_on: Vec<LocalForkId>, | ||
}, | ||
ContractDoesNotExist { | ||
contract: Address, | ||
active: LocalForkId, | ||
}, | ||
} | ||
|
||
// === impl RevertDiagnostic === | ||
|
||
impl RevertDiagnostic { | ||
/// Converts the diagnostic to a readable error message | ||
pub fn to_error_msg(&self, cheats: &Cheatcodes) -> String { | ||
let get_label = |addr| cheats.labels.get(addr).cloned().unwrap_or_else(|| addr.pretty()); | ||
|
||
match self { | ||
RevertDiagnostic::ContractExistsOnOtherForks { contract, active, available_on } => { | ||
let contract_label = get_label(contract); | ||
|
||
format!( | ||
r#"Contract {} does not exists on active fork with id `{}` | ||
But exists on non active forks: `{:?}`"#, | ||
contract_label, active, available_on | ||
) | ||
} | ||
RevertDiagnostic::ContractDoesNotExist { contract, .. } => { | ||
let contract_label = get_label(contract); | ||
format!("Contract {} does not exists", contract_label) | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.