From 193173b29d40c1c827840d01aeac240600939aed Mon Sep 17 00:00:00 2001 From: Pankaj Garg Date: Wed, 6 Mar 2024 05:15:19 -0800 Subject: [PATCH] fix tests --- ledger-tool/src/program.rs | 7 ++++++- program-runtime/src/invoke_context.rs | 19 ++++++++++++++++++- programs/bpf_loader/src/lib.rs | 11 +++++++++-- 3 files changed, 33 insertions(+), 4 deletions(-) diff --git a/ledger-tool/src/program.rs b/ledger-tool/src/program.rs index ceb2814bffdbcb..27519deea963a8 100644 --- a/ledger-tool/src/program.rs +++ b/ledger-tool/src/program.rs @@ -21,11 +21,12 @@ use { }, solana_runtime::bank::Bank, solana_sdk::{ - account::AccountSharedData, + account::{create_account_shared_data_for_test, AccountSharedData}, account_utils::StateMut, bpf_loader_upgradeable::{self, UpgradeableLoaderState}, pubkey::Pubkey, slot_history::Slot, + sysvar, transaction_context::{IndexOfAccount, InstructionAccount}, }, std::{ @@ -510,6 +511,10 @@ pub fn program(ledger_path: &Path, matches: &ArgMatches<'_>) { program_id, // ID of the loaded program. It can modify accounts with the same owner key AccountSharedData::new(0, 0, &loader_id), )); + transaction_accounts.push(( + sysvar::epoch_schedule::id(), + create_account_shared_data_for_test(bank.epoch_schedule()), + )); let interpreted = matches.value_of("mode").unwrap() != "jit"; with_mock_invoke_context!(invoke_context, transaction_context, transaction_accounts); diff --git a/program-runtime/src/invoke_context.rs b/program-runtime/src/invoke_context.rs index 882938f3ebe2ac..c64165d9753c03 100644 --- a/program-runtime/src/invoke_context.rs +++ b/program-runtime/src/invoke_context.rs @@ -19,9 +19,10 @@ use { vm::{Config, ContextObject, EbpfVm}, }, solana_sdk::{ - account::AccountSharedData, + account::{create_account_shared_data_for_test, AccountSharedData}, bpf_loader_deprecated, clock::Slot, + epoch_schedule::EpochSchedule, feature_set::FeatureSet, hash::Hash, instruction::{AccountMeta, InstructionError}, @@ -29,6 +30,7 @@ use { pubkey::Pubkey, saturating_add_assign, stable_layout::stable_instruction::StableInstruction, + sysvar, transaction_context::{ IndexOfAccount, InstructionAccount, TransactionAccount, TransactionContext, }, @@ -727,6 +729,18 @@ pub fn mock_process_instruction