Skip to content

Commit

Permalink
remove solana-sdk from tps-client (#4173)
Browse files Browse the repository at this point in the history
* remove solana-sdk from tps-client

* sort deps
  • Loading branch information
kevinheavey authored Dec 24, 2024
1 parent b1acfbd commit 39ce96f
Show file tree
Hide file tree
Showing 7 changed files with 88 additions and 73 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.

14 changes: 13 additions & 1 deletion tps-client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,27 @@ edition = { workspace = true }

[dependencies]
log = { workspace = true }
solana-account = { workspace = true }
solana-client = { 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-hash = { workspace = true }
solana-keypair = { workspace = true }
solana-message = { workspace = true }
solana-pubkey = { workspace = true }
solana-quic-client = { workspace = true }
solana-rpc-client = { workspace = true }
solana-rpc-client-api = { workspace = true }
solana-runtime = { workspace = true }
solana-sdk = { workspace = true }
solana-signature = { workspace = true }
solana-signer = { workspace = true }
solana-streamer = { workspace = true }
solana-tpu-client = { workspace = true }
solana-transaction = { workspace = true }
solana-transaction-error = { workspace = true }
solana-transaction-status = { workspace = true }
thiserror = { workspace = true }

Expand Down
32 changes: 15 additions & 17 deletions tps-client/src/bank_client.rs
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
use {
crate::{TpsClient, TpsClientError, TpsClientResult},
solana_account::Account,
solana_client_traits::{AsyncClient, SyncClient},
solana_commitment_config::CommitmentConfig,
solana_epoch_info::EpochInfo,
solana_hash::Hash,
solana_message::Message,
solana_pubkey::Pubkey,
solana_rpc_client_api::config::RpcBlockConfig,
solana_runtime::bank_client::BankClient,
solana_sdk::{
account::Account,
client::{AsyncClient, SyncClient},
commitment_config::CommitmentConfig,
epoch_info::EpochInfo,
hash::Hash,
message::Message,
pubkey::Pubkey,
signature::Signature,
slot_history::Slot,
transaction::{Result, Transaction},
},
solana_signature::Signature,
solana_transaction::Transaction,
solana_transaction_error::TransactionResult as Result,
solana_transaction_status::UiConfirmedBlock,
};

Expand Down Expand Up @@ -122,22 +120,22 @@ impl TpsClient for BankClient {
fn get_slot_with_commitment(
&self,
commitment_config: CommitmentConfig,
) -> TpsClientResult<Slot> {
) -> TpsClientResult<u64> {
SyncClient::get_slot_with_commitment(self, commitment_config).map_err(|err| err.into())
}

fn get_blocks_with_commitment(
&self,
_start_slot: Slot,
_end_slot: Option<Slot>,
_start_slot: u64,
_end_slot: Option<u64>,
_commitment_config: CommitmentConfig,
) -> TpsClientResult<Vec<Slot>> {
) -> TpsClientResult<Vec<u64>> {
unimplemented!("BankClient doesn't support get_blocks");
}

fn get_block_with_config(
&self,
_slot: Slot,
_slot: u64,
_rpc_block_config: RpcBlockConfig,
) -> TpsClientResult<UiConfirmedBlock> {
unimplemented!("BankClient doesn't support get_block_with_config");
Expand Down
37 changes: 16 additions & 21 deletions tps-client/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
use {
log::debug,
solana_account::Account,
solana_clock::DEFAULT_MS_PER_SLOT,
solana_commitment_config::CommitmentConfig,
solana_epoch_info::EpochInfo,
solana_hash::Hash,
solana_message::Message,
solana_pubkey::Pubkey,
solana_rpc_client_api::{client_error::Error as ClientError, config::RpcBlockConfig},
solana_sdk::{
account::Account,
clock::DEFAULT_MS_PER_SLOT,
commitment_config::CommitmentConfig,
epoch_info::EpochInfo,
hash::Hash,
message::Message,
pubkey::Pubkey,
signature::Signature,
slot_history::Slot,
transaction::{Result, Transaction},
transport::TransportError,
},
solana_signature::Signature,
solana_tpu_client::tpu_client::TpuSenderError,
solana_transaction::Transaction,
solana_transaction_error::{TransactionResult as Result, TransportError},
solana_transaction_status::UiConfirmedBlock,
std::{
thread::sleep,
Expand Down Expand Up @@ -126,21 +123,19 @@ pub trait TpsClient {

fn get_multiple_accounts(&self, pubkeys: &[Pubkey]) -> TpsClientResult<Vec<Option<Account>>>;

fn get_slot_with_commitment(
&self,
commitment_config: CommitmentConfig,
) -> TpsClientResult<Slot>;
fn get_slot_with_commitment(&self, commitment_config: CommitmentConfig)
-> TpsClientResult<u64>;

fn get_blocks_with_commitment(
&self,
start_slot: Slot,
end_slot: Option<Slot>,
start_slot: u64,
end_slot: Option<u64>,
commitment_config: CommitmentConfig,
) -> TpsClientResult<Vec<Slot>>;
) -> TpsClientResult<Vec<u64>>;

fn get_block_with_config(
&self,
slot: Slot,
slot: u64,
rpc_block_config: RpcBlockConfig,
) -> TpsClientResult<UiConfirmedBlock>;
}
Expand Down
30 changes: 14 additions & 16 deletions tps-client/src/rpc_client.rs
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
use {
crate::{TpsClient, TpsClientError, TpsClientResult},
solana_account::Account,
solana_client::rpc_config::RpcSendTransactionConfig,
solana_commitment_config::CommitmentConfig,
solana_epoch_info::EpochInfo,
solana_hash::Hash,
solana_message::Message,
solana_pubkey::Pubkey,
solana_rpc_client::rpc_client::RpcClient,
solana_rpc_client_api::config::RpcBlockConfig,
solana_sdk::{
account::Account,
commitment_config::CommitmentConfig,
epoch_info::EpochInfo,
hash::Hash,
message::Message,
pubkey::Pubkey,
signature::Signature,
slot_history::Slot,
transaction::{Result, Transaction},
},
solana_signature::Signature,
solana_transaction::Transaction,
solana_transaction_error::TransactionResult as Result,
solana_transaction_status::UiConfirmedBlock,
};

Expand Down Expand Up @@ -134,23 +132,23 @@ impl TpsClient for RpcClient {
fn get_slot_with_commitment(
&self,
commitment_config: CommitmentConfig,
) -> TpsClientResult<Slot> {
) -> TpsClientResult<u64> {
RpcClient::get_slot_with_commitment(self, commitment_config).map_err(|err| err.into())
}

fn get_blocks_with_commitment(
&self,
start_slot: Slot,
end_slot: Option<Slot>,
start_slot: u64,
end_slot: Option<u64>,
commitment_config: CommitmentConfig,
) -> TpsClientResult<Vec<Slot>> {
) -> TpsClientResult<Vec<u64>> {
RpcClient::get_blocks_with_commitment(self, start_slot, end_slot, commitment_config)
.map_err(|err| err.into())
}

fn get_block_with_config(
&self,
slot: Slot,
slot: u64,
rpc_block_config: RpcBlockConfig,
) -> TpsClientResult<UiConfirmedBlock> {
RpcClient::get_block_with_config(self, slot, rpc_block_config).map_err(|err| err.into())
Expand Down
30 changes: 14 additions & 16 deletions tps-client/src/tpu_client.rs
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
use {
crate::{TpsClient, TpsClientError, TpsClientResult},
solana_account::Account,
solana_commitment_config::CommitmentConfig,
solana_connection_cache::connection_cache::{
ConnectionManager, ConnectionPool, NewConnectionConfig,
},
solana_epoch_info::EpochInfo,
solana_hash::Hash,
solana_message::Message,
solana_pubkey::Pubkey,
solana_rpc_client_api::config::RpcBlockConfig,
solana_sdk::{
account::Account,
commitment_config::CommitmentConfig,
epoch_info::EpochInfo,
hash::Hash,
message::Message,
pubkey::Pubkey,
signature::Signature,
slot_history::Slot,
transaction::{Result, Transaction},
},
solana_signature::Signature,
solana_tpu_client::tpu_client::TpuClient,
solana_transaction::Transaction,
solana_transaction_error::TransactionResult as Result,
solana_transaction_status::UiConfirmedBlock,
};

Expand Down Expand Up @@ -155,26 +153,26 @@ where
fn get_slot_with_commitment(
&self,
commitment_config: CommitmentConfig,
) -> TpsClientResult<Slot> {
) -> TpsClientResult<u64> {
self.rpc_client()
.get_slot_with_commitment(commitment_config)
.map_err(|err| err.into())
}

fn get_blocks_with_commitment(
&self,
start_slot: Slot,
end_slot: Option<Slot>,
start_slot: u64,
end_slot: Option<u64>,
commitment_config: CommitmentConfig,
) -> TpsClientResult<Vec<Slot>> {
) -> TpsClientResult<Vec<u64>> {
self.rpc_client()
.get_blocks_with_commitment(start_slot, end_slot, commitment_config)
.map_err(|err| err.into())
}

fn get_block_with_config(
&self,
slot: Slot,
slot: u64,
rpc_block_config: RpcBlockConfig,
) -> TpsClientResult<UiConfirmedBlock> {
self.rpc_client()
Expand Down
4 changes: 3 additions & 1 deletion tps-client/src/utils.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
use {
log::{error, info},
solana_client::connection_cache::ConnectionCache as ClientConnectionCache,
solana_keypair::Keypair,
solana_pubkey::Pubkey,
solana_rpc_client::rpc_client::RpcClient,
solana_sdk::{pubkey::Pubkey, signature::Signer, signer::keypair::Keypair},
solana_signer::Signer,
solana_streamer::streamer::StakedNodes,
std::{
collections::HashMap,
Expand Down

0 comments on commit 39ce96f

Please sign in to comment.