@@ -462,19 +462,25 @@ use {
462462 program:: ProgramCache , sysvar:: Sysvars ,
463463 } ,
464464 agave_feature_set:: FeatureSet ,
465+ agave_syscalls:: {
466+ create_program_runtime_environment_v1, create_program_runtime_environment_v2,
467+ } ,
465468 mollusk_svm_error:: error:: { MolluskError , MolluskPanic } ,
466469 mollusk_svm_result:: { Check , CheckContext , Config , InstructionResult } ,
467- solana_account:: Account ,
470+ solana_account:: { Account , ReadableAccount } ,
468471 solana_compute_budget:: compute_budget:: ComputeBudget ,
469472 solana_hash:: Hash ,
470473 solana_instruction:: { AccountMeta , Instruction } ,
471- solana_program_runtime:: invoke_context:: { EnvironmentConfig , InvokeContext } ,
474+ solana_program_runtime:: {
475+ invoke_context:: { EnvironmentConfig , InvokeContext } ,
476+ loaded_programs:: ProgramRuntimeEnvironments ,
477+ } ,
472478 solana_pubkey:: Pubkey ,
473479 solana_svm_callback:: InvokeContextCallback ,
474480 solana_svm_log_collector:: LogCollector ,
475481 solana_svm_timings:: ExecuteTimings ,
476482 solana_transaction_context:: TransactionContext ,
477- std:: { cell:: RefCell , collections:: HashSet , iter:: once, rc:: Rc } ,
483+ std:: { cell:: RefCell , collections:: HashSet , iter:: once, rc:: Rc , sync :: Arc } ,
478484} ;
479485
480486pub ( crate ) const DEFAULT_LOADER_KEY : Pubkey = solana_sdk_ids:: bpf_loader_upgradeable:: id ( ) ;
@@ -539,7 +545,7 @@ impl Default for Mollusk {
539545 solana_runtime::message_processor=debug,\
540546 solana_runtime::system_instruction_processor=trace",
541547 ) ;
542- let compute_budget = ComputeBudget :: new_with_defaults ( true ) ;
548+ let compute_budget = ComputeBudget :: new_with_defaults ( true , true ) ;
543549
544550 #[ cfg( feature = "fuzz" ) ]
545551 let feature_set = {
@@ -719,8 +725,26 @@ impl Mollusk {
719725 epoch_stake : & self . epoch_stake ,
720726 feature_set : & self . feature_set ,
721727 } ;
728+ let execution_budget = self . compute_budget . to_budget ( ) ;
722729 let runtime_features = self . feature_set . runtime_features ( ) ;
723730 let sysvar_cache = self . sysvars . setup_sysvar_cache ( accounts) ;
731+
732+ let program_runtime_environments = ProgramRuntimeEnvironments {
733+ program_runtime_v1 : Arc :: new (
734+ create_program_runtime_environment_v1 (
735+ & runtime_features,
736+ & execution_budget,
737+ /* reject_deployment_of_broken_elfs */ false ,
738+ /* debugging_features */ false ,
739+ )
740+ . unwrap ( ) ,
741+ ) ,
742+ program_runtime_v2 : Arc :: new ( create_program_runtime_environment_v2 (
743+ & execution_budget,
744+ /* debugging_features */ false ,
745+ ) ) ,
746+ } ;
747+
724748 let mut invoke_context = InvokeContext :: new (
725749 & mut transaction_context,
726750 & mut program_cache,
@@ -729,6 +753,8 @@ impl Mollusk {
729753 /* blockhash_lamports_per_signature */ 5000 , // The default value
730754 & callback,
731755 & runtime_features,
756+ & program_runtime_environments,
757+ & program_runtime_environments,
732758 & sysvar_cache,
733759 ) ,
734760 self . logger . clone ( ) ,
@@ -742,7 +768,7 @@ impl Mollusk {
742768 . configure_next_instruction_for_tests (
743769 program_id_index,
744770 instruction_accounts. clone ( ) ,
745- & instruction. data ,
771+ instruction. data . clone ( ) ,
746772 )
747773 . expect ( "failed to configure next instruction" ) ;
748774
@@ -780,12 +806,15 @@ impl Mollusk {
780806 transaction_context
781807 . find_index_of_account ( pubkey)
782808 . map ( |index| {
783- let resulting_account = transaction_context
784- . accounts ( )
785- . try_borrow ( index)
786- . unwrap ( )
787- . clone ( )
788- . into ( ) ;
809+ let account_ref =
810+ transaction_context. accounts ( ) . try_borrow ( index) . unwrap ( ) ;
811+ let resulting_account = Account {
812+ lamports : account_ref. lamports ( ) ,
813+ data : account_ref. data ( ) . to_vec ( ) ,
814+ owner : * account_ref. owner ( ) ,
815+ executable : account_ref. executable ( ) ,
816+ rent_epoch : account_ref. rent_epoch ( ) ,
817+ } ;
789818 ( * pubkey, resulting_account)
790819 } )
791820 . unwrap_or ( ( * pubkey, account. clone ( ) ) )
0 commit comments