From 62daa1690a668a2035326164b9e4ee43b52644c3 Mon Sep 17 00:00:00 2001 From: Kevin Heavey Date: Thu, 5 Dec 2024 22:20:09 +0400 Subject: [PATCH] remove solana-sdk from tpu-client (#3842) * remove solana-sdk from tpu-client * fix dep * remove solana-program * sort deps --- Cargo.lock | 12 +++++++++++- programs/sbf/Cargo.lock | 12 +++++++++++- svm/examples/Cargo.lock | 12 +++++++++++- tpu-client/Cargo.toml | 18 ++++++++++++++++-- tpu-client/src/nonblocking/tpu_client.rs | 22 +++++++++++----------- tpu-client/src/tpu_client.rs | 16 +++++++--------- 6 files changed, 67 insertions(+), 25 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 80ba44652ae107..a5f0cd9923c57e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -9303,13 +9303,23 @@ dependencies = [ "indicatif", "log", "rayon", + "solana-client-traits", + "solana-clock", + "solana-commitment-config", "solana-connection-cache", + "solana-epoch-info", "solana-measure", + "solana-message", "solana-net-utils", + "solana-pubkey", "solana-pubsub-client", + "solana-quic-definitions", "solana-rpc-client", "solana-rpc-client-api", - "solana-sdk", + "solana-signature", + "solana-signer", + "solana-transaction", + "solana-transaction-error", "thiserror 2.0.4", "tokio", ] diff --git a/programs/sbf/Cargo.lock b/programs/sbf/Cargo.lock index 033692181c4f2a..0ec4b3279d953b 100644 --- a/programs/sbf/Cargo.lock +++ b/programs/sbf/Cargo.lock @@ -7808,13 +7808,23 @@ dependencies = [ "indicatif", "log", "rayon", + "solana-client-traits", + "solana-clock", + "solana-commitment-config", "solana-connection-cache", + "solana-epoch-info", "solana-measure", + "solana-message", "solana-net-utils", + "solana-pubkey", "solana-pubsub-client", + "solana-quic-definitions", "solana-rpc-client", "solana-rpc-client-api", - "solana-sdk", + "solana-signature", + "solana-signer", + "solana-transaction", + "solana-transaction-error", "thiserror 2.0.4", "tokio", ] diff --git a/svm/examples/Cargo.lock b/svm/examples/Cargo.lock index 963d2fcd3c122e..68c0c757ed4896 100644 --- a/svm/examples/Cargo.lock +++ b/svm/examples/Cargo.lock @@ -7153,13 +7153,23 @@ dependencies = [ "indicatif", "log", "rayon", + "solana-client-traits", + "solana-clock", + "solana-commitment-config", "solana-connection-cache", + "solana-epoch-info", "solana-measure", + "solana-message", "solana-net-utils", + "solana-pubkey", "solana-pubsub-client", + "solana-quic-definitions", "solana-rpc-client", "solana-rpc-client-api", - "solana-sdk", + "solana-signature", + "solana-signer", + "solana-transaction", + "solana-transaction-error", "thiserror 2.0.4", "tokio", ] diff --git a/tpu-client/Cargo.toml b/tpu-client/Cargo.toml index b07ae3dcb2764c..846c7207dee587 100644 --- a/tpu-client/Cargo.toml +++ b/tpu-client/Cargo.toml @@ -17,13 +17,23 @@ indexmap = { workspace = true } indicatif = { workspace = true, optional = true } log = { workspace = true } rayon = { workspace = true } +solana-client-traits = { workspace = true } +solana-clock = { workspace = true } +solana-commitment-config = { workspace = true } solana-connection-cache = { workspace = true } +solana-epoch-info = { workspace = true } solana-measure = { workspace = true } +solana-message = { workspace = true, optional = true } solana-net-utils = { workspace = true } +solana-pubkey = { workspace = true } solana-pubsub-client = { workspace = true } +solana-quic-definitions = { workspace = true } solana-rpc-client = { workspace = true } solana-rpc-client-api = { workspace = true } -solana-sdk = { workspace = true } +solana-signature = { workspace = true } +solana-signer = { workspace = true } +solana-transaction = { workspace = true } +solana-transaction-error = { workspace = true } thiserror = { workspace = true } tokio = { workspace = true, features = ["full"] } @@ -31,7 +41,11 @@ tokio = { workspace = true, features = ["full"] } default = ["spinner"] # Support tpu-client methods that feature a spinner progress bar for # command-line interfaces -spinner = ["dep:indicatif", "solana-rpc-client/spinner"] +spinner = [ + "dep:indicatif", + "dep:solana-message", + "solana-rpc-client/spinner" +] [package.metadata.docs.rs] targets = ["x86_64-unknown-linux-gnu"] diff --git a/tpu-client/src/nonblocking/tpu_client.rs b/tpu-client/src/nonblocking/tpu_client.rs index 75886b250bd2fd..2aa86530b17585 100644 --- a/tpu-client/src/nonblocking/tpu_client.rs +++ b/tpu-client/src/nonblocking/tpu_client.rs @@ -4,6 +4,8 @@ use { bincode::serialize, futures_util::{future::join_all, stream::StreamExt}, log::*, + solana_clock::{Slot, DEFAULT_MS_PER_SLOT, NUM_CONSECUTIVE_LEADER_SLOTS}, + solana_commitment_config::CommitmentConfig, solana_connection_cache::{ connection_cache::{ ConnectionCache, ConnectionManager, ConnectionPool, NewConnectionConfig, Protocol, @@ -11,23 +13,19 @@ use { }, nonblocking::client_connection::ClientConnection, }, + solana_epoch_info::EpochInfo, + solana_pubkey::Pubkey, solana_pubsub_client::nonblocking::pubsub_client::{PubsubClient, PubsubClientError}, + solana_quic_definitions::QUIC_PORT_OFFSET, solana_rpc_client::nonblocking::rpc_client::RpcClient, solana_rpc_client_api::{ client_error::{Error as ClientError, ErrorKind, Result as ClientResult}, request::RpcError, response::{RpcContactInfo, SlotUpdate}, }, - solana_sdk::{ - clock::{Slot, DEFAULT_MS_PER_SLOT, NUM_CONSECUTIVE_LEADER_SLOTS}, - commitment_config::CommitmentConfig, - epoch_info::EpochInfo, - pubkey::Pubkey, - quic::QUIC_PORT_OFFSET, - signature::SignerError, - transaction::Transaction, - transport::{Result as TransportResult, TransportError}, - }, + solana_signer::SignerError, + solana_transaction::Transaction, + solana_transaction_error::{TransportError, TransportResult}, std::{ collections::{HashMap, HashSet}, net::SocketAddr, @@ -48,9 +46,11 @@ use { crate::tpu_client::{SEND_TRANSACTION_INTERVAL, TRANSACTION_RESEND_INTERVAL}, futures_util::FutureExt, indicatif::ProgressBar, + solana_message::Message, solana_rpc_client::spinner::{self, SendTransactionProgress}, solana_rpc_client_api::request::MAX_GET_SIGNATURE_STATUSES_QUERY_ITEMS, - solana_sdk::{message::Message, signers::Signers, transaction::TransactionError}, + solana_signer::signers::Signers, + solana_transaction_error::TransactionError, std::{future::Future, iter}, }; diff --git a/tpu-client/src/tpu_client.rs b/tpu-client/src/tpu_client.rs index 29095314525170..ca45cb4c51331e 100644 --- a/tpu-client/src/tpu_client.rs +++ b/tpu-client/src/tpu_client.rs @@ -2,6 +2,8 @@ pub use crate::nonblocking::tpu_client::TpuSenderError; use { crate::nonblocking::tpu_client::TpuClient as NonblockingTpuClient, rayon::iter::{IntoParallelIterator, ParallelIterator}, + solana_client_traits::AsyncClient, + solana_clock::Slot, solana_connection_cache::{ client_connection::ClientConnection, connection_cache::{ @@ -10,13 +12,9 @@ use { }, solana_net_utils::bind_to_unspecified, solana_rpc_client::rpc_client::RpcClient, - solana_sdk::{ - client::AsyncClient, - clock::Slot, - signature::Signature, - transaction::{Transaction, VersionedTransaction}, - transport::Result as TransportResult, - }, + solana_signature::Signature, + solana_transaction::{versioned::VersionedTransaction, Transaction}, + solana_transaction_error::TransportResult, std::{ collections::VecDeque, net::UdpSocket, @@ -25,8 +23,8 @@ use { }; #[cfg(feature = "spinner")] use { - solana_sdk::{message::Message, signers::Signers, transaction::TransactionError}, - tokio::time::Duration, + solana_message::Message, solana_signer::signers::Signers, + solana_transaction_error::TransactionError, tokio::time::Duration, }; pub const DEFAULT_TPU_ENABLE_UDP: bool = false;