diff --git a/svm/src/transaction_account_state_info.rs b/svm/src/transaction_account_state_info.rs index 74d898b81adc10..123b572e758868 100644 --- a/svm/src/transaction_account_state_info.rs +++ b/svm/src/transaction_account_state_info.rs @@ -2,12 +2,12 @@ use { crate::account_rent_state::RentState, solana_sdk::{ account::ReadableAccount, - message::SanitizedMessage, native_loader, rent::Rent, transaction::Result, transaction_context::{IndexOfAccount, TransactionContext}, }, + solana_svm_transaction::svm_message::SVMMessage, }; #[derive(PartialEq, Debug)] @@ -19,7 +19,7 @@ impl TransactionAccountStateInfo { pub(crate) fn new( rent: &Rent, transaction_context: &TransactionContext, - message: &SanitizedMessage, + message: &impl SVMMessage, ) -> Vec { (0..message.account_keys().len()) .map(|i| { diff --git a/svm/src/transaction_processor.rs b/svm/src/transaction_processor.rs index c6ac4079dd33b4..8b1a30f1ad913b 100644 --- a/svm/src/transaction_processor.rs +++ b/svm/src/transaction_processor.rs @@ -42,14 +42,13 @@ use { hash::Hash, inner_instruction::{InnerInstruction, InnerInstructionsList}, instruction::{CompiledInstruction, TRANSACTION_LEVEL_STACK_HEIGHT}, - message::SanitizedMessage, pubkey::Pubkey, rent_collector::RentCollector, saturating_add_assign, - transaction::{self, SanitizedTransaction, TransactionError}, + transaction::{self, TransactionError}, transaction_context::{ExecutionRecord, TransactionContext}, }, - solana_svm_transaction::svm_message::SVMMessage, + solana_svm_transaction::{svm_message::SVMMessage, svm_transaction::SVMTransaction}, solana_timings::{ExecuteTimingType, ExecuteTimings}, solana_type_overrides::sync::{atomic::Ordering, Arc, RwLock, RwLockReadGuard}, solana_vote::vote_account::VoteAccountsHashMap, @@ -227,7 +226,7 @@ impl TransactionBatchProcessor { pub fn load_and_execute_sanitized_transactions( &self, callbacks: &CB, - sanitized_txs: &[SanitizedTransaction], + sanitized_txs: &[impl SVMTransaction], check_results: Vec, environment: &TransactionProcessingEnvironment, config: &TransactionProcessingConfig, @@ -360,11 +359,11 @@ impl TransactionBatchProcessor { } } - fn validate_fees( + fn validate_fees( &self, callbacks: &CB, account_overrides: Option<&AccountOverrides>, - sanitized_txs: &[impl core::borrow::Borrow], + sanitized_txs: &[impl core::borrow::Borrow], check_results: Vec, feature_set: &FeatureSet, fee_structure: &FeeStructure, @@ -376,7 +375,7 @@ impl TransactionBatchProcessor { .zip(check_results) .map(|(sanitized_tx, check_result)| { check_result.and_then(|checked_details| { - let message = sanitized_tx.borrow().message(); + let message = sanitized_tx.borrow(); self.validate_transaction_fee_payer( callbacks, account_overrides, @@ -483,15 +482,14 @@ impl TransactionBatchProcessor { /// to their usage counters, for the transactions with a valid blockhash or nonce. fn filter_executable_program_accounts( callbacks: &CB, - txs: &[SanitizedTransaction], + txs: &[impl SVMMessage], validation_results: &[TransactionValidationResult], program_owners: &[Pubkey], ) -> HashMap { let mut result: HashMap = HashMap::new(); validation_results.iter().zip(txs).for_each(|etx| { if let (Ok(_), tx) = etx { - tx.message() - .account_keys() + tx.account_keys() .iter() .for_each(|key| match result.entry(*key) { Entry::Occupied(mut entry) => { @@ -697,7 +695,7 @@ impl TransactionBatchProcessor { #[allow(clippy::too_many_arguments)] fn execute_loaded_transaction( &self, - tx: &SanitizedTransaction, + tx: &impl SVMTransaction, mut loaded_transaction: LoadedTransaction, execute_timings: &mut ExecuteTimings, error_metrics: &mut TransactionErrorMetrics, @@ -709,7 +707,7 @@ impl TransactionBatchProcessor { fn transaction_accounts_lamports_sum( accounts: &[(Pubkey, AccountSharedData)], - message: &SanitizedMessage, + message: &impl SVMMessage, ) -> Option { let mut lamports_sum = 0u128; for i in 0..message.account_keys().len() { @@ -725,7 +723,7 @@ impl TransactionBatchProcessor { .unwrap_or_default(); let lamports_before_tx = - transaction_accounts_lamports_sum(&transaction_accounts, tx.message()).unwrap_or(0); + transaction_accounts_lamports_sum(&transaction_accounts, tx).unwrap_or(0); let compute_budget = config .compute_budget @@ -741,7 +739,7 @@ impl TransactionBatchProcessor { transaction_context.set_signature(tx.signature()); let pre_account_state_info = - TransactionAccountStateInfo::new(&rent, &transaction_context, tx.message()); + TransactionAccountStateInfo::new(&rent, &transaction_context, tx); let log_collector = if config.recording_config.enable_log_recording { match config.log_messages_bytes_limit { @@ -777,7 +775,7 @@ impl TransactionBatchProcessor { let mut process_message_time = Measure::start("process_message_time"); let process_result = MessageProcessor::process_message( - tx.message(), + tx, &loaded_transaction.program_indices, &mut invoke_context, execute_timings, @@ -795,7 +793,7 @@ impl TransactionBatchProcessor { let mut status = process_result .and_then(|info| { let post_account_state_info = - TransactionAccountStateInfo::new(&rent, &transaction_context, tx.message()); + TransactionAccountStateInfo::new(&rent, &transaction_context, tx); TransactionAccountStateInfo::verify_changes( &pre_account_state_info, &post_account_state_info, @@ -842,7 +840,7 @@ impl TransactionBatchProcessor { } = transaction_context.into(); if status.is_ok() - && transaction_accounts_lamports_sum(&accounts, tx.message()) + && transaction_accounts_lamports_sum(&accounts, tx) .filter(|lamports_after_tx| lamports_before_tx == *lamports_after_tx) .is_none() { @@ -993,7 +991,7 @@ mod tests { fee::FeeDetails, fee_calculator::FeeCalculator, hash::Hash, - message::{LegacyMessage, Message, MessageHeader}, + message::{LegacyMessage, Message, MessageHeader, SanitizedMessage}, nonce, rent_collector::{RentCollector, RENT_EXEMPT_RENT_EPOCH}, rent_debits::RentDebits,