From 63cc4a672cb128510d2e3206151fccc51cec9b6d Mon Sep 17 00:00:00 2001 From: Kevin Heavey Date: Mon, 25 Aug 2025 18:08:50 +0100 Subject: [PATCH 1/5] re-export essential types in solana-transaction --- transaction/src/lib.rs | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/transaction/src/lib.rs b/transaction/src/lib.rs index 0bc14bbf5..94c320b16 100644 --- a/transaction/src/lib.rs +++ b/transaction/src/lib.rs @@ -110,26 +110,25 @@ //! # Ok::<(), anyhow::Error>(()) //! ``` +#[cfg(feature = "bincode")] +pub use solana_hash::Hash; +#[cfg(feature = "bincode")] +use solana_signer::{signers::Signers, SignerError}; #[cfg(feature = "serde")] use { serde_derive::{Deserialize, Serialize}, solana_short_vec as short_vec, }; -#[cfg(feature = "bincode")] -use { - solana_hash::Hash, - solana_signer::{signers::Signers, SignerError}, +pub use { + solana_instruction::{AccountMeta, Instruction}, + solana_message::{compiled_instruction::CompiledInstruction, Message, VersionedMessage}, + solana_pubkey::Pubkey, + solana_signature::Signature, }; use { - solana_instruction::Instruction, - solana_message::{ - compiled_instruction::CompiledInstruction, inline_nonce::is_advance_nonce_instruction_data, - Message, - }, - solana_pubkey::Pubkey, + solana_message::inline_nonce::is_advance_nonce_instruction_data, solana_sanitize::{Sanitize, SanitizeError}, solana_sdk_ids::system_program, - solana_signature::Signature, solana_transaction_error::{TransactionError, TransactionResult as Result}, std::result, }; From 56e6bb4457b624534a0634afec697e907f31219c Mon Sep 17 00:00:00 2001 From: Kevin Heavey Date: Mon, 25 Aug 2025 18:21:53 +0100 Subject: [PATCH 2/5] re-export transaction error types and don't alias TransactionResult in crate --- Cargo.lock | 1 + transaction/Cargo.toml | 1 + transaction/src/lib.rs | 14 +++++++++----- transaction/src/sanitized.rs | 16 ++++++++-------- 4 files changed, 19 insertions(+), 13 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a50ce5b6e..34b80033c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4056,6 +4056,7 @@ dependencies = [ "solana-frozen-abi-macro", "solana-hash", "solana-instruction", + "solana-instruction-error", "solana-keypair", "solana-logger", "solana-message", diff --git a/transaction/Cargo.toml b/transaction/Cargo.toml index 54105bbd4..56a6b893d 100644 --- a/transaction/Cargo.toml +++ b/transaction/Cargo.toml @@ -45,6 +45,7 @@ solana-frozen-abi = { workspace = true, optional = true } solana-frozen-abi-macro = { workspace = true, optional = true } solana-hash = { workspace = true } solana-instruction = { workspace = true } +solana-instruction-error = { workspace = true } solana-logger = { workspace = true, optional = true } solana-message = { workspace = true } solana-pubkey = { workspace = true } diff --git a/transaction/src/lib.rs b/transaction/src/lib.rs index 94c320b16..25b197eff 100644 --- a/transaction/src/lib.rs +++ b/transaction/src/lib.rs @@ -121,15 +121,16 @@ use { }; pub use { solana_instruction::{AccountMeta, Instruction}, + solana_instruction_error::InstructionError, solana_message::{compiled_instruction::CompiledInstruction, Message, VersionedMessage}, solana_pubkey::Pubkey, solana_signature::Signature, + solana_transaction_error::{TransactionError, TransactionResult}, }; use { solana_message::inline_nonce::is_advance_nonce_instruction_data, solana_sanitize::{Sanitize, SanitizeError}, solana_sdk_ids::system_program, - solana_transaction_error::{TransactionError, TransactionResult as Result}, std::result, }; @@ -975,7 +976,7 @@ impl Transaction { /// # Errors /// /// Returns [`TransactionError::SignatureFailure`] on error. - pub fn verify(&self) -> Result<()> { + pub fn verify(&self) -> TransactionResult<()> { let message_bytes = self.message_data(); if !self ._verify_with_results(&message_bytes) @@ -994,7 +995,7 @@ impl Transaction { /// # Errors /// /// Returns [`TransactionError::SignatureFailure`] on error. - pub fn verify_and_hash_message(&self) -> Result { + pub fn verify_and_hash_message(&self) -> TransactionResult { let message_bytes = self.message_data(); if !self ._verify_with_results(&message_bytes) @@ -1028,7 +1029,10 @@ impl Transaction { /// Get the positions of the pubkeys in `account_keys` associated with signing keypairs. /// /// [`account_keys`]: Message::account_keys - pub fn get_signing_keypair_positions(&self, pubkeys: &[Pubkey]) -> Result>> { + pub fn get_signing_keypair_positions( + &self, + pubkeys: &[Pubkey], + ) -> TransactionResult>> { if self.message.account_keys.len() < self.message.header.num_required_signatures as usize { return Err(TransactionError::InvalidAccountIndex); } @@ -1043,7 +1047,7 @@ impl Transaction { #[cfg(feature = "verify")] /// Replace all the signatures and pubkeys. - pub fn replace_signatures(&mut self, signers: &[(Pubkey, Signature)]) -> Result<()> { + pub fn replace_signatures(&mut self, signers: &[(Pubkey, Signature)]) -> TransactionResult<()> { let num_required_signatures = self.message.header.num_required_signatures as usize; if signers.len() != num_required_signatures || self.signatures.len() != num_required_signatures diff --git a/transaction/src/sanitized.rs b/transaction/src/sanitized.rs index 638885be3..304ef694f 100644 --- a/transaction/src/sanitized.rs +++ b/transaction/src/sanitized.rs @@ -9,7 +9,7 @@ use { }, solana_pubkey::Pubkey, solana_signature::Signature, - solana_transaction_error::{TransactionError, TransactionResult as Result}, + solana_transaction_error::{TransactionError, TransactionResult}, std::collections::HashSet, }; #[cfg(feature = "blake3")] @@ -61,7 +61,7 @@ impl SanitizedTransaction { is_simple_vote_tx: bool, address_loader: impl AddressLoader, reserved_account_keys: &HashSet, - ) -> Result { + ) -> TransactionResult { let signatures = tx.signatures; let SanitizedVersionedMessage { message } = tx.message; let message = match message { @@ -97,7 +97,7 @@ impl SanitizedTransaction { is_simple_vote_tx: Option, address_loader: impl AddressLoader, reserved_account_keys: &HashSet, - ) -> Result { + ) -> TransactionResult { let sanitized_versioned_tx = SanitizedVersionedTransaction::try_from(tx)?; let is_simple_vote_tx = is_simple_vote_tx.unwrap_or_else(|| { crate::simple_vote_transaction_checker::is_simple_vote_transaction( @@ -122,7 +122,7 @@ impl SanitizedTransaction { pub fn try_from_legacy_transaction( tx: Transaction, reserved_account_keys: &HashSet, - ) -> Result { + ) -> TransactionResult { tx.sanitize()?; Ok(Self { @@ -150,7 +150,7 @@ impl SanitizedTransaction { message_hash: Hash, is_simple_vote_tx: bool, signatures: Vec, - ) -> Result { + ) -> TransactionResult { VersionedTransaction::sanitize_signatures_inner( usize::from(message.header().num_required_signatures), message.static_account_keys().len(), @@ -216,7 +216,7 @@ impl SanitizedTransaction { pub fn get_account_locks( &self, tx_account_lock_limit: usize, - ) -> Result> { + ) -> TransactionResult> { Self::validate_account_locks(self.message(), tx_account_lock_limit)?; Ok(self.get_account_locks_unchecked()) } @@ -269,7 +269,7 @@ impl SanitizedTransaction { #[cfg(feature = "verify")] /// Verify the transaction signatures - pub fn verify(&self) -> Result<()> { + pub fn verify(&self) -> TransactionResult<()> { let message_bytes = self.message_data(); if self .signatures @@ -288,7 +288,7 @@ impl SanitizedTransaction { pub fn validate_account_locks( message: &SanitizedMessage, tx_account_lock_limit: usize, - ) -> Result<()> { + ) -> TransactionResult<()> { if message.has_duplicates() { Err(TransactionError::AccountLoadedTwice) } else if message.account_keys().len() > tx_account_lock_limit { From 522c7a73edd7921e968402d64436780123d19ba7 Mon Sep 17 00:00:00 2001 From: Kevin Heavey Date: Mon, 25 Aug 2025 18:23:08 +0100 Subject: [PATCH 3/5] re-export solana-signer items --- transaction/src/lib.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/transaction/src/lib.rs b/transaction/src/lib.rs index 25b197eff..8dafcda35 100644 --- a/transaction/src/lib.rs +++ b/transaction/src/lib.rs @@ -110,15 +110,16 @@ //! # Ok::<(), anyhow::Error>(()) //! ``` -#[cfg(feature = "bincode")] -pub use solana_hash::Hash; -#[cfg(feature = "bincode")] -use solana_signer::{signers::Signers, SignerError}; #[cfg(feature = "serde")] use { serde_derive::{Deserialize, Serialize}, solana_short_vec as short_vec, }; +#[cfg(feature = "bincode")] +pub use { + solana_hash::Hash, + solana_signer::{signers::Signers, SignerError}, +}; pub use { solana_instruction::{AccountMeta, Instruction}, solana_instruction_error::InstructionError, From fd30fc64b5bcb8d49590a18c82ef76d3b5be8d90 Mon Sep 17 00:00:00 2001 From: Kevin Heavey Date: Tue, 26 Aug 2025 08:14:12 +0100 Subject: [PATCH 4/5] switch to solana-address --- Cargo.lock | 1 + transaction/Cargo.toml | 2 +- transaction/src/lib.rs | 56 +++++++++---------- transaction/src/sanitized.rs | 20 +++---- .../src/simple_vote_transaction_checker.rs | 4 +- 5 files changed, 42 insertions(+), 41 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 34b80033c..ca5845eea 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4051,6 +4051,7 @@ dependencies = [ "borsh", "serde", "serde_derive", + "solana-address", "solana-example-mocks", "solana-frozen-abi", "solana-frozen-abi-macro", diff --git a/transaction/Cargo.toml b/transaction/Cargo.toml index 56a6b893d..3d688836f 100644 --- a/transaction/Cargo.toml +++ b/transaction/Cargo.toml @@ -41,6 +41,7 @@ verify = ["blake3", "solana-signature/verify"] bincode = { workspace = true, optional = true } serde = { workspace = true, optional = true } serde_derive = { workspace = true, optional = true } +solana-address = { workspace = true } solana-frozen-abi = { workspace = true, optional = true } solana-frozen-abi-macro = { workspace = true, optional = true } solana-hash = { workspace = true } @@ -48,7 +49,6 @@ solana-instruction = { workspace = true } solana-instruction-error = { workspace = true } solana-logger = { workspace = true, optional = true } solana-message = { workspace = true } -solana-pubkey = { workspace = true } solana-sanitize = { workspace = true } solana-sdk-ids = { workspace = true } solana-short-vec = { workspace = true, optional = true } diff --git a/transaction/src/lib.rs b/transaction/src/lib.rs index 8dafcda35..ef1137fff 100644 --- a/transaction/src/lib.rs +++ b/transaction/src/lib.rs @@ -124,7 +124,7 @@ pub use { solana_instruction::{AccountMeta, Instruction}, solana_instruction_error::InstructionError, solana_message::{compiled_instruction::CompiledInstruction, Message, VersionedMessage}, - solana_pubkey::Pubkey, + solana_address::Address, solana_signature::Signature, solana_transaction_error::{TransactionError, TransactionResult}, }; @@ -428,7 +428,7 @@ impl Transaction { /// # /// # Ok::<(), anyhow::Error>(()) /// ``` - pub fn new_with_payer(instructions: &[Instruction], payer: Option<&Pubkey>) -> Self { + pub fn new_with_payer(instructions: &[Instruction], payer: Option<&Address>) -> Self { let message = Message::new(instructions, payer); Self::new_unsigned(message) } @@ -510,7 +510,7 @@ impl Transaction { #[cfg(feature = "bincode")] pub fn new_signed_with_payer( instructions: &[Instruction], - payer: Option<&Pubkey>, + payer: Option<&Address>, signing_keypairs: &T, recent_blockhash: Hash, ) -> Self { @@ -536,9 +536,9 @@ impl Transaction { #[cfg(feature = "bincode")] pub fn new_with_compiled_instructions( from_keypairs: &T, - keys: &[Pubkey], + keys: &[Address], recent_blockhash: Hash, - program_ids: Vec, + program_ids: Vec
, instructions: Vec, ) -> Self { let mut account_keys = from_keypairs.pubkeys(); @@ -593,7 +593,7 @@ impl Transaction { /// Returns `None` if `instruction_index` is greater than or equal to the /// number of instructions in the transaction; or if `accounts_index` is /// greater than or equal to the number of accounts in the instruction. - pub fn key(&self, instruction_index: usize, accounts_index: usize) -> Option<&Pubkey> { + pub fn key(&self, instruction_index: usize, accounts_index: usize) -> Option<&Address> { self.key_index(instruction_index, accounts_index) .and_then(|account_keys_index| self.message.account_keys.get(account_keys_index)) } @@ -614,7 +614,7 @@ impl Transaction { /// Returns `None` if `instruction_index` is greater than or equal to the /// number of instructions in the transaction; or if `accounts_index` is /// greater than or equal to the number of accounts in the instruction. - pub fn signer_key(&self, instruction_index: usize, accounts_index: usize) -> Option<&Pubkey> { + pub fn signer_key(&self, instruction_index: usize, accounts_index: usize) -> Option<&Address> { match self.key_index(instruction_index, accounts_index) { None => None, Some(signature_index) => { @@ -1032,7 +1032,7 @@ impl Transaction { /// [`account_keys`]: Message::account_keys pub fn get_signing_keypair_positions( &self, - pubkeys: &[Pubkey], + pubkeys: &[Address], ) -> TransactionResult>> { if self.message.account_keys.len() < self.message.header.num_required_signatures as usize { return Err(TransactionError::InvalidAccountIndex); @@ -1048,7 +1048,7 @@ impl Transaction { #[cfg(feature = "verify")] /// Replace all the signatures and pubkeys. - pub fn replace_signatures(&mut self, signers: &[(Pubkey, Signature)]) -> TransactionResult<()> { + pub fn replace_signatures(&mut self, signers: &[(Address, Signature)]) -> TransactionResult<()> { let num_required_signatures = self.message.header.num_required_signatures as usize; if signers.len() != num_required_signatures || self.signatures.len() != num_required_signatures @@ -1114,7 +1114,7 @@ mod tests { std::mem::size_of, }; - fn get_program_id(tx: &Transaction, instruction_index: usize) -> &Pubkey { + fn get_program_id(tx: &Transaction, instruction_index: usize) -> &Address { let message = tx.message(); let instruction = &message.instructions[instruction_index]; instruction.program_id(&message.account_keys) @@ -1183,17 +1183,17 @@ mod tests { &[&key], &[], Hash::default(), - vec![Pubkey::default()], + vec![Address::default()], instructions, ); - assert_eq!(*get_program_id(&tx, 0), Pubkey::default()); + assert_eq!(*get_program_id(&tx, 0), Address::default()); assert_eq!(tx.sanitize(), Err(SanitizeError::IndexOutOfBounds)); } #[test] fn test_sanitize_txs() { let key = Keypair::new(); - let id0 = Pubkey::default(); + let id0 = Address::default(); let program_id = solana_pubkey::new_rand(); let ix = Instruction::new_with_bincode( program_id, @@ -1242,7 +1242,7 @@ mod tests { tx = o.clone(); tx.message.header.num_readonly_signed_accounts = 2; tx.message.header.num_readonly_unsigned_accounts = 3; - tx.message.account_keys.resize(4, Pubkey::default()); + tx.message.account_keys.resize(4, Address::default()); assert_eq!(tx.sanitize(), Err(SanitizeError::IndexOutOfBounds)); tx = o; @@ -1262,12 +1262,12 @@ mod tests { .as_ref(), ) .unwrap(); - let to = Pubkey::from([ + let to = Address::from([ 1, 1, 1, 4, 5, 6, 7, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 8, 7, 6, 5, 4, 1, 1, 1, ]); - let program_id = Pubkey::from([ + let program_id = Address::from([ 2, 2, 2, 4, 5, 6, 7, 8, 9, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 9, 8, 7, 6, 5, 4, 2, 2, 2, ]); @@ -1328,7 +1328,7 @@ mod tests { + num_required_sigs_size + num_readonly_accounts_size + len_size - + (tx.message.account_keys.len() * size_of::()) + + (tx.message.account_keys.len() * size_of::
()) + blockhash_size + len_size + expected_instruction_size; @@ -1376,7 +1376,7 @@ mod tests { let keypair = Keypair::new(); let fee_payer = solana_pubkey::new_rand(); let ix = Instruction::new_with_bincode( - Pubkey::default(), + Address::default(), &0, vec![AccountMeta::new(fee_payer, true)], ); @@ -1390,7 +1390,7 @@ mod tests { let keypair1 = Keypair::new(); let keypair2 = Keypair::new(); let ix = Instruction::new_with_bincode( - Pubkey::default(), + Address::default(), &0, vec![ AccountMeta::new(keypair0.pubkey(), true), @@ -1416,7 +1416,7 @@ mod tests { #[test] #[should_panic] fn test_transaction_missing_keypair() { - let program_id = Pubkey::default(); + let program_id = Address::default(); let keypair0 = Keypair::new(); let id0 = keypair0.pubkey(); let ix = Instruction::new_with_bincode(program_id, &0, vec![AccountMeta::new(id0, true)]); @@ -1427,9 +1427,9 @@ mod tests { #[test] #[should_panic] fn test_transaction_wrong_key() { - let program_id = Pubkey::default(); + let program_id = Address::default(); let keypair0 = Keypair::new(); - let wrong_id = Pubkey::default(); + let wrong_id = Address::default(); let ix = Instruction::new_with_bincode(program_id, &0, vec![AccountMeta::new(wrong_id, true)]); let message = Message::new(&[ix], Some(&wrong_id)); @@ -1438,7 +1438,7 @@ mod tests { #[test] fn test_transaction_correct_key() { - let program_id = Pubkey::default(); + let program_id = Address::default(); let keypair0 = Keypair::new(); let id0 = keypair0.pubkey(); let ix = Instruction::new_with_bincode(program_id, &0, vec![AccountMeta::new(id0, true)]); @@ -1454,7 +1454,7 @@ mod tests { #[test] fn test_transaction_instruction_with_duplicate_keys() { - let program_id = Pubkey::default(); + let program_id = Address::default(); let keypair0 = Keypair::new(); let id0 = keypair0.pubkey(); let id1 = solana_pubkey::new_rand(); @@ -1480,7 +1480,7 @@ mod tests { #[test] fn test_try_sign_dyn_keypairs() { - let program_id = Pubkey::default(); + let program_id = Address::default(); let keypair = Keypair::new(); let pubkey = keypair.pubkey(); let presigner_keypair = Keypair::new(); @@ -1528,7 +1528,7 @@ mod tests { ); } - fn nonced_transfer_tx() -> (Pubkey, Pubkey, Transaction) { + fn nonced_transfer_tx() -> (Address, Address, Transaction) { let from_keypair = Keypair::new(); let from_pubkey = from_keypair.pubkey(); let nonce_keypair = Keypair::new(); @@ -1599,7 +1599,7 @@ mod tests { fn tx_keypair_pubkey_mismatch() { let from_keypair = Keypair::new(); let from_pubkey = from_keypair.pubkey(); - let to_pubkey = Pubkey::new_unique(); + let to_pubkey = Address::new_unique(); let instructions = [system_instruction::transfer(&from_pubkey, &to_pubkey, 42)]; let mut tx = Transaction::new_with_payer(&instructions, Some(&from_pubkey)); let unused_keypair = Keypair::new(); @@ -1629,7 +1629,7 @@ mod tests { #[test] fn test_replace_signatures() { - let program_id = Pubkey::default(); + let program_id = Address::default(); let keypair0 = Keypair::new(); let keypair1 = Keypair::new(); let pubkey0 = keypair0.pubkey(); diff --git a/transaction/src/sanitized.rs b/transaction/src/sanitized.rs index 304ef694f..b3be42918 100644 --- a/transaction/src/sanitized.rs +++ b/transaction/src/sanitized.rs @@ -7,7 +7,7 @@ use { AddressLoader, LegacyMessage, SanitizedMessage, SanitizedVersionedMessage, VersionedMessage, }, - solana_pubkey::Pubkey, + solana_address::Address, solana_signature::Signature, solana_transaction_error::{TransactionError, TransactionResult}, std::collections::HashSet, @@ -33,9 +33,9 @@ pub struct SanitizedTransaction { #[derive(Debug, Clone, Default, Eq, PartialEq)] pub struct TransactionAccountLocks<'a> { /// List of readonly account key locks - pub readonly: Vec<&'a Pubkey>, + pub readonly: Vec<&'a Address>, /// List of writable account key locks - pub writable: Vec<&'a Pubkey>, + pub writable: Vec<&'a Address>, } /// Type that represents whether the transaction message has been precomputed or @@ -60,7 +60,7 @@ impl SanitizedTransaction { message_hash: Hash, is_simple_vote_tx: bool, address_loader: impl AddressLoader, - reserved_account_keys: &HashSet, + reserved_account_keys: &HashSet
, ) -> TransactionResult { let signatures = tx.signatures; let SanitizedVersionedMessage { message } = tx.message; @@ -96,7 +96,7 @@ impl SanitizedTransaction { message_hash: impl Into, is_simple_vote_tx: Option, address_loader: impl AddressLoader, - reserved_account_keys: &HashSet, + reserved_account_keys: &HashSet
, ) -> TransactionResult { let sanitized_versioned_tx = SanitizedVersionedTransaction::try_from(tx)?; let is_simple_vote_tx = is_simple_vote_tx.unwrap_or_else(|| { @@ -121,7 +121,7 @@ impl SanitizedTransaction { #[cfg(feature = "blake3")] pub fn try_from_legacy_transaction( tx: Transaction, - reserved_account_keys: &HashSet, + reserved_account_keys: &HashSet
, ) -> TransactionResult { tx.sanitize()?; @@ -254,7 +254,7 @@ impl SanitizedTransaction { /// If the transaction uses a durable nonce, return the pubkey of the nonce account #[cfg(feature = "bincode")] - pub fn get_durable_nonce(&self) -> Option<&Pubkey> { + pub fn get_durable_nonce(&self) -> Option<&Address> { self.message.get_durable_nonce() } @@ -403,9 +403,9 @@ mod tests { num_readonly_unsigned_accounts: 1, }, account_keys: vec![ - Pubkey::new_unique(), - Pubkey::new_unique(), - Pubkey::new_unique(), + Address::new_unique(), + Address::new_unique(), + Address::new_unique(), ], ..legacy::Message::default() }, diff --git a/transaction/src/simple_vote_transaction_checker.rs b/transaction/src/simple_vote_transaction_checker.rs index bece18367..c9a56658e 100644 --- a/transaction/src/simple_vote_transaction_checker.rs +++ b/transaction/src/simple_vote_transaction_checker.rs @@ -1,6 +1,6 @@ use { crate::versioned::sanitized::SanitizedVersionedTransaction, solana_message::VersionedMessage, - solana_pubkey::Pubkey, solana_signature::Signature, + solana_address::Address, solana_signature::Signature, }; /// Simple vote transaction meets these conditions: @@ -36,7 +36,7 @@ pub fn is_simple_vote_transaction( pub fn is_simple_vote_transaction_impl<'a>( signatures: &[Signature], is_legacy_message: bool, - mut instruction_programs: impl Iterator, + mut instruction_programs: impl Iterator, ) -> bool { signatures.len() < 3 && is_legacy_message From 3a1c0c8587ce53a2dc595f5d08480a4752bb6555 Mon Sep 17 00:00:00 2001 From: Kevin Heavey Date: Tue, 26 Aug 2025 08:14:32 +0100 Subject: [PATCH 5/5] fmt --- transaction/src/lib.rs | 17 ++++++++++------- transaction/src/sanitized.rs | 2 +- .../src/simple_vote_transaction_checker.rs | 4 ++-- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/transaction/src/lib.rs b/transaction/src/lib.rs index ef1137fff..b9d409daa 100644 --- a/transaction/src/lib.rs +++ b/transaction/src/lib.rs @@ -115,19 +115,19 @@ use { serde_derive::{Deserialize, Serialize}, solana_short_vec as short_vec, }; -#[cfg(feature = "bincode")] -pub use { - solana_hash::Hash, - solana_signer::{signers::Signers, SignerError}, -}; pub use { + solana_address::Address, solana_instruction::{AccountMeta, Instruction}, solana_instruction_error::InstructionError, solana_message::{compiled_instruction::CompiledInstruction, Message, VersionedMessage}, - solana_address::Address, solana_signature::Signature, solana_transaction_error::{TransactionError, TransactionResult}, }; +#[cfg(feature = "bincode")] +pub use { + solana_hash::Hash, + solana_signer::{signers::Signers, SignerError}, +}; use { solana_message::inline_nonce::is_advance_nonce_instruction_data, solana_sanitize::{Sanitize, SanitizeError}, @@ -1048,7 +1048,10 @@ impl Transaction { #[cfg(feature = "verify")] /// Replace all the signatures and pubkeys. - pub fn replace_signatures(&mut self, signers: &[(Address, Signature)]) -> TransactionResult<()> { + pub fn replace_signatures( + &mut self, + signers: &[(Address, Signature)], + ) -> TransactionResult<()> { let num_required_signatures = self.message.header.num_required_signatures as usize; if signers.len() != num_required_signatures || self.signatures.len() != num_required_signatures diff --git a/transaction/src/sanitized.rs b/transaction/src/sanitized.rs index b3be42918..66375c47e 100644 --- a/transaction/src/sanitized.rs +++ b/transaction/src/sanitized.rs @@ -1,5 +1,6 @@ use { crate::versioned::{sanitized::SanitizedVersionedTransaction, VersionedTransaction}, + solana_address::Address, solana_hash::Hash, solana_message::{ legacy, @@ -7,7 +8,6 @@ use { AddressLoader, LegacyMessage, SanitizedMessage, SanitizedVersionedMessage, VersionedMessage, }, - solana_address::Address, solana_signature::Signature, solana_transaction_error::{TransactionError, TransactionResult}, std::collections::HashSet, diff --git a/transaction/src/simple_vote_transaction_checker.rs b/transaction/src/simple_vote_transaction_checker.rs index c9a56658e..96b4cb9a6 100644 --- a/transaction/src/simple_vote_transaction_checker.rs +++ b/transaction/src/simple_vote_transaction_checker.rs @@ -1,6 +1,6 @@ use { - crate::versioned::sanitized::SanitizedVersionedTransaction, solana_message::VersionedMessage, - solana_address::Address, solana_signature::Signature, + crate::versioned::sanitized::SanitizedVersionedTransaction, solana_address::Address, + solana_message::VersionedMessage, solana_signature::Signature, }; /// Simple vote transaction meets these conditions: