@@ -74,7 +74,7 @@ pub extern "C" fn cairoVMCall(
7474 block_info_ptr : * const BlockInfo ,
7575 reader_handle : usize ,
7676 chain_id : * const c_char ,
77- _max_steps : c_ulonglong , //todo: enforce this
77+ max_steps : c_ulonglong ,
7878) {
7979 let block_info = unsafe { * block_info_ptr } ;
8080 let call_info = unsafe { * call_info_ptr } ;
@@ -114,7 +114,7 @@ pub extern "C" fn cairoVMCall(
114114 let mut resources = ExecutionResources :: default ( ) ;
115115 let context = EntryPointExecutionContext :: new_invoke (
116116 Arc :: new ( TransactionContext {
117- block_context : build_block_context ( & mut state, & block_info, chain_id_str) ,
117+ block_context : build_block_context ( & mut state, & block_info, chain_id_str, Some ( max_steps ) ) ,
118118 tx_info : TransactionInfo :: Deprecated ( DeprecatedTransactionInfo :: default ( ) ) ,
119119 } ) ,
120120 false ,
@@ -189,7 +189,7 @@ pub extern "C" fn cairoVMExecute(
189189 let mut state = CachedState :: new ( reader, GlobalContractCache :: new ( 1 ) ) ;
190190 let txns_and_query_bits = txns_and_query_bits. unwrap ( ) ;
191191 let mut classes = classes. unwrap ( ) ;
192- let block_context: BlockContext = build_block_context ( & mut state, & block_info, chain_id_str) ;
192+ let block_context: BlockContext = build_block_context ( & mut state, & block_info, chain_id_str, None ) ;
193193 let charge_fee = skip_charge_fee == 0 ;
194194 let validate = skip_validate == 0 ;
195195
@@ -378,6 +378,7 @@ fn build_block_context(
378378 state : & mut dyn State ,
379379 block_info : & BlockInfo ,
380380 chain_id_str : & str ,
381+ max_steps : Option < c_ulonglong > ,
381382) -> BlockContext {
382383 let sequencer_addr = StarkFelt :: new ( block_info. sequencer_address ) . unwrap ( ) ;
383384 let gas_price_wei_felt = StarkFelt :: new ( block_info. gas_price_wei ) . unwrap ( ) ;
@@ -393,6 +394,11 @@ fn build_block_context(
393394 hash : BlockHash ( StarkFelt :: new ( block_info. block_hash_to_be_revealed ) . unwrap ( ) ) ,
394395 } )
395396 }
397+ let mut constants = get_versioned_constants ( block_info. version ) ;
398+ if let Some ( max_steps) = max_steps {
399+ constants. invoke_tx_max_n_steps = max_steps as u32 ;
400+ }
401+
396402 pre_process_block ( state, old_block_number_and_hash, BlockifierBlockInfo {
397403 block_number : starknet_api:: block:: BlockNumber ( block_info. block_number ) ,
398404 block_timestamp : starknet_api:: block:: BlockTimestamp ( block_info. block_timestamp ) ,
@@ -411,7 +417,7 @@ fn build_block_context(
411417 eth_fee_token_address : ContractAddress :: try_from ( StarkHash :: try_from ( "0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7" ) . unwrap ( ) ) . unwrap ( ) ,
412418 strk_fee_token_address : ContractAddress :: try_from ( StarkHash :: try_from ( "0x04718f5a0fc34cc1af16a1cdee98ffb20c31f5cd61d6ab07201858f4287c938d" ) . unwrap ( ) ) . unwrap ( ) ,
413419 } ,
414- } , get_versioned_constants ( block_info . version ) ) . unwrap ( )
420+ } , constants ) . unwrap ( )
415421}
416422
417423
0 commit comments