@@ -74,7 +74,7 @@ pub extern "C" fn cairoVMCall(
74
74
block_info_ptr : * const BlockInfo ,
75
75
reader_handle : usize ,
76
76
chain_id : * const c_char ,
77
- _max_steps : c_ulonglong , //todo: enforce this
77
+ max_steps : c_ulonglong ,
78
78
) {
79
79
let block_info = unsafe { * block_info_ptr } ;
80
80
let call_info = unsafe { * call_info_ptr } ;
@@ -114,7 +114,7 @@ pub extern "C" fn cairoVMCall(
114
114
let mut resources = ExecutionResources :: default ( ) ;
115
115
let context = EntryPointExecutionContext :: new_invoke (
116
116
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 ) ) ,
118
118
tx_info : TransactionInfo :: Deprecated ( DeprecatedTransactionInfo :: default ( ) ) ,
119
119
} ) ,
120
120
false ,
@@ -189,7 +189,7 @@ pub extern "C" fn cairoVMExecute(
189
189
let mut state = CachedState :: new ( reader, GlobalContractCache :: new ( 1 ) ) ;
190
190
let txns_and_query_bits = txns_and_query_bits. unwrap ( ) ;
191
191
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 ) ;
193
193
let charge_fee = skip_charge_fee == 0 ;
194
194
let validate = skip_validate == 0 ;
195
195
@@ -378,6 +378,7 @@ fn build_block_context(
378
378
state : & mut dyn State ,
379
379
block_info : & BlockInfo ,
380
380
chain_id_str : & str ,
381
+ max_steps : Option < c_ulonglong > ,
381
382
) -> BlockContext {
382
383
let sequencer_addr = StarkFelt :: new ( block_info. sequencer_address ) . unwrap ( ) ;
383
384
let gas_price_wei_felt = StarkFelt :: new ( block_info. gas_price_wei ) . unwrap ( ) ;
@@ -393,6 +394,11 @@ fn build_block_context(
393
394
hash : BlockHash ( StarkFelt :: new ( block_info. block_hash_to_be_revealed ) . unwrap ( ) ) ,
394
395
} )
395
396
}
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
+
396
402
pre_process_block ( state, old_block_number_and_hash, BlockifierBlockInfo {
397
403
block_number : starknet_api:: block:: BlockNumber ( block_info. block_number ) ,
398
404
block_timestamp : starknet_api:: block:: BlockTimestamp ( block_info. block_timestamp ) ,
@@ -411,7 +417,7 @@ fn build_block_context(
411
417
eth_fee_token_address : ContractAddress :: try_from ( StarkHash :: try_from ( "0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7" ) . unwrap ( ) ) . unwrap ( ) ,
412
418
strk_fee_token_address : ContractAddress :: try_from ( StarkHash :: try_from ( "0x04718f5a0fc34cc1af16a1cdee98ffb20c31f5cd61d6ab07201858f4287c938d" ) . unwrap ( ) ) . unwrap ( ) ,
413
419
} ,
414
- } , get_versioned_constants ( block_info . version ) ) . unwrap ( )
420
+ } , constants ) . unwrap ( )
415
421
}
416
422
417
423
0 commit comments