From 0cf8cdae83e1cd30babb85e3c381386ab15d1c72 Mon Sep 17 00:00:00 2001 From: Aviv Greenburg Date: Wed, 30 Oct 2024 16:11:28 +0200 Subject: [PATCH] chore(blockifier): alternate use of casm and native depending on tracked_resource --- .../src/execution/execution_utils.rs | 24 +++++++++++++------ .../src/execution/native/contract_class.rs | 2 +- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/crates/blockifier/src/execution/execution_utils.rs b/crates/blockifier/src/execution/execution_utils.rs index ecd5c20f4b4..f93440cfc6f 100644 --- a/crates/blockifier/src/execution/execution_utils.rs +++ b/crates/blockifier/src/execution/execution_utils.rs @@ -142,13 +142,23 @@ pub fn execute_entry_point_call( ), #[cfg(feature = "cairo_native")] ContractClass::V1Native(contract_class) => { - native_entry_point_execution::execute_entry_point_call( - call, - contract_class, - state, - resources, - context, - ) + if context.tracked_resource_stack.last() == Some(&TrackedResource::CairoSteps) { + entry_point_execution::execute_entry_point_call( + call, + contract_class.casm, + state, + resources, + context, + ) + } else { + native_entry_point_execution::execute_entry_point_call( + call, + contract_class, + state, + resources, + context, + ) + } } } } diff --git a/crates/blockifier/src/execution/native/contract_class.rs b/crates/blockifier/src/execution/native/contract_class.rs index 97cb832a8cb..3501c98dce3 100644 --- a/crates/blockifier/src/execution/native/contract_class.rs +++ b/crates/blockifier/src/execution/native/contract_class.rs @@ -53,7 +53,7 @@ impl NativeContractClassV1 { pub struct NativeContractClassV1Inner { pub executor: AotNativeExecutor, entry_points_by_type: EntryPointsByType, - casm: ContractClassV1, + pub casm: ContractClassV1, } impl NativeContractClassV1Inner {