diff --git a/crates/blockifier/src/execution/contract_class.rs b/crates/blockifier/src/execution/contract_class.rs index e65cd08787..a50887f603 100644 --- a/crates/blockifier/src/execution/contract_class.rs +++ b/crates/blockifier/src/execution/contract_class.rs @@ -285,18 +285,6 @@ impl ContractClassV1 { Ok(contract_class) } - - /// Returns an empty contract class for testing purposes. - #[cfg(any(feature = "testing", test))] - pub fn empty_for_testing() -> Self { - Self(Arc::new(ContractClassV1Inner { - program: Default::default(), - entry_points_by_type: Default::default(), - hints: Default::default(), - compiler_version: Default::default(), - bytecode_segment_lengths: NestedIntList::Leaf(0), - })) - } } /// Returns the estimated VM resources required for computing Casm hash (for Cairo 1 contracts). diff --git a/crates/blockifier/src/test_utils/struct_impls.rs b/crates/blockifier/src/test_utils/struct_impls.rs index 2f37bc4be1..827a8fe479 100644 --- a/crates/blockifier/src/test_utils/struct_impls.rs +++ b/crates/blockifier/src/test_utils/struct_impls.rs @@ -14,7 +14,6 @@ use crate::bouncer::{BouncerConfig, BouncerWeights, BuiltinCount}; use crate::context::{BlockContext, ChainInfo, FeeTokenAddresses, TransactionContext}; use crate::execution::call_info::{CallExecution, CallInfo, Retdata}; use crate::execution::common_hints::ExecutionMode; -use crate::execution::contract_class::{ContractClassV0, ContractClassV1}; use crate::execution::entry_point::{ CallEntryPoint, EntryPointExecutionContext, @@ -223,20 +222,6 @@ pub trait LoadContractFromFile: serde::de::DeserializeOwned { impl LoadContractFromFile for CasmContractClass {} impl LoadContractFromFile for DeprecatedContractClass {} -impl ContractClassV0 { - pub fn from_file(contract_path: &str) -> Self { - let raw_contract_class = get_raw_contract_class(contract_path); - Self::try_from_json_string(&raw_contract_class).unwrap() - } -} - -impl ContractClassV1 { - pub fn from_file(contract_path: &str) -> Self { - let raw_contract_class = get_raw_contract_class(contract_path); - Self::try_from_json_string(&raw_contract_class).unwrap() - } -} - impl BouncerWeights { pub fn create_for_testing(builtin_count: BuiltinCount) -> Self { Self { builtin_count, ..Self::empty() } diff --git a/crates/native_blockifier/src/py_test_utils.rs b/crates/native_blockifier/src/py_test_utils.rs index 297e927968..6cae66fa3f 100644 --- a/crates/native_blockifier/src/py_test_utils.rs +++ b/crates/native_blockifier/src/py_test_utils.rs @@ -3,7 +3,9 @@ use std::collections::HashMap; use blockifier::execution::contract_class::ContractClassV0; use blockifier::state::cached_state::CachedState; use blockifier::test_utils::dict_state_reader::DictStateReader; +use blockifier::test_utils::struct_impls::LoadContractFromFile; use starknet_api::class_hash; +use starknet_api::deprecated_contract_class::ContractClass; pub const TOKEN_FOR_TESTING_CLASS_HASH: &str = "0x30"; // This package is run within the StarkWare repository build directory. @@ -12,9 +14,9 @@ pub const TOKEN_FOR_TESTING_CONTRACT_PATH: &str = starknet/core/test_contract/token_for_testing.json"; pub fn create_py_test_state() -> CachedState { - let class_hash_to_class = HashMap::from([( - class_hash!(TOKEN_FOR_TESTING_CLASS_HASH), - ContractClassV0::from_file(TOKEN_FOR_TESTING_CONTRACT_PATH).into(), - )]); + let contract_class: ContractClassV0 = + ContractClass::from_file(TOKEN_FOR_TESTING_CONTRACT_PATH).try_into().unwrap(); + let class_hash_to_class = + HashMap::from([(class_hash!(TOKEN_FOR_TESTING_CLASS_HASH), contract_class.into())]); CachedState::from(DictStateReader { class_hash_to_class, ..Default::default() }) }