@@ -5,7 +5,7 @@ use cairo_lang_starknet_classes::casm_contract_class::CasmContractClass;
55use starknet_api:: abi:: abi_utils:: selector_from_name;
66use starknet_api:: abi:: constants:: CONSTRUCTOR_ENTRY_POINT_NAME ;
77use starknet_api:: contract_class:: { ContractClass , EntryPointType } ;
8- use starknet_api:: core:: { ClassHash , ContractAddress , EntryPointSelector } ;
8+ use starknet_api:: core:: { ClassHash , CompiledClassHash , ContractAddress , EntryPointSelector } ;
99use starknet_api:: deprecated_contract_class:: {
1010 ContractClass as DeprecatedContractClass ,
1111 EntryPointOffset ,
@@ -20,6 +20,7 @@ use crate::test_utils::struct_impls::LoadContractFromFile;
2020
2121pub trait FeatureContractTrait {
2222 fn get_class ( & self ) -> ContractClass ;
23+ fn get_real_compiled_class_hash ( & self ) -> CompiledClassHash ;
2324 fn get_runnable_class ( & self ) -> RunnableCompiledClass ;
2425
2526 /// Fetch PC locations from the compiled contract to compute the expected PC locations in the
@@ -91,6 +92,18 @@ fn get_class_for_feature_contract(feature_contract: FeatureContract) -> Contract
9192 }
9293}
9394
95+ #[ cached]
96+ fn get_real_compiled_class_hash_for_feature_contract (
97+ feature_contract : FeatureContract ,
98+ ) -> CompiledClassHash {
99+ match get_class_for_feature_contract ( feature_contract) {
100+ ContractClass :: V0 ( _) => {
101+ panic ! ( "V0 compiled class hash is not supported." )
102+ }
103+ ContractClass :: V1 ( ( class, _) ) => CompiledClassHash ( class. compiled_class_hash ( ) ) ,
104+ }
105+ }
106+
94107impl FeatureContractTrait for FeatureContract {
95108 fn get_class ( & self ) -> ContractClass {
96109 get_class_for_feature_contract ( * self )
@@ -106,6 +119,10 @@ impl FeatureContractTrait for FeatureContract {
106119
107120 self . get_class ( ) . try_into ( ) . unwrap ( )
108121 }
122+
123+ fn get_real_compiled_class_hash ( & self ) -> CompiledClassHash {
124+ get_real_compiled_class_hash_for_feature_contract ( * self )
125+ }
109126}
110127
111128/// The information needed to test a [FeatureContract].
0 commit comments