Skip to content

Commit

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

* sort deps
  • Loading branch information
kevinheavey authored Dec 31, 2024
1 parent 58b10ed commit 3aa7fdc
Show file tree
Hide file tree
Showing 16 changed files with 106 additions and 79 deletions.
12 changes: 11 additions & 1 deletion Cargo.lock

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

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

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

7 changes: 6 additions & 1 deletion svm/examples/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 transaction-view/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,27 @@ license = { workspace = true }
edition = { workspace = true }

[dependencies]
solana-sdk = { workspace = true }
solana-hash = { workspace = true }
solana-message = { workspace = true }
solana-packet = { workspace = true }
solana-pubkey = { workspace = true }
solana-sdk-ids = { workspace = true }
solana-short-vec = { workspace = true }
solana-signature = { workspace = true }
solana-svm-transaction = { workspace = true }

[dev-dependencies]
# See order-crates-for-publishing.py for using this unusual `path = "."`
agave-transaction-view = { path = ".", features = ["dev-context-only-utils"] }
bincode = { workspace = true }
criterion = { workspace = true }
solana-instruction = { workspace = true }
solana-keypair = { workspace = true }
solana-message = { workspace = true, features = ["serde"] }
solana-signature = { workspace = true, features = ["serde"] }
solana-signer = { workspace = true }
solana-system-interface = { workspace = true, features = ["bincode"] }
solana-transaction = { workspace = true, features = ["bincode"] }

[features]
dev-context-only-utils = []
Expand Down
6 changes: 2 additions & 4 deletions transaction-view/benches/bytes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@ use {
agave_transaction_view::bytes::{optimized_read_compressed_u16, read_compressed_u16},
bincode::{serialize_into, DefaultOptions, Options},
criterion::{black_box, criterion_group, criterion_main, Criterion, Throughput},
solana_sdk::{
packet::PACKET_DATA_SIZE,
short_vec::{decode_shortu16_len, ShortU16},
},
solana_packet::PACKET_DATA_SIZE,
solana_short_vec::{decode_shortu16_len, ShortU16},
};

fn setup() -> Vec<(u16, usize, Vec<u8>)> {
Expand Down
24 changes: 12 additions & 12 deletions transaction-view/benches/transaction_view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@ use {
black_box, criterion_group, criterion_main, measurement::Measurement, BenchmarkGroup,
Criterion, Throughput,
},
solana_sdk::{
hash::Hash,
instruction::Instruction,
message::{
v0::{self, MessageAddressTableLookup},
Message, MessageHeader, VersionedMessage,
},
pubkey::Pubkey,
signature::Keypair,
signer::Signer,
system_instruction,
transaction::{SanitizedVersionedTransaction, VersionedTransaction},
solana_hash::Hash,
solana_instruction::Instruction,
solana_keypair::Keypair,
solana_message::{
v0::{self, MessageAddressTableLookup},
Message, MessageHeader, VersionedMessage,
},
solana_pubkey::Pubkey,
solana_signer::Signer,
solana_system_interface::instruction as system_instruction,
solana_transaction::versioned::{
sanitized::SanitizedVersionedTransaction, VersionedTransaction,
},
};

Expand Down
10 changes: 5 additions & 5 deletions transaction-view/src/address_table_lookup_frame.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ use {
result::{Result, TransactionViewError},
},
core::fmt::{Debug, Formatter},
solana_sdk::{hash::Hash, packet::PACKET_DATA_SIZE, pubkey::Pubkey, signature::Signature},
solana_hash::Hash,
solana_packet::PACKET_DATA_SIZE,
solana_pubkey::Pubkey,
solana_signature::Signature,
solana_svm_transaction::message_address_table_lookup::SVMMessageAddressTableLookup,
};

Expand Down Expand Up @@ -211,10 +214,7 @@ impl Debug for AddressTableLookupIterator<'_> {

#[cfg(test)]
mod tests {
use {
super::*,
solana_sdk::{message::v0::MessageAddressTableLookup, short_vec::ShortVec},
};
use {super::*, solana_message::v0::MessageAddressTableLookup, solana_short_vec::ShortVec};

#[test]
fn test_zero_atls() {
Expand Down
3 changes: 2 additions & 1 deletion transaction-view/src/bytes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,8 @@ mod tests {
use {
super::*,
bincode::{serialize_into, DefaultOptions, Options},
solana_sdk::{packet::PACKET_DATA_SIZE, short_vec::ShortU16},
solana_packet::PACKET_DATA_SIZE,
solana_short_vec::ShortU16,
};

#[test]
Expand Down
4 changes: 2 additions & 2 deletions transaction-view/src/instructions_frame.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,8 @@ impl Debug for InstructionsIterator<'_> {
#[cfg(test)]
mod tests {
use {
super::*,
solana_sdk::{instruction::CompiledInstruction, short_vec::ShortVec},
super::*, solana_message::compiled_instruction::CompiledInstruction,
solana_short_vec::ShortVec,
};

#[test]
Expand Down
2 changes: 1 addition & 1 deletion transaction-view/src/message_header_frame.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use {
result::{Result, TransactionViewError},
transaction_version::TransactionVersion,
},
solana_sdk::message::MESSAGE_VERSION_PREFIX,
solana_message::MESSAGE_VERSION_PREFIX,
};

/// Metadata for accessing message header fields in a transaction view.
Expand Down
32 changes: 14 additions & 18 deletions transaction-view/src/resolved_transaction_view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,13 @@ use {
fmt::{Debug, Formatter},
ops::Deref,
},
solana_sdk::{
bpf_loader_upgradeable, ed25519_program,
hash::Hash,
message::{v0::LoadedAddresses, AccountKeys, TransactionSignatureDetails},
pubkey::Pubkey,
secp256k1_program,
signature::Signature,
solana_hash::Hash,
solana_message::{v0::LoadedAddresses, AccountKeys, TransactionSignatureDetails},
solana_pubkey::Pubkey,
solana_sdk_ids::{
bpf_loader_upgradeable, ed25519_program, secp256k1_program, secp256r1_program,
},
solana_sdk_ids::secp256r1_program,
solana_signature::Signature,
solana_svm_transaction::{
instruction::SVMInstruction, message_address_table_lookup::SVMMessageAddressTableLookup,
svm_message::SVMMessage, svm_transaction::SVMTransaction,
Expand Down Expand Up @@ -222,7 +220,7 @@ impl<D: TransactionData> SVMMessage for ResolvedTransactionView<D> {
&self,
) -> impl Iterator<
Item = (
&solana_sdk::pubkey::Pubkey,
&solana_pubkey::Pubkey,
solana_svm_transaction::instruction::SVMInstruction,
),
> + Clone {
Expand Down Expand Up @@ -289,16 +287,14 @@ mod tests {
use {
super::*,
crate::transaction_view::SanitizedTransactionView,
solana_sdk::{
instruction::CompiledInstruction,
message::{
v0::{self, MessageAddressTableLookup},
MessageHeader, VersionedMessage,
},
signature::Signature,
system_program, sysvar,
transaction::VersionedTransaction,
solana_message::{
compiled_instruction::CompiledInstruction,
v0::{self, MessageAddressTableLookup},
MessageHeader, VersionedMessage,
},
solana_sdk_ids::{system_program, sysvar},
solana_signature::Signature,
solana_transaction::versioned::VersionedTransaction,
};

#[test]
Expand Down
20 changes: 9 additions & 11 deletions transaction-view/src/sanitize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,18 +105,16 @@ mod tests {
use {
super::*,
crate::transaction_view::TransactionView,
solana_sdk::{
hash::Hash,
instruction::CompiledInstruction,
message::{
v0::{self, MessageAddressTableLookup},
Message, MessageHeader, VersionedMessage,
},
pubkey::Pubkey,
signature::Signature,
system_instruction,
transaction::VersionedTransaction,
solana_hash::Hash,
solana_message::{
compiled_instruction::CompiledInstruction,
v0::{self, MessageAddressTableLookup},
Message, MessageHeader, VersionedMessage,
},
solana_pubkey::Pubkey,
solana_signature::Signature,
solana_system_interface::instruction as system_instruction,
solana_transaction::versioned::VersionedTransaction,
};

fn create_legacy_transaction(
Expand Down
6 changes: 4 additions & 2 deletions transaction-view/src/signature_frame.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ use {
bytes::{advance_offset_for_array, read_byte},
result::{Result, TransactionViewError},
},
solana_sdk::{packet::PACKET_DATA_SIZE, pubkey::Pubkey, signature::Signature},
solana_packet::PACKET_DATA_SIZE,
solana_pubkey::Pubkey,
solana_signature::Signature,
};

// The packet has a maximum length of 1232 bytes.
Expand Down Expand Up @@ -51,7 +53,7 @@ impl SignatureFrame {

#[cfg(test)]
mod tests {
use {super::*, solana_sdk::short_vec::ShortVec};
use {super::*, solana_short_vec::ShortVec};

#[test]
fn test_zero_signatures() {
Expand Down
5 changes: 3 additions & 2 deletions transaction-view/src/static_account_keys_frame.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ use {
bytes::{advance_offset_for_array, read_byte},
result::{Result, TransactionViewError},
},
solana_sdk::{packet::PACKET_DATA_SIZE, pubkey::Pubkey},
solana_packet::PACKET_DATA_SIZE,
solana_pubkey::Pubkey,
};

// The packet has a maximum length of 1232 bytes.
Expand Down Expand Up @@ -49,7 +50,7 @@ impl StaticAccountKeysFrame {

#[cfg(test)]
mod tests {
use {super::*, solana_sdk::short_vec::ShortVec};
use {super::*, solana_short_vec::ShortVec};

#[test]
fn test_zero_accounts() {
Expand Down
17 changes: 8 additions & 9 deletions transaction-view/src/transaction_frame.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ use {
static_account_keys_frame::StaticAccountKeysFrame,
transaction_version::TransactionVersion,
},
solana_sdk::{hash::Hash, pubkey::Pubkey, signature::Signature},
solana_hash::Hash,
solana_pubkey::Pubkey,
solana_signature::Signature,
};

#[derive(Debug)]
Expand Down Expand Up @@ -258,14 +260,11 @@ impl TransactionFrame {
mod tests {
use {
super::*,
solana_sdk::{
address_lookup_table::AddressLookupTableAccount,
message::{v0, Message, MessageHeader, VersionedMessage},
pubkey::Pubkey,
signature::Signature,
system_instruction::{self, SystemInstruction},
transaction::VersionedTransaction,
},
solana_message::{v0, AddressLookupTableAccount, Message, MessageHeader, VersionedMessage},
solana_pubkey::Pubkey,
solana_signature::Signature,
solana_system_interface::instruction::{self as system_instruction, SystemInstruction},
solana_transaction::versioned::VersionedTransaction,
};

fn verify_transaction_view_frame(tx: &VersionedTransaction) {
Expand Down
16 changes: 8 additions & 8 deletions transaction-view/src/transaction_view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ use {
transaction_version::TransactionVersion,
},
core::fmt::{Debug, Formatter},
solana_sdk::{hash::Hash, pubkey::Pubkey, signature::Signature},
solana_hash::Hash,
solana_pubkey::Pubkey,
solana_signature::Signature,
solana_svm_transaction::instruction::SVMInstruction,
};

Expand Down Expand Up @@ -228,13 +230,11 @@ impl<const SANITIZED: bool, D: TransactionData> Debug for TransactionView<SANITI
mod tests {
use {
super::*,
solana_sdk::{
message::{Message, VersionedMessage},
pubkey::Pubkey,
signature::Signature,
system_instruction::{self},
transaction::VersionedTransaction,
},
solana_message::{Message, VersionedMessage},
solana_pubkey::Pubkey,
solana_signature::Signature,
solana_system_interface::instruction as system_instruction,
solana_transaction::versioned::VersionedTransaction,
};

fn verify_transaction_view_frame(tx: &VersionedTransaction) {
Expand Down

0 comments on commit 3aa7fdc

Please sign in to comment.