@@ -460,19 +460,25 @@ use {
460460 program:: ProgramCache , sysvar:: Sysvars ,
461461 } ,
462462 agave_feature_set:: FeatureSet ,
463+ agave_syscalls:: {
464+ create_program_runtime_environment_v1, create_program_runtime_environment_v2,
465+ } ,
463466 mollusk_svm_error:: error:: { MolluskError , MolluskPanic } ,
464467 mollusk_svm_result:: { Check , CheckContext , Config , InstructionResult } ,
465- solana_account:: { Account , AccountSharedData } ,
468+ solana_account:: { Account , AccountSharedData , ReadableAccount } ,
466469 solana_compute_budget:: compute_budget:: ComputeBudget ,
467470 solana_hash:: Hash ,
468471 solana_instruction:: { AccountMeta , Instruction } ,
469- solana_program_runtime:: invoke_context:: { EnvironmentConfig , InvokeContext } ,
472+ solana_program_runtime:: {
473+ invoke_context:: { EnvironmentConfig , InvokeContext } ,
474+ loaded_programs:: ProgramRuntimeEnvironments ,
475+ } ,
470476 solana_pubkey:: Pubkey ,
471477 solana_svm_callback:: InvokeContextCallback ,
472478 solana_svm_log_collector:: LogCollector ,
473479 solana_svm_timings:: ExecuteTimings ,
474- solana_transaction_context:: { InstructionAccount , TransactionContext } ,
475- std:: { cell:: RefCell , collections:: HashSet , iter:: once, rc:: Rc } ,
480+ solana_transaction_context:: TransactionContext ,
481+ std:: { cell:: RefCell , collections:: HashSet , iter:: once, rc:: Rc , sync :: Arc } ,
476482} ;
477483
478484pub ( crate ) const DEFAULT_LOADER_KEY : Pubkey = solana_sdk_ids:: bpf_loader_upgradeable:: id ( ) ;
@@ -537,7 +543,7 @@ impl Default for Mollusk {
537543 solana_runtime::message_processor=debug,\
538544 solana_runtime::system_instruction_processor=trace",
539545 ) ;
540- let compute_budget = ComputeBudget :: new_with_defaults ( true ) ;
546+ let compute_budget = ComputeBudget :: new_with_defaults ( true , true ) ;
541547
542548 #[ cfg( feature = "fuzz" ) ]
543549 let feature_set = {
@@ -713,8 +719,26 @@ impl Mollusk {
713719 epoch_stake : & self . epoch_stake ,
714720 feature_set : & self . feature_set ,
715721 } ;
722+ let execution_budget = self . compute_budget . to_budget ( ) ;
716723 let runtime_features = self . feature_set . runtime_features ( ) ;
717724 let sysvar_cache = self . sysvars . setup_sysvar_cache ( accounts) ;
725+
726+ let program_runtime_environments = ProgramRuntimeEnvironments {
727+ program_runtime_v1 : Arc :: new (
728+ create_program_runtime_environment_v1 (
729+ & runtime_features,
730+ & execution_budget,
731+ /* reject_deployment_of_broken_elfs */ false ,
732+ /* debugging_features */ false ,
733+ )
734+ . unwrap ( ) ,
735+ ) ,
736+ program_runtime_v2 : Arc :: new ( create_program_runtime_environment_v2 (
737+ & execution_budget,
738+ /* debugging_features */ false ,
739+ ) ) ,
740+ } ;
741+
718742 let mut invoke_context = InvokeContext :: new (
719743 & mut transaction_context,
720744 & mut program_cache,
@@ -723,6 +747,8 @@ impl Mollusk {
723747 /* blockhash_lamports_per_signature */ 5000 , // The default value
724748 & callback,
725749 & runtime_features,
750+ & program_runtime_environments,
751+ & program_runtime_environments,
726752 & sysvar_cache,
727753 ) ,
728754 self . logger . clone ( ) ,
@@ -736,7 +762,7 @@ impl Mollusk {
736762 . configure_next_instruction_for_tests (
737763 program_id_index,
738764 instruction_accounts. clone ( ) ,
739- & instruction. data ,
765+ instruction. data . clone ( ) ,
740766 )
741767 . expect ( "failed to configure next instruction" ) ;
742768
@@ -774,12 +800,15 @@ impl Mollusk {
774800 transaction_context
775801 . find_index_of_account ( pubkey)
776802 . map ( |index| {
777- let resulting_account = transaction_context
778- . accounts ( )
779- . try_borrow ( index)
780- . unwrap ( )
781- . clone ( )
782- . into ( ) ;
803+ let account_ref =
804+ transaction_context. accounts ( ) . try_borrow ( index) . unwrap ( ) ;
805+ let resulting_account = Account {
806+ lamports : account_ref. lamports ( ) ,
807+ data : account_ref. data ( ) . to_vec ( ) ,
808+ owner : * account_ref. owner ( ) ,
809+ executable : account_ref. executable ( ) ,
810+ rent_epoch : account_ref. rent_epoch ( ) ,
811+ } ;
783812 ( * pubkey, resulting_account)
784813 } )
785814 . unwrap_or ( ( * pubkey, account. clone ( ) ) )
0 commit comments