Skip to content

Commit

Permalink
chore(evm): use dyn DatabaseExt in inspect (#8921)
Browse files Browse the repository at this point in the history
chore(evm): use dyn DatabaseExt in inspect
  • Loading branch information
DaniPopes authored Sep 21, 2024
1 parent 1f9c77a commit a301f26
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
8 changes: 6 additions & 2 deletions crates/evm/core/src/backend/cow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ impl<'a> CowBackend<'a> {
/// Note: in case there are any cheatcodes executed that modify the environment, this will
/// update the given `env` with the new values.
#[instrument(name = "inspect", level = "debug", skip_all)]
pub fn inspect<'b, I: InspectorExt<&'b mut Self>>(
pub fn inspect<'b, I: InspectorExt<&'b mut dyn DatabaseExt>>(
&'b mut self,
env: &mut EnvWithHandlerCfg,
inspector: I,
Expand All @@ -71,7 +71,11 @@ impl<'a> CowBackend<'a> {
// already, we reset the initialized state
self.is_initialized = false;
self.spec_id = env.handler_cfg.spec_id;
let mut evm = crate::utils::new_evm_with_inspector(self, env.clone(), inspector);
let mut evm = crate::utils::new_evm_with_inspector(
self as &mut dyn DatabaseExt,
env.clone(),
inspector,
);

let res = evm.transact().wrap_err("backend: failed while inspecting")?;

Expand Down
8 changes: 6 additions & 2 deletions crates/evm/core/src/backend/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -749,13 +749,17 @@ impl Backend {
/// Note: in case there are any cheatcodes executed that modify the environment, this will
/// update the given `env` with the new values.
#[instrument(name = "inspect", level = "debug", skip_all)]
pub fn inspect<'a, I: InspectorExt<&'a mut Self>>(
pub fn inspect<'a, I: InspectorExt<&'a mut dyn DatabaseExt>>(
&'a mut self,
env: &mut EnvWithHandlerCfg,
inspector: I,
) -> eyre::Result<ResultAndState> {
self.initialize(env);
let mut evm = crate::utils::new_evm_with_inspector(self, env.clone(), inspector);
let mut evm = crate::utils::new_evm_with_inspector(
self as &mut dyn DatabaseExt,
env.clone(),
inspector,
);

let res = evm.transact().wrap_err("backend: failed while inspecting")?;

Expand Down

0 comments on commit a301f26

Please sign in to comment.