From a5de314fb2c6aed337f7bd6c26423643a77d5ef1 Mon Sep 17 00:00:00 2001 From: kevinheavey Date: Thu, 11 Jul 2024 01:02:42 +0400 Subject: [PATCH] replace solana-client with its constituent parts where possible --- Cargo.lock | 6 +++++- accounts-cluster-bench/Cargo.toml | 1 + accounts-cluster-bench/src/main.rs | 3 ++- bench-tps/src/bench.rs | 3 ++- bench-tps/src/log_transaction_service.rs | 2 +- cli/Cargo.toml | 1 + cli/src/compute_budget.rs | 2 +- cli/tests/program.rs | 6 ++---- gossip/Cargo.toml | 1 + gossip/src/gossip_service.rs | 5 ++--- local-cluster/src/local_cluster.rs | 3 ++- programs/sbf/Cargo.lock | 3 ++- rpc-test/Cargo.toml | 1 + rpc-test/tests/nonblocking.rs | 8 +++----- rpc-test/tests/rpc.rs | 7 ++----- send-transaction-service/src/tpu_info.rs | 5 ++++- test-validator/Cargo.toml | 2 +- test-validator/src/lib.rs | 2 +- 18 files changed, 34 insertions(+), 27 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 66a851dfe99a5b..5dd2d341b8f673 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5439,6 +5439,7 @@ dependencies = [ "solana-measure", "solana-net-utils", "solana-rpc-client", + "solana-rpc-client-api", "solana-runtime", "solana-sdk", "solana-streamer", @@ -5844,6 +5845,7 @@ dependencies = [ "solana-client", "solana-compute-budget", "solana-config-program", + "solana-connection-cache", "solana-faucet", "solana-loader-v4-program", "solana-logger", @@ -6391,6 +6393,7 @@ dependencies = [ "solana-net-utils", "solana-perf", "solana-rayon-threadlimit", + "solana-rpc-client", "solana-runtime", "solana-sanitize", "solana-sdk", @@ -7120,6 +7123,7 @@ dependencies = [ "serde_json", "solana-account-decoder", "solana-client", + "solana-connection-cache", "solana-logger", "solana-pubsub-client", "solana-rpc", @@ -7537,7 +7541,6 @@ dependencies = [ "serde_json", "solana-accounts-db", "solana-cli-output", - "solana-client", "solana-compute-budget", "solana-core", "solana-geyser-plugin-manager", @@ -7548,6 +7551,7 @@ dependencies = [ "solana-program-test", "solana-rpc", "solana-rpc-client", + "solana-rpc-client-api", "solana-runtime", "solana-sdk", "solana-streamer", diff --git a/accounts-cluster-bench/Cargo.toml b/accounts-cluster-bench/Cargo.toml index f040315eccc994..5593de62c802f9 100644 --- a/accounts-cluster-bench/Cargo.toml +++ b/accounts-cluster-bench/Cargo.toml @@ -23,6 +23,7 @@ solana-logger = { workspace = true } solana-measure = { workspace = true } solana-net-utils = { workspace = true } solana-rpc-client = { workspace = true, features = ["default"] } +solana-rpc-client-api = { workspace = true } solana-runtime = { workspace = true } solana-sdk = { workspace = true } solana-streamer = { workspace = true } diff --git a/accounts-cluster-bench/src/main.rs b/accounts-cluster-bench/src/main.rs index 9e84456011e023..6c8a15dc69db69 100644 --- a/accounts-cluster-bench/src/main.rs +++ b/accounts-cluster-bench/src/main.rs @@ -8,11 +8,12 @@ use { hidden_unless_forced, input_parsers::pubkey_of, input_validators::is_url_or_moniker, }, solana_cli_config::{ConfigInput, CONFIG_FILE}, - solana_client::{rpc_request::TokenAccountsFilter, transaction_executor::TransactionExecutor}, + solana_client::transaction_executor::TransactionExecutor, solana_gossip::gossip_service::discover, solana_inline_spl::token, solana_measure::measure::Measure, solana_rpc_client::rpc_client::RpcClient, + solana_rpc_client_api::request::TokenAccountsFilter, solana_sdk::{ commitment_config::CommitmentConfig, hash::Hash, diff --git a/bench-tps/src/bench.rs b/bench-tps/src/bench.rs index 075e08343a6447..d8c550c9312e01 100644 --- a/bench-tps/src/bench.rs +++ b/bench-tps/src/bench.rs @@ -11,8 +11,9 @@ use { log::*, rand::distributions::{Distribution, Uniform}, rayon::prelude::*, - solana_client::{nonce_utils, rpc_request::MAX_MULTIPLE_ACCOUNTS}, + solana_client::nonce_utils, solana_metrics::{self, datapoint_info}, + solana_rpc_client_api::request::MAX_MULTIPLE_ACCOUNTS, solana_sdk::{ account::Account, clock::{DEFAULT_MS_PER_SLOT, DEFAULT_S_PER_SLOT, MAX_PROCESSING_AGE}, diff --git a/bench-tps/src/log_transaction_service.rs b/bench-tps/src/log_transaction_service.rs index 15deab12057f1c..09ad3561cf55e0 100644 --- a/bench-tps/src/log_transaction_service.rs +++ b/bench-tps/src/log_transaction_service.rs @@ -7,8 +7,8 @@ use { crossbeam_channel::{select, tick, unbounded, Receiver, Sender}, log::*, serde::Serialize, - solana_client::rpc_config::RpcBlockConfig, solana_measure::measure::Measure, + solana_rpc_client_api::config::RpcBlockConfig, solana_sdk::{ clock::{DEFAULT_MS_PER_SLOT, MAX_PROCESSING_AGE}, commitment_config::{CommitmentConfig, CommitmentLevel}, diff --git a/cli/Cargo.toml b/cli/Cargo.toml index 707fccf53c20c9..1a0f24d2d04f62 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -36,6 +36,7 @@ solana-cli-output = { workspace = true } solana-client = { workspace = true } solana-compute-budget = { workspace = true } solana-config-program = { workspace = true } +solana-connection-cache = { workspace = true } solana-loader-v4-program = { workspace = true } solana-logger = { workspace = true } solana-program-runtime = { workspace = true } diff --git a/cli/src/compute_budget.rs b/cli/src/compute_budget.rs index a994607d91efea..7379802e9b2834 100644 --- a/cli/src/compute_budget.rs +++ b/cli/src/compute_budget.rs @@ -1,8 +1,8 @@ use { solana_clap_utils::compute_budget::ComputeUnitLimit, - solana_client::rpc_config::RpcSimulateTransactionConfig, solana_compute_budget::compute_budget_processor::MAX_COMPUTE_UNIT_LIMIT, solana_rpc_client::rpc_client::RpcClient, + solana_rpc_client_api::config::RpcSimulateTransactionConfig, solana_sdk::{ borsh1::try_from_slice_unchecked, compute_budget::{self, ComputeBudgetInstruction}, diff --git a/cli/tests/program.rs b/cli/tests/program.rs index 45d243c5babcd2..6bec3bcc28b36f 100644 --- a/cli/tests/program.rs +++ b/cli/tests/program.rs @@ -11,12 +11,10 @@ use { test_utils::wait_n_slots, }, solana_cli_output::{parse_sign_only_reply_string, OutputFormat}, - solana_client::{ - rpc_client::GetConfirmedSignaturesForAddress2Config, rpc_config::RpcTransactionConfig, - }, solana_faucet::faucet::run_local_faucet, solana_rpc::rpc::JsonRpcConfig, - solana_rpc_client::rpc_client::RpcClient, + solana_rpc_client::rpc_client::{GetConfirmedSignaturesForAddress2Config, RpcClient}, + solana_rpc_client_api::config::RpcTransactionConfig, solana_rpc_client_nonce_utils::blockhash_query::BlockhashQuery, solana_sdk::{ account::ReadableAccount, diff --git a/gossip/Cargo.toml b/gossip/Cargo.toml index b9ad46a9fda429..5382b4c7c077ac 100644 --- a/gossip/Cargo.toml +++ b/gossip/Cargo.toml @@ -41,6 +41,7 @@ solana-metrics = { workspace = true } solana-net-utils = { workspace = true } solana-perf = { workspace = true } solana-rayon-threadlimit = { workspace = true } +solana-rpc-client = { workspace = true } solana-runtime = { workspace = true } solana-sanitize = { workspace = true } solana-sdk = { workspace = true } diff --git a/gossip/src/gossip_service.rs b/gossip/src/gossip_service.rs index b35cf1c58470bf..9e23e3eeee1c45 100644 --- a/gossip/src/gossip_service.rs +++ b/gossip/src/gossip_service.rs @@ -4,11 +4,10 @@ use { crate::{cluster_info::ClusterInfo, contact_info::ContactInfo}, crossbeam_channel::{unbounded, Sender}, rand::{thread_rng, Rng}, - solana_client::{ - connection_cache::ConnectionCache, rpc_client::RpcClient, tpu_client::TpuClientWrapper, - }, + solana_client::{connection_cache::ConnectionCache, tpu_client::TpuClientWrapper}, solana_net_utils::DEFAULT_IP_ECHO_SERVER_THREADS, solana_perf::recycler::Recycler, + solana_rpc_client::rpc_client::RpcClient, solana_runtime::bank_forks::BankForks, solana_sdk::{ pubkey::Pubkey, diff --git a/local-cluster/src/local_cluster.rs b/local-cluster/src/local_cluster.rs index 656dbb83725f23..9374e93770ba90 100644 --- a/local-cluster/src/local_cluster.rs +++ b/local-cluster/src/local_cluster.rs @@ -8,7 +8,7 @@ use { itertools::izip, log::*, solana_accounts_db::utils::create_accounts_run_and_snapshot_dirs, - solana_client::{connection_cache::ConnectionCache, rpc_client::RpcClient}, + solana_client::connection_cache::ConnectionCache, solana_core::{ consensus::tower_storage::FileTowerStorage, validator::{Validator, ValidatorConfig, ValidatorStartProgress}, @@ -19,6 +19,7 @@ use { gossip_service::discover_cluster, }, solana_ledger::{create_new_tmp_ledger, shred::Shred}, + solana_rpc_client::rpc_client::RpcClient, solana_runtime::{ genesis_utils::{ create_genesis_config_with_vote_accounts_and_cluster_type, GenesisConfigInfo, diff --git a/programs/sbf/Cargo.lock b/programs/sbf/Cargo.lock index a96a8c04b65763..9bb92afd81180a 100644 --- a/programs/sbf/Cargo.lock +++ b/programs/sbf/Cargo.lock @@ -5044,6 +5044,7 @@ dependencies = [ "solana-net-utils", "solana-perf", "solana-rayon-threadlimit", + "solana-rpc-client", "solana-runtime", "solana-sanitize", "solana-sdk", @@ -6324,7 +6325,6 @@ dependencies = [ "serde_json", "solana-accounts-db", "solana-cli-output", - "solana-client", "solana-compute-budget", "solana-core", "solana-geyser-plugin-manager", @@ -6335,6 +6335,7 @@ dependencies = [ "solana-program-test", "solana-rpc", "solana-rpc-client", + "solana-rpc-client-api", "solana-runtime", "solana-sdk", "solana-streamer", diff --git a/rpc-test/Cargo.toml b/rpc-test/Cargo.toml index eb69e4c95d8cdc..435edafdc5f780 100644 --- a/rpc-test/Cargo.toml +++ b/rpc-test/Cargo.toml @@ -33,6 +33,7 @@ solana-transaction-status = { workspace = true } tokio = { workspace = true, features = ["full"] } [dev-dependencies] +solana-connection-cache = { workspace = true } solana-logger = { workspace = true } [package.metadata.docs.rs] diff --git a/rpc-test/tests/nonblocking.rs b/rpc-test/tests/nonblocking.rs index 2a346c93e25a3a..160b01e1e4f41d 100644 --- a/rpc-test/tests/nonblocking.rs +++ b/rpc-test/tests/nonblocking.rs @@ -1,11 +1,9 @@ use { - solana_client::{ - connection_cache::Protocol, - nonblocking::tpu_client::{LeaderTpuService, TpuClient}, - tpu_client::TpuClientConfig, - }, + solana_client::nonblocking::tpu_client::{LeaderTpuService, TpuClient}, + solana_connection_cache::connection_cache::Protocol, solana_sdk::{clock::DEFAULT_MS_PER_SLOT, pubkey::Pubkey, system_transaction}, solana_test_validator::TestValidatorGenesis, + solana_tpu_client::tpu_client::TpuClientConfig, std::sync::{ atomic::{AtomicBool, Ordering}, Arc, diff --git a/rpc-test/tests/rpc.rs b/rpc-test/tests/rpc.rs index 463e2046867346..67d229d43a1823 100644 --- a/rpc-test/tests/rpc.rs +++ b/rpc-test/tests/rpc.rs @@ -6,10 +6,7 @@ use { reqwest::{self, header::CONTENT_TYPE}, serde_json::{json, Value}, solana_account_decoder::UiAccount, - solana_client::{ - connection_cache::ConnectionCache, - tpu_client::{TpuClient, TpuClientConfig}, - }, + solana_client::connection_cache::ConnectionCache, solana_pubsub_client::nonblocking::pubsub_client::PubsubClient, solana_rpc_client::rpc_client::RpcClient, solana_rpc_client_api::{ @@ -29,7 +26,7 @@ use { }, solana_streamer::socket::SocketAddrSpace, solana_test_validator::TestValidator, - solana_tpu_client::tpu_client::DEFAULT_TPU_CONNECTION_POOL_SIZE, + solana_tpu_client::tpu_client::{TpuClient, TpuClientConfig, DEFAULT_TPU_CONNECTION_POOL_SIZE}, solana_transaction_status::TransactionStatus, std::{ collections::HashSet, diff --git a/send-transaction-service/src/tpu_info.rs b/send-transaction-service/src/tpu_info.rs index 456a0ced0d3304..262a4b74babe5c 100644 --- a/send-transaction-service/src/tpu_info.rs +++ b/send-transaction-service/src/tpu_info.rs @@ -1,4 +1,7 @@ -use {solana_client::connection_cache::Protocol, solana_sdk::clock::Slot, std::net::SocketAddr}; +use { + solana_connection_cache::connection_cache::Protocol, solana_sdk::clock::Slot, + std::net::SocketAddr, +}; pub trait TpuInfo { fn refresh_recent_peers(&mut self); diff --git a/test-validator/Cargo.toml b/test-validator/Cargo.toml index 0068ddbfb2bf0a..1d73cf10c097a9 100644 --- a/test-validator/Cargo.toml +++ b/test-validator/Cargo.toml @@ -18,7 +18,6 @@ serde_derive = { workspace = true } serde_json = { workspace = true } solana-accounts-db = { workspace = true } solana-cli-output = { workspace = true } -solana-client = { workspace = true } solana-compute-budget = { workspace = true } solana-core = { workspace = true } solana-geyser-plugin-manager = { workspace = true } @@ -29,6 +28,7 @@ solana-net-utils = { workspace = true } solana-program-test = { workspace = true } solana-rpc = { workspace = true } solana-rpc-client = { workspace = true } +solana-rpc-client-api = { workspace = true } solana-runtime = { workspace = true } solana-sdk = { workspace = true } solana-streamer = { workspace = true } diff --git a/test-validator/src/lib.rs b/test-validator/src/lib.rs index da0d669b76393a..39616c1fdd4936 100644 --- a/test-validator/src/lib.rs +++ b/test-validator/src/lib.rs @@ -9,7 +9,6 @@ use { utils::create_accounts_run_and_snapshot_dirs, }, solana_cli_output::CliAccount, - solana_client::rpc_request::MAX_MULTIPLE_ACCOUNTS, solana_compute_budget::compute_budget::ComputeBudget, solana_core::{ admin_rpc_post_init::AdminRpcRequestMetadataPostInit, @@ -32,6 +31,7 @@ use { solana_net_utils::PortRange, solana_rpc::{rpc::JsonRpcConfig, rpc_pubsub_service::PubSubConfig}, solana_rpc_client::{nonblocking, rpc_client::RpcClient}, + solana_rpc_client_api::request::MAX_MULTIPLE_ACCOUNTS, solana_runtime::{ bank_forks::BankForks, genesis_utils::create_genesis_config_with_leader_ex, runtime_config::RuntimeConfig, snapshot_config::SnapshotConfig,