From be53376654d22b6a113c79b53d7dc25745f074eb Mon Sep 17 00:00:00 2001 From: kevinheavey Date: Mon, 2 Dec 2024 13:29:07 +0400 Subject: [PATCH] remove solana-sdk from svm-transaction --- Cargo.lock | 9 ++++++++- programs/sbf/Cargo.lock | 7 ++++++- svm-transaction/Cargo.toml | 11 ++++++++++- svm-transaction/src/instruction.rs | 2 +- .../src/message_address_table_lookup.rs | 2 +- svm-transaction/src/svm_message.rs | 15 +++++++++++---- .../src/svm_message/sanitized_message.rs | 8 +++----- .../src/svm_message/sanitized_transaction.rs | 7 ++++--- svm-transaction/src/svm_transaction.rs | 2 +- .../src/svm_transaction/sanitized_transaction.rs | 4 ++-- svm-transaction/src/tests.rs | 8 ++++---- svm/examples/Cargo.lock | 7 ++++++- 12 files changed, 57 insertions(+), 25 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 553e672ed641e2..846bf2948183e6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8965,7 +8965,14 @@ dependencies = [ name = "solana-svm-transaction" version = "2.2.0" dependencies = [ - "solana-sdk", + "solana-hash", + "solana-nonce", + "solana-program", + "solana-pubkey", + "solana-sdk-ids", + "solana-signature", + "solana-transaction", + "static_assertions", ] [[package]] diff --git a/programs/sbf/Cargo.lock b/programs/sbf/Cargo.lock index b6924398f14347..db43e4116b12ab 100644 --- a/programs/sbf/Cargo.lock +++ b/programs/sbf/Cargo.lock @@ -7559,7 +7559,12 @@ dependencies = [ name = "solana-svm-transaction" version = "2.2.0" dependencies = [ - "solana-sdk", + "solana-hash", + "solana-program", + "solana-pubkey", + "solana-sdk-ids", + "solana-signature", + "solana-transaction", ] [[package]] diff --git a/svm-transaction/Cargo.toml b/svm-transaction/Cargo.toml index 7eb82ae0d99d1d..cbd28187241dff 100644 --- a/svm-transaction/Cargo.toml +++ b/svm-transaction/Cargo.toml @@ -10,4 +10,13 @@ license = { workspace = true } edition = { workspace = true } [dependencies] -solana-sdk = { workspace = true } +solana-hash = { workspace = true } +solana-program = { workspace = true, default-features = false } +solana-pubkey = { workspace = true } +solana-sdk-ids = { workspace = true } +solana-signature = { workspace = true } +solana-transaction = { workspace = true } + +[dev-dependencies] +solana-nonce = { workspace = true } +static_assertions = { workspace = true } diff --git a/svm-transaction/src/instruction.rs b/svm-transaction/src/instruction.rs index b99eeebea7ded1..bd8804764dbe38 100644 --- a/svm-transaction/src/instruction.rs +++ b/svm-transaction/src/instruction.rs @@ -1,4 +1,4 @@ -use solana_sdk::instruction::CompiledInstruction; +use solana_program::instruction::CompiledInstruction; /// A non-owning version of [`CompiledInstruction`] that references /// slices of account indexes and data. diff --git a/svm-transaction/src/message_address_table_lookup.rs b/svm-transaction/src/message_address_table_lookup.rs index 71268a270f5f3d..2edb3792d1e8ca 100644 --- a/svm-transaction/src/message_address_table_lookup.rs +++ b/svm-transaction/src/message_address_table_lookup.rs @@ -1,4 +1,4 @@ -use solana_sdk::{message::v0, pubkey::Pubkey}; +use {solana_program::message::v0, solana_pubkey::Pubkey}; /// A non-owning version of [`v0::MessageAddressTableLookup`]. /// This simply references the data in the original message. diff --git a/svm-transaction/src/svm_message.rs b/svm-transaction/src/svm_message.rs index e9617ecdf4ed23..b9f0efc2c6f92b 100644 --- a/svm-transaction/src/svm_message.rs +++ b/svm-transaction/src/svm_message.rs @@ -3,14 +3,21 @@ use { instruction::SVMInstruction, message_address_table_lookup::SVMMessageAddressTableLookup, }, core::fmt::Debug, - solana_sdk::{ - hash::Hash, message::AccountKeys, nonce::NONCED_TX_MARKER_IX_INDEX, pubkey::Pubkey, - system_program, - }, + solana_hash::Hash, + solana_program::message::AccountKeys, + solana_pubkey::Pubkey, + solana_sdk_ids::system_program, }; mod sanitized_message; mod sanitized_transaction; +// inlined to avoid solana-nonce dep +#[cfg(test)] +static_assertions::const_assert_eq!( + NONCED_TX_MARKER_IX_INDEX, + solana_nonce::NONCED_TX_MARKER_IX_INDEX +); +const NONCED_TX_MARKER_IX_INDEX: u8 = 0; // - Debug to support legacy logging pub trait SVMMessage: Debug { diff --git a/svm-transaction/src/svm_message/sanitized_message.rs b/svm-transaction/src/svm_message/sanitized_message.rs index 66546a6d45f95b..fe3c524336e69a 100644 --- a/svm-transaction/src/svm_message/sanitized_message.rs +++ b/svm-transaction/src/svm_message/sanitized_message.rs @@ -3,11 +3,9 @@ use { instruction::SVMInstruction, message_address_table_lookup::SVMMessageAddressTableLookup, svm_message::SVMMessage, }, - solana_sdk::{ - hash::Hash, - message::{AccountKeys, SanitizedMessage}, - pubkey::Pubkey, - }, + solana_hash::Hash, + solana_program::message::{AccountKeys, SanitizedMessage}, + solana_pubkey::Pubkey, }; // Implement for the "reference" `SanitizedMessage` type. diff --git a/svm-transaction/src/svm_message/sanitized_transaction.rs b/svm-transaction/src/svm_message/sanitized_transaction.rs index 6321f27ca88e4f..e45085a4c71f17 100644 --- a/svm-transaction/src/svm_message/sanitized_transaction.rs +++ b/svm-transaction/src/svm_message/sanitized_transaction.rs @@ -3,9 +3,10 @@ use { instruction::SVMInstruction, message_address_table_lookup::SVMMessageAddressTableLookup, svm_message::SVMMessage, }, - solana_sdk::{ - hash::Hash, message::AccountKeys, pubkey::Pubkey, transaction::SanitizedTransaction, - }, + solana_hash::Hash, + solana_program::message::AccountKeys, + solana_pubkey::Pubkey, + solana_transaction::sanitized::SanitizedTransaction, }; impl SVMMessage for SanitizedTransaction { diff --git a/svm-transaction/src/svm_transaction.rs b/svm-transaction/src/svm_transaction.rs index 4805453dbbef1e..a45063384f4cf8 100644 --- a/svm-transaction/src/svm_transaction.rs +++ b/svm-transaction/src/svm_transaction.rs @@ -1,4 +1,4 @@ -use {crate::svm_message::SVMMessage, solana_sdk::signature::Signature}; +use {crate::svm_message::SVMMessage, solana_signature::Signature}; mod sanitized_transaction; diff --git a/svm-transaction/src/svm_transaction/sanitized_transaction.rs b/svm-transaction/src/svm_transaction/sanitized_transaction.rs index dadc3244333b9e..19d102d65a6dc2 100644 --- a/svm-transaction/src/svm_transaction/sanitized_transaction.rs +++ b/svm-transaction/src/svm_transaction/sanitized_transaction.rs @@ -1,6 +1,6 @@ use { - crate::svm_transaction::SVMTransaction, - solana_sdk::{signature::Signature, transaction::SanitizedTransaction}, + crate::svm_transaction::SVMTransaction, solana_signature::Signature, + solana_transaction::sanitized::SanitizedTransaction, }; impl SVMTransaction for SanitizedTransaction { diff --git a/svm-transaction/src/tests.rs b/svm-transaction/src/tests.rs index fb77009e2cce86..6f0d5097d4417f 100644 --- a/svm-transaction/src/tests.rs +++ b/svm-transaction/src/tests.rs @@ -1,8 +1,8 @@ #![cfg(test)] use { crate::svm_message::SVMMessage, - solana_sdk::{ - hash::Hash, + solana_hash::Hash, + solana_program::{ instruction::CompiledInstruction, message::{ legacy, @@ -10,10 +10,10 @@ use { MessageHeader, SanitizedMessage, SanitizedVersionedMessage, SimpleAddressLoader, VersionedMessage, }, - pubkey::Pubkey, system_instruction::SystemInstruction, - system_program, }, + solana_pubkey::Pubkey, + solana_sdk_ids::system_program, std::collections::HashSet, }; diff --git a/svm/examples/Cargo.lock b/svm/examples/Cargo.lock index 762889514f40fb..3c8ef7aad22c33 100644 --- a/svm/examples/Cargo.lock +++ b/svm/examples/Cargo.lock @@ -6911,7 +6911,12 @@ dependencies = [ name = "solana-svm-transaction" version = "2.2.0" dependencies = [ - "solana-sdk", + "solana-hash", + "solana-program", + "solana-pubkey", + "solana-sdk-ids", + "solana-signature", + "solana-transaction", ] [[package]]