Fully remove `ThinClient` from `bench-tps` (#132)

remove ThinClient from bench-tps
This commit is contained in:
Greg Cusack 2024-03-12 13:41:54 -05:00 committed by GHA: Update Upstream From Fork
parent 574c1ad195
commit 9a8da98577
4 changed files with 0 additions and 146 deletions

1
Cargo.lock generated
View File

@ -5378,7 +5378,6 @@ dependencies = [
"solana-sdk",
"solana-streamer",
"solana-test-validator",
"solana-thin-client",
"solana-tpu-client",
"solana-transaction-status",
"solana-version",

View File

@ -35,7 +35,6 @@ solana-rpc-client-nonce-utils = { workspace = true }
solana-runtime = { workspace = true }
solana-sdk = { workspace = true }
solana-streamer = { workspace = true }
solana-thin-client = { workspace = true }
solana-tpu-client = { workspace = true }
solana-transaction-status = { workspace = true }
solana-version = { workspace = true }

View File

@ -113,5 +113,4 @@ pub trait BenchTpsClient {
mod bank_client;
mod rpc_client;
mod thin_client;
mod tpu_client;

View File

@ -1,143 +0,0 @@
use {
crate::bench_tps_client::{BenchTpsClient, BenchTpsError, Result},
solana_client::thin_client::ThinClient,
solana_rpc_client_api::config::RpcBlockConfig,
solana_sdk::{
account::Account,
client::{AsyncClient, Client, SyncClient},
commitment_config::CommitmentConfig,
epoch_info::EpochInfo,
hash::Hash,
message::Message,
pubkey::Pubkey,
signature::Signature,
slot_history::Slot,
transaction::Transaction,
},
solana_transaction_status::UiConfirmedBlock,
};
impl BenchTpsClient for ThinClient {
fn send_transaction(&self, transaction: Transaction) -> Result<Signature> {
AsyncClient::async_send_transaction(self, transaction).map_err(|err| err.into())
}
fn send_batch(&self, transactions: Vec<Transaction>) -> Result<()> {
AsyncClient::async_send_batch(self, transactions).map_err(|err| err.into())
}
fn get_latest_blockhash(&self) -> Result<Hash> {
SyncClient::get_latest_blockhash(self).map_err(|err| err.into())
}
fn get_latest_blockhash_with_commitment(
&self,
commitment_config: CommitmentConfig,
) -> Result<(Hash, u64)> {
SyncClient::get_latest_blockhash_with_commitment(self, commitment_config)
.map_err(|err| err.into())
}
fn get_transaction_count(&self) -> Result<u64> {
SyncClient::get_transaction_count(self).map_err(|err| err.into())
}
fn get_transaction_count_with_commitment(
&self,
commitment_config: CommitmentConfig,
) -> Result<u64> {
SyncClient::get_transaction_count_with_commitment(self, commitment_config)
.map_err(|err| err.into())
}
fn get_epoch_info(&self) -> Result<EpochInfo> {
SyncClient::get_epoch_info(self).map_err(|err| err.into())
}
fn get_balance(&self, pubkey: &Pubkey) -> Result<u64> {
SyncClient::get_balance(self, pubkey).map_err(|err| err.into())
}
fn get_balance_with_commitment(
&self,
pubkey: &Pubkey,
commitment_config: CommitmentConfig,
) -> Result<u64> {
SyncClient::get_balance_with_commitment(self, pubkey, commitment_config)
.map_err(|err| err.into())
}
fn get_fee_for_message(&self, message: &Message) -> Result<u64> {
SyncClient::get_fee_for_message(self, message).map_err(|err| err.into())
}
fn get_minimum_balance_for_rent_exemption(&self, data_len: usize) -> Result<u64> {
SyncClient::get_minimum_balance_for_rent_exemption(self, data_len).map_err(|err| err.into())
}
fn addr(&self) -> String {
Client::tpu_addr(self)
}
fn request_airdrop_with_blockhash(
&self,
pubkey: &Pubkey,
lamports: u64,
recent_blockhash: &Hash,
) -> Result<Signature> {
self.rpc_client()
.request_airdrop_with_blockhash(pubkey, lamports, recent_blockhash)
.map_err(|err| err.into())
}
fn get_account(&self, pubkey: &Pubkey) -> Result<Account> {
self.rpc_client()
.get_account(pubkey)
.map_err(|err| err.into())
}
fn get_account_with_commitment(
&self,
pubkey: &Pubkey,
commitment_config: CommitmentConfig,
) -> Result<Account> {
SyncClient::get_account_with_commitment(self, pubkey, commitment_config)
.map_err(|err| err.into())
.and_then(|account| {
account.ok_or_else(|| {
BenchTpsError::Custom(format!("AccountNotFound: pubkey={pubkey}"))
})
})
}
fn get_multiple_accounts(&self, pubkeys: &[Pubkey]) -> Result<Vec<Option<Account>>> {
self.rpc_client()
.get_multiple_accounts(pubkeys)
.map_err(|err| err.into())
}
fn get_slot_with_commitment(&self, commitment_config: CommitmentConfig) -> Result<Slot> {
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>,
commitment_config: CommitmentConfig,
) -> Result<Vec<Slot>> {
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,
rpc_block_config: RpcBlockConfig,
) -> Result<UiConfirmedBlock> {
self.rpc_client()
.get_block_with_config(slot, rpc_block_config)
.map_err(|err| err.into())
}
}