From 39ae17d4c622088312e2edd13ddf4a497a493e54 Mon Sep 17 00:00:00 2001 From: Aviv Greenburg Date: Tue, 22 Oct 2024 15:50:15 +0300 Subject: [PATCH] chore(blockifier): replace sierra_program with casm field for NativeContractClassV1 --- .../blockifier/src/execution/contract_class.rs | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/crates/blockifier/src/execution/contract_class.rs b/crates/blockifier/src/execution/contract_class.rs index 48ec3d607ef..c75569597f3 100644 --- a/crates/blockifier/src/execution/contract_class.rs +++ b/crates/blockifier/src/execution/contract_class.rs @@ -11,7 +11,6 @@ use cairo_lang_starknet_classes::contract_class::{ ContractEntryPoint as SierraContractEntryPoint, }; use cairo_lang_starknet_classes::NestedIntList; -use cairo_lang_utils::bigint::BigUintAsHex; #[allow(unused_imports)] use cairo_native::executor::AotNativeExecutor; use cairo_vm::serde::deserialize_program::{ @@ -615,8 +614,9 @@ impl NativeContractClassV1 { pub fn new( executor: AotNativeExecutor, sierra_contract_class: SierraContractClass, + casm: ContractClassV1, ) -> NativeContractClassV1 { - let contract = NativeContractClassV1Inner::new(executor, sierra_contract_class); + let contract = NativeContractClassV1Inner::new(executor, sierra_contract_class, casm); Self(Arc::new(contract)) } @@ -631,16 +631,19 @@ impl NativeContractClassV1 { pub struct NativeContractClassV1Inner { pub executor: AotNativeExecutor, entry_points_by_type: EntryPointsByType, - // Storing the raw sierra program and entry points to be able to compare the contract class. - sierra_program: Vec, + casm: ContractClassV1, } impl NativeContractClassV1Inner { - fn new(executor: AotNativeExecutor, sierra_contract_class: SierraContractClass) -> Self { + fn new( + executor: AotNativeExecutor, + sierra_contract_class: SierraContractClass, + casm: ContractClassV1, + ) -> Self { NativeContractClassV1Inner { executor, entry_points_by_type: EntryPointsByType::from(&sierra_contract_class), - sierra_program: sierra_contract_class.sierra_program, + casm, } } } @@ -649,8 +652,7 @@ impl NativeContractClassV1Inner { // be the same therefore we exclude it from the comparison. impl PartialEq for NativeContractClassV1Inner { fn eq(&self, other: &Self) -> bool { - self.entry_points_by_type == other.entry_points_by_type - && self.sierra_program == other.sierra_program + self.entry_points_by_type == other.entry_points_by_type && self.casm == other.casm } }