diff --git a/crates/blockifier/src/execution/contract_class.rs b/crates/blockifier/src/execution/contract_class.rs index f9e3a349c5..c2f921a48a 100644 --- a/crates/blockifier/src/execution/contract_class.rs +++ b/crates/blockifier/src/execution/contract_class.rs @@ -52,14 +52,11 @@ pub enum ContractClass { V1(ContractClassV1), } -impl TryFrom for ContractClass { +impl TryFrom for ContractClass { type Error = ProgramError; - fn try_from( - contract_class: starknet_api::contract_class::ContractClass, - ) -> Result { - let starknet_api::contract_class::ContractClass::V1(contract_class_v1) = contract_class; - Ok(ContractClass::V1(contract_class_v1.try_into()?)) + fn try_from(contract_class: CasmContractClass) -> Result { + Ok(ContractClass::V1(contract_class.try_into()?)) } } @@ -373,18 +370,6 @@ impl EntryPointV1 { } } -impl TryFrom for ContractClassV1 { - type Error = ProgramError; - - fn try_from( - contract_class: starknet_api::contract_class::ContractClassV1, - ) -> Result { - let starknet_api::contract_class::ContractClassV1::Casm(casm_contract_class) = - contract_class; - casm_contract_class.try_into() - } -} - impl TryFrom for ContractClassV1 { type Error = ProgramError; @@ -509,13 +494,16 @@ impl TryFrom for ClassInfo { fn try_from(class_info: starknet_api::contract_class::ClassInfo) -> Result { let starknet_api::contract_class::ClassInfo { - contract_class, + casm_contract_class, sierra_program_length, abi_length, } = class_info; - let contract_class: ContractClass = contract_class.try_into()?; - Ok(Self { contract_class, sierra_program_length, abi_length }) + Ok(Self { + contract_class: casm_contract_class.try_into()?, + sierra_program_length, + abi_length, + }) } } diff --git a/crates/starknet_api/src/contract_class.rs b/crates/starknet_api/src/contract_class.rs index 4ea8787959..40a484c6cc 100644 --- a/crates/starknet_api/src/contract_class.rs +++ b/crates/starknet_api/src/contract_class.rs @@ -1,23 +1,11 @@ use cairo_lang_starknet_classes::casm_contract_class::CasmContractClass; use serde::{Deserialize, Serialize}; -/// Compiled contract class. -#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)] -pub enum ContractClass { - V1(ContractClassV1), -} - -/// Compiled contract class variant for Cairo 1 contracts. -#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)] -pub enum ContractClassV1 { - Casm(CasmContractClass), -} - /// All relevant information about a declared contract class, including the compiled contract class /// and other parameters derived from the original declare transaction required for billing. #[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)] pub struct ClassInfo { - pub contract_class: ContractClass, + pub casm_contract_class: CasmContractClass, pub sierra_program_length: usize, pub abi_length: usize, }