Skip to content

Commit

Permalink
remove solana-sdk from runtime-transaction (#4175)
Browse files Browse the repository at this point in the history
* remove solana-sdk from runtime-transaction

* fix deps

* update lock files
  • Loading branch information
kevinheavey authored Jan 1, 2025
1 parent d64e0a1 commit 1f42fad
Show file tree
Hide file tree
Showing 11 changed files with 97 additions and 71 deletions.
14 changes: 13 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion programs/sbf/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 13 additions & 1 deletion runtime-transaction/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,14 @@ agave-transaction-view = { workspace = true }
log = { workspace = true }
solana-compute-budget = { workspace = true }
solana-compute-budget-instruction = { workspace = true }
solana-hash = { workspace = true }
solana-message = { workspace = true }
solana-pubkey = { workspace = true }
solana-sdk = { workspace = true }
solana-sdk-ids = { workspace = true }
solana-signature = { workspace = true }
solana-svm-transaction = { workspace = true }
solana-transaction = { workspace = true }
solana-transaction-error = { workspace = true }
thiserror = { workspace = true }

[lib]
Expand All @@ -29,7 +33,15 @@ bincode = { workspace = true }
criterion = { workspace = true }
rand = { workspace = true }
solana-compute-budget-instruction = { workspace = true, features = ["dev-context-only-utils"] }
solana-compute-budget-interface = { workspace = true }
solana-feature-set = { workspace = true }
solana-instruction = { workspace = true }
solana-keypair = { workspace = true }
solana-program = { workspace = true }
solana-reserved-account-keys = { workspace = true }
solana-signer = { workspace = true }
solana-system-interface = { workspace = true, features = ["bincode"] }
solana-system-transaction = { workspace = true }

[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]
Expand Down
11 changes: 6 additions & 5 deletions runtime-transaction/benches/get_signature_details.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
use {
criterion::{black_box, criterion_group, criterion_main, Criterion, Throughput},
solana_message::compiled_instruction::CompiledInstruction,
solana_pubkey::Pubkey,
solana_runtime_transaction::signature_details::get_precompile_signature_details,
solana_sdk::{instruction::CompiledInstruction, pubkey::Pubkey},
solana_svm_transaction::instruction::SVMInstruction,
};

Expand Down Expand Up @@ -51,8 +52,8 @@ fn bench_get_signature_details_no_sigs_unique(c: &mut Criterion) {

fn bench_get_signature_details_packed_sigs(c: &mut Criterion) {
let program_ids = [
solana_sdk::secp256k1_program::id(),
solana_sdk::ed25519_program::id(),
solana_sdk_ids::secp256k1_program::id(),
solana_sdk_ids::ed25519_program::id(),
];
for num_instructions in [4, 64] {
let instructions = (0..num_instructions)
Expand Down Expand Up @@ -86,8 +87,8 @@ fn bench_get_signature_details_packed_sigs(c: &mut Criterion) {

fn bench_get_signature_details_mixed_sigs(c: &mut Criterion) {
let program_ids = [
solana_sdk::secp256k1_program::id(),
solana_sdk::ed25519_program::id(),
solana_sdk_ids::secp256k1_program::id(),
solana_sdk_ids::ed25519_program::id(),
]
.into_iter()
.chain((0..6).map(|_| Pubkey::new_unique()))
Expand Down
16 changes: 7 additions & 9 deletions runtime-transaction/src/runtime_transaction.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
//! RuntimeTransaction is `runtime` facing representation of transaction, while
//! solana_sdk::SanitizedTransaction is client facing representation.
//! solana_transaction::sanitized::SanitizedTransaction is client facing representation.
//!
//! It has two states:
//! 1. Statically Loaded: after receiving `packet` from sigverify and deserializing
//! it into `solana_sdk::VersionedTransaction`, then sanitizing into
//! `solana_sdk::SanitizedVersionedTransaction`, which can be wrapped into
//! it into `solana_transaction::versioned::VersionedTransaction`, then sanitizing into
//! `solana_transaction::versioned::sanitized::SanitizedVersionedTransaction`, which can be wrapped into
//! `RuntimeTransaction` with static transaction metadata extracted.
//! 2. Dynamically Loaded: after successfully loaded account addresses from onchain
//! ALT, RuntimeTransaction<SanitizedMessage> transits into Dynamically Loaded state,
Expand All @@ -13,12 +13,10 @@ use {
crate::transaction_meta::{DynamicMeta, StaticMeta, TransactionMeta},
core::ops::Deref,
solana_compute_budget_instruction::compute_budget_instruction_details::*,
solana_sdk::{
hash::Hash,
message::{AccountKeys, TransactionSignatureDetails},
pubkey::Pubkey,
signature::Signature,
},
solana_hash::Hash,
solana_message::{AccountKeys, TransactionSignatureDetails},
solana_pubkey::Pubkey,
solana_signature::Signature,
solana_svm_transaction::{
instruction::SVMInstruction, message_address_table_lookup::SVMMessageAddressTableLookup,
svm_message::SVMMessage, svm_transaction::SVMTransaction,
Expand Down
44 changes: 20 additions & 24 deletions runtime-transaction/src/runtime_transaction/sdk_transactions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,15 @@ use {
transaction_meta::{StaticMeta, TransactionMeta},
transaction_with_meta::TransactionWithMeta,
},
solana_message::{AddressLoader, TransactionSignatureDetails},
solana_pubkey::Pubkey,
solana_sdk::{
message::{AddressLoader, TransactionSignatureDetails},
solana_svm_transaction::instruction::SVMInstruction,
solana_transaction::{
sanitized::{MessageHash, SanitizedTransaction},
simple_vote_transaction_checker::is_simple_vote_transaction,
transaction::{
MessageHash, Result, SanitizedTransaction, SanitizedVersionedTransaction,
VersionedTransaction,
},
versioned::{sanitized::SanitizedVersionedTransaction, VersionedTransaction},
},
solana_svm_transaction::instruction::SVMInstruction,
solana_transaction_error::TransactionResult as Result,
std::{borrow::Cow, collections::HashSet},
};

Expand Down Expand Up @@ -137,13 +136,13 @@ impl TransactionWithMeta for RuntimeTransaction<SanitizedTransaction> {

#[cfg(feature = "dev-context-only-utils")]
impl RuntimeTransaction<SanitizedTransaction> {
pub fn from_transaction_for_tests(transaction: solana_sdk::transaction::Transaction) -> Self {
pub fn from_transaction_for_tests(transaction: solana_transaction::Transaction) -> Self {
let versioned_transaction = VersionedTransaction::from(transaction);
Self::try_create(
versioned_transaction,
MessageHash::Compute,
None,
solana_sdk::message::SimpleAddressLoader::Disabled,
solana_message::SimpleAddressLoader::Disabled,
&HashSet::new(),
)
.expect("failed to create RuntimeTransaction from Transaction")
Expand All @@ -154,20 +153,17 @@ impl RuntimeTransaction<SanitizedTransaction> {
mod tests {
use {
super::*,
solana_program::{
system_instruction,
vote::{self, state::Vote},
},
solana_sdk::{
compute_budget::ComputeBudgetInstruction,
feature_set::FeatureSet,
hash::Hash,
instruction::Instruction,
message::Message,
reserved_account_keys::ReservedAccountKeys,
signer::{keypair::Keypair, Signer},
transaction::{SimpleAddressLoader, Transaction, VersionedTransaction},
},
solana_compute_budget_interface::ComputeBudgetInstruction,
solana_feature_set::FeatureSet,
solana_hash::Hash,
solana_instruction::Instruction,
solana_keypair::Keypair,
solana_message::{Message, SimpleAddressLoader},
solana_program::vote::{self, state::Vote},
solana_reserved_account_keys::ReservedAccountKeys,
solana_signer::Signer,
solana_system_interface::instruction as system_instruction,
solana_transaction::{versioned::VersionedTransaction, Transaction},
};

fn vote_sanitized_versioned_transaction() -> SanitizedVersionedTransaction {
Expand Down Expand Up @@ -203,7 +199,7 @@ mod tests {
let from_keypair = Keypair::new();
let instructions = vec![system_instruction::transfer(
&from_keypair.pubkey(),
&solana_sdk::pubkey::new_rand(),
&solana_pubkey::new_rand(),
1,
)];
TestTransaction {
Expand Down
41 changes: 20 additions & 21 deletions runtime-transaction/src/runtime_transaction/transaction_view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,20 @@ use {
resolved_transaction_view::ResolvedTransactionView, transaction_data::TransactionData,
transaction_version::TransactionVersion, transaction_view::SanitizedTransactionView,
},
solana_message::{
compiled_instruction::CompiledInstruction,
v0::{LoadedAddresses, LoadedMessage, MessageAddressTableLookup},
LegacyMessage, MessageHeader, SanitizedMessage, TransactionSignatureDetails,
VersionedMessage,
},
solana_pubkey::Pubkey,
solana_sdk::{
instruction::CompiledInstruction,
message::{
v0::{LoadedAddresses, LoadedMessage, MessageAddressTableLookup},
LegacyMessage, MessageHeader, SanitizedMessage, TransactionSignatureDetails,
VersionedMessage,
},
solana_svm_transaction::svm_message::SVMMessage,
solana_transaction::{
sanitized::{MessageHash, SanitizedTransaction},
simple_vote_transaction_checker::is_simple_vote_transaction_impl,
transaction::{
MessageHash, Result, SanitizedTransaction, TransactionError, VersionedTransaction,
},
versioned::VersionedTransaction,
},
solana_svm_transaction::svm_message::SVMMessage,
solana_transaction_error::{TransactionError, TransactionResult as Result},
std::{borrow::Cow, collections::HashSet},
};

Expand Down Expand Up @@ -158,14 +158,14 @@ impl<D: TransactionData> TransactionWithMeta for RuntimeTransaction<ResolvedTran

let message = match self.version() {
TransactionVersion::Legacy => {
VersionedMessage::Legacy(solana_sdk::message::legacy::Message {
VersionedMessage::Legacy(solana_message::legacy::Message {
header,
account_keys: static_account_keys,
recent_blockhash,
instructions,
})
}
TransactionVersion::V0 => VersionedMessage::V0(solana_sdk::message::v0::Message {
TransactionVersion::V0 => VersionedMessage::V0(solana_message::v0::Message {
header,
account_keys: static_account_keys,
recent_blockhash,
Expand All @@ -192,14 +192,13 @@ impl<D: TransactionData> TransactionWithMeta for RuntimeTransaction<ResolvedTran
mod tests {
use {
super::*,
solana_sdk::{
address_lookup_table::AddressLookupTableAccount,
hash::Hash,
message::{v0, SimpleAddressLoader},
reserved_account_keys::ReservedAccountKeys,
signature::{Keypair, Signature},
system_instruction, system_transaction,
},
solana_hash::Hash,
solana_keypair::Keypair,
solana_message::{v0, AddressLookupTableAccount, SimpleAddressLoader},
solana_reserved_account_keys::ReservedAccountKeys,
solana_signature::Signature,
solana_system_interface::instruction as system_instruction,
solana_system_transaction as system_transaction,
};

#[test]
Expand Down
12 changes: 6 additions & 6 deletions runtime-transaction/src/signature_details.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,9 @@ impl SignatureDetailsFilter {

#[inline]
fn check_program_id(program_id: &Pubkey) -> ProgramIdStatus {
if program_id == &solana_sdk::secp256k1_program::ID {
if program_id == &solana_sdk_ids::secp256k1_program::ID {
ProgramIdStatus::Secp256k1
} else if program_id == &solana_sdk::ed25519_program::ID {
} else if program_id == &solana_sdk_ids::ed25519_program::ID {
ProgramIdStatus::Ed25519
} else if program_id == &solana_sdk_ids::secp256r1_program::ID {
ProgramIdStatus::Secp256r1
Expand Down Expand Up @@ -148,8 +148,8 @@ mod tests {
fn test_get_signature_details_signatures_mixed() {
let program_ids = [
Pubkey::new_unique(),
solana_sdk::secp256k1_program::ID,
solana_sdk::ed25519_program::ID,
solana_sdk_ids::secp256k1_program::ID,
solana_sdk_ids::ed25519_program::ID,
solana_sdk_ids::secp256r1_program::ID,
];
let instructions = [
Expand All @@ -172,8 +172,8 @@ mod tests {
#[test]
fn test_get_signature_details_missing_num_signatures() {
let program_ids = [
solana_sdk::secp256k1_program::ID,
solana_sdk::ed25519_program::ID,
solana_sdk_ids::secp256k1_program::ID,
solana_sdk_ids::ed25519_program::ID,
solana_sdk_ids::secp256r1_program::ID,
];
let instructions = [
Expand Down
2 changes: 1 addition & 1 deletion runtime-transaction/src/transaction_meta.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
//!
use {
solana_compute_budget_instruction::compute_budget_instruction_details::ComputeBudgetInstructionDetails,
solana_sdk::{hash::Hash, message::TransactionSignatureDetails},
solana_hash::Hash, solana_message::TransactionSignatureDetails,
};

/// metadata can be extracted statically from sanitized transaction,
Expand Down
2 changes: 1 addition & 1 deletion runtime-transaction/src/transaction_with_meta.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use {
crate::transaction_meta::StaticMeta,
solana_sdk::transaction::{SanitizedTransaction, VersionedTransaction},
solana_svm_transaction::svm_transaction::SVMTransaction,
solana_transaction::{sanitized::SanitizedTransaction, versioned::VersionedTransaction},
std::borrow::Cow,
};

Expand Down
6 changes: 5 additions & 1 deletion svm/examples/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 1f42fad

Please sign in to comment.