From a301f261d9986bae659546d294468f5cacca265f Mon Sep 17 00:00:00 2001 From: DaniPopes <57450786+DaniPopes@users.noreply.github.com> Date: Sat, 21 Sep 2024 17:16:51 +0200 Subject: [PATCH] chore(evm): use dyn DatabaseExt in inspect (#8921) chore(evm): use dyn DatabaseExt in inspect --- crates/evm/core/src/backend/cow.rs | 8 ++++++-- crates/evm/core/src/backend/mod.rs | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/crates/evm/core/src/backend/cow.rs b/crates/evm/core/src/backend/cow.rs index 2dcd985ae912..cba792b32d89 100644 --- a/crates/evm/core/src/backend/cow.rs +++ b/crates/evm/core/src/backend/cow.rs @@ -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, @@ -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")?; diff --git a/crates/evm/core/src/backend/mod.rs b/crates/evm/core/src/backend/mod.rs index 43e7bd73e693..4d1d7d9efeb8 100644 --- a/crates/evm/core/src/backend/mod.rs +++ b/crates/evm/core/src/backend/mod.rs @@ -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 { 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")?;