diff --git a/Cargo.lock b/Cargo.lock index e5b7dedfff1755..91c871db969d80 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5423,7 +5423,6 @@ dependencies = [ "solana-measure", "solana-metrics", "solana-nohash-hasher", - "solana-program-runtime", "solana-rayon-threadlimit", "solana-sdk", "solana-stake-program", diff --git a/accounts-db/Cargo.toml b/accounts-db/Cargo.toml index 642d667a8c9806..fd902c71364d79 100644 --- a/accounts-db/Cargo.toml +++ b/accounts-db/Cargo.toml @@ -41,7 +41,6 @@ solana-inline-spl = { workspace = true } solana-measure = { workspace = true } solana-metrics = { workspace = true } solana-nohash-hasher = { workspace = true } -solana-program-runtime = { workspace = true } solana-rayon-threadlimit = { workspace = true } solana-sdk = { workspace = true } solana-stake-program = { workspace = true, optional = true } @@ -84,7 +83,6 @@ dev-context-only-utils = ["dep:qualifier_attr", "dep:solana-stake-program", "dep frozen-abi = [ "dep:solana-frozen-abi", "dep:solana-frozen-abi-macro", - "solana-program-runtime/frozen-abi", "solana-sdk/frozen-abi", "solana-svm/frozen-abi", "solana-vote-program/frozen-abi", diff --git a/accounts-db/src/accounts.rs b/accounts-db/src/accounts.rs index 775b78aec78dc9..67fde4ce30394b 100644 --- a/accounts-db/src/accounts.rs +++ b/accounts-db/src/accounts.rs @@ -826,7 +826,6 @@ mod tests { use { super::*, assert_matches::assert_matches, - solana_program_runtime::loaded_programs::ProgramCacheForTxBatch, solana_sdk::{ account::{AccountSharedData, WritableAccount}, address_lookup_table::state::LookupTableMeta, @@ -878,7 +877,7 @@ mod tests { executed_units: 0, accounts_data_len_delta: 0, }, - programs_modified_by_tx: Box::::default(), + programs_modified_by_tx: HashMap::new(), } } diff --git a/program-runtime/src/loaded_programs.rs b/program-runtime/src/loaded_programs.rs index 9728fe274e65e0..3fc4b5639619aa 100644 --- a/program-runtime/src/loaded_programs.rs +++ b/program-runtime/src/loaded_programs.rs @@ -716,6 +716,14 @@ impl ProgramCacheForTxBatch { } } + pub fn entries(&self) -> &HashMap> { + &self.entries + } + + pub fn take_entries(&mut self) -> HashMap> { + std::mem::take(&mut self.entries) + } + /// Returns the current environments depending on the given epoch pub fn get_environments_for_epoch(&self, epoch: Epoch) -> &ProgramRuntimeEnvironments { if epoch != self.latest_root_epoch { @@ -764,8 +772,8 @@ impl ProgramCacheForTxBatch { self.slot = slot; } - pub fn merge(&mut self, other: &Self) { - other.entries.iter().for_each(|(key, entry)| { + pub fn merge(&mut self, modified_entries: &HashMap>) { + modified_entries.iter().for_each(|(key, entry)| { self.merged_modified = true; self.replenish(*key, entry.clone()); }) @@ -1156,8 +1164,8 @@ impl ProgramCache { } } - pub fn merge(&mut self, tx_batch_cache: &ProgramCacheForTxBatch) { - tx_batch_cache.entries.iter().for_each(|(key, entry)| { + pub fn merge(&mut self, modified_entries: &HashMap>) { + modified_entries.iter().for_each(|(key, entry)| { self.assign_program(*key, entry.clone()); }) } diff --git a/programs/sbf/Cargo.lock b/programs/sbf/Cargo.lock index 1b01bf6789117a..efe3ba5385150b 100644 --- a/programs/sbf/Cargo.lock +++ b/programs/sbf/Cargo.lock @@ -4583,7 +4583,6 @@ dependencies = [ "solana-measure", "solana-metrics", "solana-nohash-hasher", - "solana-program-runtime", "solana-rayon-threadlimit", "solana-sdk", "solana-svm", diff --git a/runtime/src/bank/builtins/core_bpf_migration/mod.rs b/runtime/src/bank/builtins/core_bpf_migration/mod.rs index 53ee35a95421c5..2ebe6c997844bc 100644 --- a/runtime/src/bank/builtins/core_bpf_migration/mod.rs +++ b/runtime/src/bank/builtins/core_bpf_migration/mod.rs @@ -232,7 +232,7 @@ impl Bank { .program_cache .write() .unwrap() - .merge(&programs_modified); + .merge(programs_modified.entries()); Ok(()) } diff --git a/runtime/src/bank/tests.rs b/runtime/src/bank/tests.rs index 0ca7e3b1ef2b71..3edbda65ffe3f2 100644 --- a/runtime/src/bank/tests.rs +++ b/runtime/src/bank/tests.rs @@ -43,7 +43,7 @@ use { solana_logger, solana_program_runtime::{ declare_process_instruction, - loaded_programs::{ProgramCacheEntry, ProgramCacheEntryType, ProgramCacheForTxBatch}, + loaded_programs::{ProgramCacheEntry, ProgramCacheEntryType}, timings::ExecuteTimings, }, solana_sdk::{ @@ -247,7 +247,7 @@ fn new_execution_result( executed_units: 0, accounts_data_len_delta: 0, }, - programs_modified_by_tx: Box::::default(), + programs_modified_by_tx: HashMap::new(), } } diff --git a/svm/src/transaction_processor.rs b/svm/src/transaction_processor.rs index 35b8b83cd1dbfc..9efb5e7281cb41 100644 --- a/svm/src/transaction_processor.rs +++ b/svm/src/transaction_processor.rs @@ -868,7 +868,7 @@ impl TransactionBatchProcessor { executed_units, accounts_data_len_delta, }, - programs_modified_by_tx: Box::new(programs_modified_by_tx), + programs_modified_by_tx: programs_modified_by_tx.take_entries(), } } diff --git a/svm/src/transaction_results.rs b/svm/src/transaction_results.rs index c02187028e860b..1fcc9f7ce4b7c5 100644 --- a/svm/src/transaction_results.rs +++ b/svm/src/transaction_results.rs @@ -6,13 +6,15 @@ pub use solana_sdk::inner_instruction::{InnerInstruction, InnerInstructionsList}; use { serde::{Deserialize, Serialize}, - solana_program_runtime::loaded_programs::ProgramCacheForTxBatch, + solana_program_runtime::loaded_programs::ProgramCacheEntry, solana_sdk::{ fee::FeeDetails, + pubkey::Pubkey, rent_debits::RentDebits, transaction::{self, TransactionError}, transaction_context::TransactionReturnData, }, + std::{collections::HashMap, sync::Arc}, }; pub struct TransactionResults { @@ -42,7 +44,7 @@ pub struct TransactionLoadedAccountsStats { pub enum TransactionExecutionResult { Executed { details: TransactionExecutionDetails, - programs_modified_by_tx: Box, + programs_modified_by_tx: HashMap>, }, NotExecuted(TransactionError), }