Skip to content

Commit a301f26

Browse files
authored
chore(evm): use dyn DatabaseExt in inspect (#8921)
chore(evm): use dyn DatabaseExt in inspect
1 parent 1f9c77a commit a301f26

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

crates/evm/core/src/backend/cow.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ impl<'a> CowBackend<'a> {
6262
/// Note: in case there are any cheatcodes executed that modify the environment, this will
6363
/// update the given `env` with the new values.
6464
#[instrument(name = "inspect", level = "debug", skip_all)]
65-
pub fn inspect<'b, I: InspectorExt<&'b mut Self>>(
65+
pub fn inspect<'b, I: InspectorExt<&'b mut dyn DatabaseExt>>(
6666
&'b mut self,
6767
env: &mut EnvWithHandlerCfg,
6868
inspector: I,
@@ -71,7 +71,11 @@ impl<'a> CowBackend<'a> {
7171
// already, we reset the initialized state
7272
self.is_initialized = false;
7373
self.spec_id = env.handler_cfg.spec_id;
74-
let mut evm = crate::utils::new_evm_with_inspector(self, env.clone(), inspector);
74+
let mut evm = crate::utils::new_evm_with_inspector(
75+
self as &mut dyn DatabaseExt,
76+
env.clone(),
77+
inspector,
78+
);
7579

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

crates/evm/core/src/backend/mod.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -749,13 +749,17 @@ impl Backend {
749749
/// Note: in case there are any cheatcodes executed that modify the environment, this will
750750
/// update the given `env` with the new values.
751751
#[instrument(name = "inspect", level = "debug", skip_all)]
752-
pub fn inspect<'a, I: InspectorExt<&'a mut Self>>(
752+
pub fn inspect<'a, I: InspectorExt<&'a mut dyn DatabaseExt>>(
753753
&'a mut self,
754754
env: &mut EnvWithHandlerCfg,
755755
inspector: I,
756756
) -> eyre::Result<ResultAndState> {
757757
self.initialize(env);
758-
let mut evm = crate::utils::new_evm_with_inspector(self, env.clone(), inspector);
758+
let mut evm = crate::utils::new_evm_with_inspector(
759+
self as &mut dyn DatabaseExt,
760+
env.clone(),
761+
inspector,
762+
);
759763

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

0 commit comments

Comments
 (0)