From 509cc824dd920ead3b80b4b007250fd601ae93ff Mon Sep 17 00:00:00 2001 From: Nisheeth Barthwal Date: Mon, 23 Dec 2024 18:16:42 +0100 Subject: [PATCH] fix tests --- crates/strategy/zksync/src/backend.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/crates/strategy/zksync/src/backend.rs b/crates/strategy/zksync/src/backend.rs index 9e2439bad..303579191 100644 --- a/crates/strategy/zksync/src/backend.rs +++ b/crates/strategy/zksync/src/backend.rs @@ -83,13 +83,17 @@ impl BackendStrategyRunner for ZksyncBackendStrategyRunner { &self, backend: &mut Backend, env: &mut EnvWithHandlerCfg, - _inspector: &mut dyn InspectorExt, + inspector: &mut dyn InspectorExt, inspect_ctx: Box, ) -> Result { + if !is_zksync_cainspect_context(&inspect_ctx) { + return self.evm.inspect(backend, env, inspector, inspect_ctx); + } + + let inspect_ctx = get_inspect_context(inspect_ctx); let mut persisted_factory_deps = get_context(backend.strategy.context.as_mut()).persisted_factory_deps.clone(); - let inspect_ctx = get_inspect_context(inspect_ctx); let result = foundry_zksync_core::vm::transact( Some(&mut persisted_factory_deps), Some(inspect_ctx.factory_deps), @@ -421,3 +425,7 @@ fn get_context(ctx: &mut dyn BackendStrategyContext) -> &mut ZksyncBackendStrate fn get_inspect_context(ctx: Box) -> Box { ctx.downcast().expect("expected ZksyncInspectContext") } + +fn is_zksync_inspect_context(ctx: &dyn Any) -> bool { + ctx.downcast_ref::().is_some() +}