From 47e8c10973085e383a0a1403619bb7988026c389 Mon Sep 17 00:00:00 2001 From: kevinheavey Date: Thu, 16 Jan 2025 16:47:47 +0400 Subject: [PATCH] remove solana-sdk from some cli modules --- Cargo.lock | 16 +++++++++++ cli/Cargo.toml | 16 +++++++++++ cli/src/address_lookup_table.rs | 32 +++++++++++----------- cli/src/checks.rs | 6 +++-- cli/src/cli.rs | 47 +++++++++++++++------------------ 5 files changed, 73 insertions(+), 44 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 906564f8316908..8a2b6d66bfea32 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6527,12 +6527,14 @@ dependencies = [ "serde", "serde_derive", "serde_json", + "solana-account", "solana-account-decoder", "solana-bpf-loader-program", "solana-clap-utils", "solana-cli-config", "solana-cli-output", "solana-client", + "solana-clock", "solana-commitment-config", "solana-compute-budget", "solana-config-program", @@ -6541,8 +6543,16 @@ dependencies = [ "solana-faucet", "solana-feature-gate-client", "solana-feature-set", + "solana-hash", + "solana-instruction", + "solana-keypair", "solana-loader-v4-program", "solana-logger", + "solana-message", + "solana-native-token", + "solana-offchain-message", + "solana-presigner", + "solana-program", "solana-program-runtime", "solana-pubkey", "solana-pubsub-client", @@ -6554,10 +6564,16 @@ dependencies = [ "solana-rpc-client-nonce-utils", "solana-sbpf", "solana-sdk", + "solana-sdk-ids", + "solana-signature", + "solana-signer", "solana-streamer", + "solana-system-interface", "solana-test-validator", "solana-tps-client", "solana-tpu-client", + "solana-transaction", + "solana-transaction-error", "solana-transaction-status", "solana-udp-client", "solana-version", diff --git a/cli/Cargo.toml b/cli/Cargo.toml index 25582e542a6bd7..94737b0cd94150 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -28,12 +28,14 @@ semver = { workspace = true } serde = { workspace = true } serde_derive = { workspace = true } serde_json = { workspace = true } +solana-account = { workspace = true } solana-account-decoder = { workspace = true } solana-bpf-loader-program = { workspace = true } solana-clap-utils = { workspace = true } solana-cli-config = { workspace = true } solana-cli-output = { workspace = true } solana-client = { workspace = true } +solana-clock = { workspace = true } solana-commitment-config = { workspace = true } solana-compute-budget = { workspace = true } solana-config-program = { workspace = true } @@ -41,8 +43,15 @@ solana-connection-cache = { workspace = true } solana-decode-error = { workspace = true } solana-feature-gate-client = { workspace = true } solana-feature-set = { workspace = true } +solana-hash = { workspace = true } +solana-instruction = { workspace = true } +solana-keypair = { workspace = true } solana-loader-v4-program = { workspace = true } solana-logger = { workspace = true } +solana-message = { workspace = true } +solana-native-token = { workspace = true } +solana-offchain-message = { workspace = true } +solana-program = { workspace = true } solana-program-runtime = { workspace = true } solana-pubkey = { workspace = true } solana-pubsub-client = { workspace = true } @@ -53,9 +62,15 @@ solana-rpc-client-api = { workspace = true } solana-rpc-client-nonce-utils = { workspace = true, features = ["clap"] } solana-sbpf = { workspace = true } solana-sdk = { workspace = true } +solana-sdk-ids = { workspace = true } +solana-signature = { workspace = true } +solana-signer = { workspace = true } solana-streamer = { workspace = true } +solana-system-interface = { workspace = true, features = ["bincode"] } solana-tps-client = { workspace = true } solana-tpu-client = { workspace = true, features = ["default"] } +solana-transaction = { workspace = true } +solana-transaction-error = { workspace = true } solana-transaction-status = { workspace = true } solana-udp-client = { workspace = true } solana-version = { workspace = true } @@ -67,6 +82,7 @@ tiny-bip39 = { workspace = true } [dev-dependencies] assert_matches = { workspace = true } solana-faucet = { workspace = true } +solana-presigner = { workspace = true } solana-rpc = { workspace = true } solana-streamer = { workspace = true } solana-test-validator = { workspace = true } diff --git a/cli/src/address_lookup_table.rs b/cli/src/address_lookup_table.rs index cb429ad04328f0..7dc861d13636f1 100644 --- a/cli/src/address_lookup_table.rs +++ b/cli/src/address_lookup_table.rs @@ -1,29 +1,27 @@ use { crate::cli::{CliCommand, CliCommandInfo, CliConfig, CliError, ProcessResult}, clap::{App, AppSettings, Arg, ArgMatches, SubCommand}, + solana_account::from_account, solana_clap_utils::{self, input_parsers::*, input_validators::*, keypair::*}, solana_cli_output::{CliAddressLookupTable, CliAddressLookupTableCreated, CliSignature}, + solana_clock::Clock, solana_commitment_config::CommitmentConfig, + solana_message::Message, + solana_program::address_lookup_table::{ + self, + instruction::{ + close_lookup_table, create_lookup_table, deactivate_lookup_table, extend_lookup_table, + freeze_lookup_table, + }, + state::AddressLookupTable, + }, + solana_pubkey::Pubkey, solana_remote_wallet::remote_wallet::RemoteWalletManager, solana_rpc_client::rpc_client::RpcClient, solana_rpc_client_api::config::RpcSendTransactionConfig, - solana_sdk::{ - account::from_account, - address_lookup_table::{ - self, - instruction::{ - close_lookup_table, create_lookup_table, deactivate_lookup_table, - extend_lookup_table, freeze_lookup_table, - }, - state::AddressLookupTable, - }, - clock::Clock, - message::Message, - pubkey::Pubkey, - signer::Signer, - sysvar, - transaction::Transaction, - }, + solana_sdk_ids::sysvar, + solana_signer::Signer, + solana_transaction::Transaction, std::{rc::Rc, sync::Arc}, }; diff --git a/cli/src/checks.rs b/cli/src/checks.rs index bfa35e58fc424f..cd688c1ff1774f 100644 --- a/cli/src/checks.rs +++ b/cli/src/checks.rs @@ -1,9 +1,11 @@ use { crate::cli::CliError, solana_commitment_config::CommitmentConfig, + solana_message::Message, + solana_native_token::lamports_to_sol, + solana_pubkey::Pubkey, solana_rpc_client::rpc_client::RpcClient, solana_rpc_client_api::client_error::{Error as ClientError, Result as ClientResult}, - solana_sdk::{message::Message, native_token::lamports_to_sol, pubkey::Pubkey}, }; pub fn check_account_for_fee( @@ -176,7 +178,7 @@ mod tests { request::RpcRequest, response::{Response, RpcResponseContext}, }, - solana_sdk::system_instruction, + solana_system_interface::instruction as system_instruction, std::collections::HashMap, }; diff --git a/cli/src/cli.rs b/cli/src/cli.rs index 102bedb407a8de..4b051908df4513 100644 --- a/cli/src/cli.rs +++ b/cli/src/cli.rs @@ -13,8 +13,15 @@ use { display::println_name_value, CliSignature, CliValidatorsSortOrder, OutputFormat, }, solana_client::connection_cache::ConnectionCache, + solana_clock::{Epoch, Slot}, solana_commitment_config::CommitmentConfig, solana_decode_error::DecodeError, + solana_hash::Hash, + solana_instruction::error::InstructionError, + solana_keypair::{read_keypair_file, Keypair}, + solana_offchain_message::OffchainMessage, + solana_program::stake::{instruction::LockupArgs, state::Lockup}, + solana_pubkey::Pubkey, solana_remote_wallet::remote_wallet::RemoteWalletManager, solana_rpc_client::rpc_client::RpcClient, solana_rpc_client_api::{ @@ -22,21 +29,14 @@ use { config::{RpcLargestAccountsFilter, RpcSendTransactionConfig, RpcTransactionLogsFilter}, }, solana_rpc_client_nonce_utils::blockhash_query::BlockhashQuery, - solana_sdk::{ - clock::{Epoch, Slot}, - hash::Hash, - instruction::InstructionError, - offchain_message::OffchainMessage, - pubkey::Pubkey, - signature::{Signature, Signer, SignerError}, - signer::keypair::{read_keypair_file, Keypair}, - stake::{instruction::LockupArgs, state::Lockup}, - transaction::{TransactionError, VersionedTransaction}, - }, + solana_signature::Signature, + solana_signer::{Signer, SignerError}, solana_tps_client::{utils::create_connection_cache, TpsClient}, solana_tpu_client::tpu_client::{ TpuClient, TpuClientConfig, DEFAULT_TPU_CONNECTION_POOL_SIZE, DEFAULT_TPU_ENABLE_UDP, }, + solana_transaction::versioned::VersionedTransaction, + solana_transaction_error::TransactionError, solana_vote_program::vote_state::VoteAuthorize, std::{ collections::HashMap, error, io::stdout, process::exit, rc::Rc, str::FromStr, sync::Arc, @@ -1789,20 +1789,17 @@ mod tests { use { super::*, serde_json::json, + solana_keypair::{keypair_from_seed, read_keypair_file, write_keypair_file, Keypair}, + solana_presigner::Presigner, + solana_pubkey::Pubkey, solana_rpc_client::mock_sender_for_cli::SIGNATURE, solana_rpc_client_api::{ request::RpcRequest, response::{Response, RpcResponseContext}, }, solana_rpc_client_nonce_utils::blockhash_query, - solana_sdk::{ - pubkey::Pubkey, - signature::{ - keypair_from_seed, read_keypair_file, write_keypair_file, Keypair, Presigner, - }, - stake, system_program, - transaction::TransactionError, - }, + solana_sdk_ids::{stake, system_program}, + solana_transaction_error::TransactionError, solana_transaction_status::TransactionConfirmationStatus, }; @@ -1983,8 +1980,8 @@ mod tests { let from_pubkey = solana_pubkey::new_rand(); let from_str = from_pubkey.to_string(); for (name, program_id) in &[ - ("STAKE", stake::program::id()), - ("VOTE", solana_vote_program::id()), + ("STAKE", stake::id()), + ("VOTE", solana_sdk_ids::vote::id()), ("NONCE", system_program::id()), ] { let test_create_address_with_seed = test_commands.clone().get_matches_from(vec![ @@ -2016,7 +2013,7 @@ mod tests { command: CliCommand::CreateAddressWithSeed { from_pubkey: None, seed: "seed".to_string(), - program_id: stake::program::id(), + program_id: stake::id(), }, signers: vec![Box::new(read_keypair_file(&keypair_file).unwrap())], } @@ -2324,11 +2321,11 @@ mod tests { config.command = CliCommand::CreateAddressWithSeed { from_pubkey: Some(from_pubkey), seed: "seed".to_string(), - program_id: stake::program::id(), + program_id: stake::id(), }; let address = process_command(&config); let expected_address = - Pubkey::create_with_seed(&from_pubkey, "seed", &stake::program::id()).unwrap(); + Pubkey::create_with_seed(&from_pubkey, "seed", &stake::id()).unwrap(); assert_eq!(address.unwrap(), expected_address.to_string()); // Need airdrop cases @@ -2717,7 +2714,7 @@ mod tests { memo: None, fee_payer: 0, derived_address_seed: Some(derived_address_seed), - derived_address_program_id: Some(stake::program::id()), + derived_address_program_id: Some(stake::id()), compute_unit_price: None, }, signers: vec![Box::new(read_keypair_file(&default_keypair_file).unwrap()),],