11use super :: {
22 CallInfo , CallResult , CallType , OrderedEvent , OrderedL2ToL1Message , TransactionExecutionContext ,
33} ;
4+ #[ cfg( feature = "cairo-native" ) ]
5+ use crate :: state:: StateDiff ;
46use crate :: {
57 definitions:: { block_context:: BlockContext , constants:: DEFAULT_ENTRY_POINT_SELECTOR } ,
68 runner:: StarknetRunner ,
@@ -23,11 +25,9 @@ use crate::{
2325 transaction:: error:: TransactionError ,
2426 utils:: {
2527 get_deployed_address_class_hash_at_address, parse_builtin_names,
26- validate_contract_deployed, Address ,
28+ validate_contract_deployed, Address , ClassHash ,
2729 } ,
2830} ;
29- #[ cfg( feature = "cairo-native" ) ]
30- use crate :: { state:: StateDiff , utils:: ClassHash } ;
3131use cairo_lang_sierra:: program:: Program as SierraProgram ;
3232use cairo_lang_starknet:: casm_contract_class:: { CasmContractClass , CasmContractEntryPoint } ;
3333use cairo_lang_starknet:: contract_class:: ContractEntryPoints ;
@@ -74,7 +74,7 @@ pub struct ExecutionEntryPoint {
7474 pub ( crate ) call_type : CallType ,
7575 pub ( crate ) contract_address : Address ,
7676 pub ( crate ) code_address : Option < Address > ,
77- pub ( crate ) class_hash : Option < [ u8 ; 32 ] > ,
77+ pub ( crate ) class_hash : Option < ClassHash > ,
7878 pub ( crate ) calldata : Vec < Felt252 > ,
7979 pub ( crate ) caller_address : Address ,
8080 pub ( crate ) entry_point_selector : Felt252 ,
@@ -90,7 +90,7 @@ impl ExecutionEntryPoint {
9090 caller_address : Address ,
9191 entry_point_type : EntryPointType ,
9292 call_type : Option < CallType > ,
93- class_hash : Option < [ u8 ; 32 ] > ,
93+ class_hash : Option < ClassHash > ,
9494 initial_gas : u128 ,
9595 ) -> Self {
9696 ExecutionEntryPoint {
@@ -126,7 +126,7 @@ impl ExecutionEntryPoint {
126126 T : StateReader ,
127127 {
128128 // lookup the compiled class from the state.
129- let class_hash = self . get_code_class_hash ( state) ?;
129+ let class_hash = self . get_class_hash ( state) ?;
130130 let contract_class = state
131131 . get_contract_class ( & class_hash)
132132 . map_err ( |_| TransactionError :: MissingCompiledClass ) ?;
@@ -236,7 +236,7 @@ impl ExecutionEntryPoint {
236236 fn get_selected_entry_point_v0 (
237237 & self ,
238238 contract_class : & ContractClass ,
239- _class_hash : [ u8 ; 32 ] ,
239+ _class_hash : ClassHash ,
240240 ) -> Result < ContractEntryPoint , TransactionError > {
241241 let entry_points = contract_class
242242 . entry_points_by_type
@@ -267,7 +267,7 @@ impl ExecutionEntryPoint {
267267 fn get_selected_entry_point (
268268 & self ,
269269 contract_class : & CasmContractClass ,
270- _class_hash : [ u8 ; 32 ] ,
270+ _class_hash : ClassHash ,
271271 ) -> Result < CasmContractEntryPoint , TransactionError > {
272272 let entry_points = match self . entry_point_type {
273273 EntryPointType :: External => & contract_class. entry_points_by_type . external ,
@@ -312,7 +312,7 @@ impl ExecutionEntryPoint {
312312 call_type : Some ( self . call_type . clone ( ) ) ,
313313 contract_address : self . contract_address . clone ( ) ,
314314 code_address : self . code_address . clone ( ) ,
315- class_hash : Some ( self . get_code_class_hash ( starknet_storage_state. state ) ?) ,
315+ class_hash : Some ( self . get_class_hash ( starknet_storage_state. state ) ?) ,
316316 entry_point_selector : Some ( self . entry_point_selector . clone ( ) ) ,
317317 entry_point_type : Some ( self . entry_point_type ) ,
318318 calldata : self . calldata . clone ( ) ,
@@ -345,7 +345,7 @@ impl ExecutionEntryPoint {
345345 call_type : Some ( self . call_type . clone ( ) ) ,
346346 contract_address : self . contract_address . clone ( ) ,
347347 code_address : self . code_address . clone ( ) ,
348- class_hash : Some ( self . get_code_class_hash ( starknet_storage_state. state ) ?) ,
348+ class_hash : Some ( self . get_class_hash ( starknet_storage_state. state ) ?) ,
349349 entry_point_selector : Some ( self . entry_point_selector . clone ( ) ) ,
350350 entry_point_type : Some ( self . entry_point_type ) ,
351351 calldata : self . calldata . clone ( ) ,
@@ -366,7 +366,7 @@ impl ExecutionEntryPoint {
366366 }
367367
368368 /// Returns the hash of the executed contract class.
369- fn get_code_class_hash < S : State > ( & self , state : & mut S ) -> Result < [ u8 ; 32 ] , TransactionError > {
369+ fn get_class_hash < S : State > ( & self , state : & mut S ) -> Result < ClassHash , TransactionError > {
370370 if let Some ( class_hash) = self . class_hash {
371371 match self . call_type {
372372 CallType :: Delegate => return Ok ( class_hash) ,
@@ -394,7 +394,7 @@ impl ExecutionEntryPoint {
394394 block_context : & BlockContext ,
395395 tx_execution_context : & mut TransactionExecutionContext ,
396396 contract_class : Arc < ContractClass > ,
397- class_hash : [ u8 ; 32 ] ,
397+ class_hash : ClassHash ,
398398 ) -> Result < CallInfo , TransactionError > {
399399 let previous_cairo_usage = resources_manager. cairo_usage . clone ( ) ;
400400 // fetch selected entry point
@@ -499,7 +499,7 @@ impl ExecutionEntryPoint {
499499 block_context : & BlockContext ,
500500 tx_execution_context : & mut TransactionExecutionContext ,
501501 contract_class : Arc < CasmContractClass > ,
502- class_hash : [ u8 ; 32 ] ,
502+ class_hash : ClassHash ,
503503 support_reverted : bool ,
504504 ) -> Result < CallInfo , TransactionError > {
505505 let previous_cairo_usage = resources_manager. cairo_usage . clone ( ) ;
@@ -666,7 +666,7 @@ impl ExecutionEntryPoint {
666666 sierra_program_and_entrypoints : Arc < ( SierraProgram , ContractEntryPoints ) > ,
667667 tx_execution_context : & TransactionExecutionContext ,
668668 block_context : & BlockContext ,
669- class_hash : & [ u8 ; 32 ] ,
669+ class_hash : & ClassHash ,
670670 program_cache : Rc < RefCell < ProgramCache < ' _ , ClassHash > > > ,
671671 ) -> Result < CallInfo , TransactionError > {
672672 use crate :: {
@@ -826,9 +826,7 @@ impl ExecutionEntryPoint {
826826 call_type : Some ( self . call_type . clone ( ) ) ,
827827 contract_address : self . contract_address . clone ( ) ,
828828 code_address : self . code_address . clone ( ) ,
829- class_hash : Some (
830- self . get_code_class_hash ( syscall_handler. starknet_storage_state . state ) ?,
831- ) ,
829+ class_hash : Some ( self . get_class_hash ( syscall_handler. starknet_storage_state . state ) ?) ,
832830 entry_point_selector : Some ( self . entry_point_selector . clone ( ) ) ,
833831 entry_point_type : Some ( self . entry_point_type ) ,
834832 calldata : self . calldata . clone ( ) ,
0 commit comments