diff --git a/runtime-transaction/src/runtime_transaction.rs b/runtime-transaction/src/runtime_transaction.rs index 24bb512b203a0d..c8a15b6fbc7b7a 100644 --- a/runtime-transaction/src/runtime_transaction.rs +++ b/runtime-transaction/src/runtime_transaction.rs @@ -20,12 +20,16 @@ use { solana_sdk::{ feature_set::FeatureSet, hash::Hash, - message::{AddressLoader, TransactionSignatureDetails}, + message::{AccountKeys, AddressLoader, TransactionSignatureDetails}, pubkey::Pubkey, + signature::Signature, simple_vote_transaction_checker::is_simple_vote_transaction, transaction::{Result, SanitizedTransaction, SanitizedVersionedTransaction}, }, - solana_svm_transaction::instruction::SVMInstruction, + solana_svm_transaction::{ + instruction::SVMInstruction, message_address_table_lookup::SVMMessageAddressTableLookup, + svm_message::SVMMessage, svm_transaction::SVMTransaction, + }, std::collections::HashSet, }; @@ -153,6 +157,71 @@ impl RuntimeTransaction { } } +impl SVMMessage for RuntimeTransaction { + // override to access from the cached meta instead of re-calculating + fn num_total_signatures(&self) -> u64 { + self.meta.signature_details.total_signatures() + } + + fn num_write_locks(&self) -> u64 { + self.transaction.num_write_locks() + } + + fn recent_blockhash(&self) -> &Hash { + self.transaction.recent_blockhash() + } + + fn num_instructions(&self) -> usize { + self.transaction.num_instructions() + } + + fn instructions_iter(&self) -> impl Iterator { + self.transaction.instructions_iter() + } + + fn program_instructions_iter(&self) -> impl Iterator { + self.transaction.program_instructions_iter() + } + + fn account_keys(&self) -> AccountKeys { + self.transaction.account_keys() + } + + fn fee_payer(&self) -> &Pubkey { + self.transaction.fee_payer() + } + + fn is_writable(&self, index: usize) -> bool { + self.transaction.is_writable(index) + } + + fn is_signer(&self, index: usize) -> bool { + self.transaction.is_signer(index) + } + + fn is_invoked(&self, key_index: usize) -> bool { + self.transaction.is_invoked(key_index) + } + + fn num_lookup_tables(&self) -> usize { + self.transaction.num_lookup_tables() + } + + fn message_address_table_lookups(&self) -> impl Iterator { + self.transaction.message_address_table_lookups() + } +} + +impl SVMTransaction for RuntimeTransaction { + fn signature(&self) -> &Signature { + self.transaction.signature() + } + + fn signatures(&self) -> &[Signature] { + self.transaction.signatures() + } +} + #[cfg(test)] mod tests { use {