File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed
crates/starknet_os/src/hint_processor Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -47,6 +47,8 @@ pub enum OsLoggerError {
47
47
DoubleFinalize ,
48
48
#[ error( "Failed to fetch identifier data for struct {0}." ) ]
49
49
InnerBuiltinPtrsIdentifierMissing ( String ) ,
50
+ #[ error( "No transaction should call another transaction." ) ]
51
+ InTxContext ,
50
52
#[ error( "{0}" ) ]
51
53
MissingBuiltinPtr ( String ) ,
52
54
#[ error( "The `members` field is None in identifier data for struct {0}." ) ]
@@ -462,4 +464,32 @@ impl OsLogger {
462
464
463
465
Ok ( ( ) )
464
466
}
467
+
468
+ #[ allow( clippy:: too_many_arguments) ]
469
+ pub fn enter_tx (
470
+ & mut self ,
471
+ tx_type : TransactionType ,
472
+ tx_hash : TransactionHash ,
473
+ n_steps : usize ,
474
+ range_check_ptr : Relocatable ,
475
+ ids_data : & HashMap < String , HintReference > ,
476
+ vm : & VirtualMachine ,
477
+ ap_tracking : & ApTracking ,
478
+ os_program : & Program ,
479
+ ) -> OsLoggerResult < ( ) > {
480
+ if self . current_tx . is_some ( ) {
481
+ return Err ( OsLoggerError :: InTxContext ) ;
482
+ }
483
+ self . resource_counter_stack . push ( ResourceCounter :: new (
484
+ n_steps,
485
+ range_check_ptr,
486
+ ids_data,
487
+ vm,
488
+ ap_tracking,
489
+ os_program,
490
+ ) ?) ;
491
+ self . current_tx = Some ( OsTransactionTrace :: new ( tx_type, tx_hash) ) ;
492
+ self . log ( & format ! ( "Entering {tx_type:?}: {tx_hash}." ) , true ) ;
493
+ Ok ( ( ) )
494
+ }
465
495
}
You can’t perform that action at this time.
0 commit comments