@@ -504,15 +504,15 @@ async fn test_execute_txs_inner_resources() {
504504 let version = StarknetVersion :: LATEST ;
505505 let mut raw_vc: RawVersionedConstants =
506506 serde_json:: from_str ( VersionedConstants :: json_str ( & version) . unwrap ( ) ) . unwrap ( ) ;
507- // TODO(Dori): L1Handler.
508- const N_TXS : usize = 5 ;
507+ const N_TXS : usize = 7 ;
509508
510509 // For linear factor measurements, it's not enough to just add one more calldata element; the
511510 // increase is not the same per element. The linear scale is on average.
512511 const INVOKE_SCALING_FACTOR : usize = 2 ;
513512 const DEPLOY_SCALING_FACTOR : usize = 2 ;
514513 const INVOKE_EXTRA_ARGS : usize = 10 ;
515514 const DEPLOY_EXTRA_ARGS : usize = 10 ;
515+ const L1_HANDLER_EXTRA_ARGS : usize = 10 ;
516516
517517 let OsResourcesTestSetup {
518518 stable_contract_address,
@@ -600,6 +600,28 @@ async fn test_execute_txs_inner_resources() {
600600 test_builder. add_deploy_account_tx ( deploy_tx_first) ;
601601 test_builder. add_deploy_account_tx ( deploy_tx_second) ;
602602
603+ // L1 handler.
604+ test_builder. add_l1_handler (
605+ stable_contract_address,
606+ "l1_handler" ,
607+ // From address, extra args length.
608+ calldata ! [ Felt :: from( 100 ) , Felt :: ZERO ] ,
609+ None ,
610+ ) ;
611+ test_builder. add_l1_handler (
612+ stable_contract_address,
613+ "l1_handler" ,
614+ // From address, extra args.
615+ Calldata ( Arc :: new (
616+ [
617+ vec ! [ Felt :: from( 100 ) , Felt :: from( L1_HANDLER_EXTRA_ARGS ) ] ,
618+ vec ! [ Felt :: ZERO ; L1_HANDLER_EXTRA_ARGS ] ,
619+ ]
620+ . concat ( ) ,
621+ ) ) ,
622+ None ,
623+ ) ;
624+
603625 // Execute the business logic and extract the business logic resources for each tx.
604626 let test_runner = test_builder. build ( ) . await ;
605627 let business_logic_resources: [ ExecutionResources ; N_TXS ] = test_runner
@@ -638,6 +660,8 @@ async fn test_execute_txs_inner_resources() {
638660 declare_constant,
639661 deploy_first,
640662 deploy_second,
663+ l1_handler_first,
664+ l1_handler_second,
641665 ] : [ ExecutionResources ; N_TXS ] = test_output
642666 . runner_output
643667 . txs_trace
@@ -664,6 +688,10 @@ async fn test_execute_txs_inner_resources() {
664688 let deploy_linear_factor = ( & ( & deploy_second - & deploy_first) . filter_unused_builtins ( )
665689 * DEPLOY_SCALING_FACTOR )
666690 . div_ceil ( DEPLOY_EXTRA_ARGS ) ;
691+ // L1 handler linear factor is unscaled.
692+ let l1_handler_linear_factor = ( & l1_handler_second - & l1_handler_first)
693+ . filter_unused_builtins ( )
694+ . div_ceil ( L1_HANDLER_EXTRA_ARGS ) ;
667695 raw_vc. os_resources . execute_txs_inner . extend ( [
668696 (
669697 TransactionType :: InvokeFunction ,
@@ -686,6 +714,13 @@ async fn test_execute_txs_inner_resources() {
686714 } ) ,
687715 } ) ,
688716 ) ,
717+ (
718+ TransactionType :: L1Handler ,
719+ VariableResourceParams :: WithFactor ( ResourcesParams {
720+ constant : ( & l1_handler_first - & l1_handler_linear_factor) . filter_unused_builtins ( ) ,
721+ calldata_factor : VariableCallDataFactor :: Unscaled ( l1_handler_linear_factor) ,
722+ } ) ,
723+ ) ,
689724 ] ) ;
690725
691726 // Verify computation.
0 commit comments