From 4bc0defc9ad7e3693a844971385f32c81bd2274e Mon Sep 17 00:00:00 2001 From: Kevin Heavey Date: Fri, 15 Nov 2024 09:09:59 +0400 Subject: [PATCH] remove solana-sdk from solana-clap-utils (#3626) --- Cargo.lock | 13 ++++++++++++- clap-utils/Cargo.toml | 16 ++++++++++++++-- clap-utils/src/input_parsers.rs | 28 ++++++++++++++-------------- clap-utils/src/input_validators.rs | 11 +++++------ clap-utils/src/keypair.rs | 26 ++++++++++++++------------ programs/sbf/Cargo.lock | 27 ++++++++++++++++++++++++++- 6 files changed, 85 insertions(+), 36 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1c313de54e3402..7d015ada9184f0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6321,9 +6321,20 @@ dependencies = [ "chrono", "clap 2.33.3", "rpassword", + "solana-clock", + "solana-cluster-type", + "solana-commitment-config", "solana-derivation-path", + "solana-hash", + "solana-keypair", + "solana-native-token", + "solana-presigner", + "solana-program", + "solana-pubkey", "solana-remote-wallet", - "solana-sdk", + "solana-seed-phrase", + "solana-signature", + "solana-signer", "tempfile", "thiserror 1.0.69", "tiny-bip39", diff --git a/clap-utils/Cargo.toml b/clap-utils/Cargo.toml index 48969c708957eb..78c06a187179bd 100644 --- a/clap-utils/Cargo.toml +++ b/clap-utils/Cargo.toml @@ -13,9 +13,20 @@ edition = { workspace = true } chrono = { workspace = true, features = ["default"] } clap = "2.33.0" rpassword = { workspace = true } +solana-clock = { workspace = true } +solana-cluster-type = { workspace = true } +solana-commitment-config = { workspace = true } solana-derivation-path = { workspace = true } -solana-remote-wallet = { workspace = true } -solana-sdk = { workspace = true } +solana-hash = { workspace = true } +solana-keypair = { workspace = true, features = ["seed-derivable"] } +solana-native-token = { workspace = true } +solana-presigner = { workspace = true } +solana-program = { workspace = true } +solana-pubkey = { workspace = true } +solana-remote-wallet = { workspace = true, features = ["default"] } +solana-seed-phrase = { workspace = true } +solana-signature = { workspace = true } +solana-signer = { workspace = true } thiserror = { workspace = true } tiny-bip39 = { workspace = true } uriparse = { workspace = true } @@ -23,6 +34,7 @@ url = { workspace = true } [dev-dependencies] assert_matches = { workspace = true } +solana-pubkey = { workspace = true, features = ["rand"] } tempfile = { workspace = true } [lib] diff --git a/clap-utils/src/input_parsers.rs b/clap-utils/src/input_parsers.rs index f28425bf5ad28c..3cf90d464b295c 100644 --- a/clap-utils/src/input_parsers.rs +++ b/clap-utils/src/input_parsers.rs @@ -5,15 +5,15 @@ use { }, chrono::DateTime, clap::ArgMatches, + solana_clock::UnixTimestamp, + solana_cluster_type::ClusterType, + solana_commitment_config::CommitmentConfig, + solana_keypair::{read_keypair_file, Keypair}, + solana_native_token::sol_to_lamports, + solana_pubkey::Pubkey, solana_remote_wallet::remote_wallet::RemoteWalletManager, - solana_sdk::{ - clock::UnixTimestamp, - commitment_config::CommitmentConfig, - genesis_config::ClusterType, - native_token::sol_to_lamports, - pubkey::Pubkey, - signature::{read_keypair_file, Keypair, Signature, Signer}, - }, + solana_signature::Signature, + solana_signer::Signer, std::{rc::Rc, str::FromStr}, }; @@ -199,7 +199,7 @@ mod tests { use { super::*, clap::{App, Arg}, - solana_sdk::signature::write_keypair_file, + solana_keypair::write_keypair_file, std::fs, }; @@ -228,8 +228,8 @@ mod tests { assert_eq!(values_of(&matches, "multiple"), Some(vec![50, 39])); assert_eq!(values_of::(&matches, "single"), None); - let pubkey0 = solana_sdk::pubkey::new_rand(); - let pubkey1 = solana_sdk::pubkey::new_rand(); + let pubkey0 = solana_pubkey::new_rand(); + let pubkey1 = solana_pubkey::new_rand(); let matches = app().get_matches_from(vec![ "test", "--multiple", @@ -249,7 +249,7 @@ mod tests { assert_eq!(value_of(&matches, "single"), Some(50)); assert_eq!(value_of::(&matches, "multiple"), None); - let pubkey = solana_sdk::pubkey::new_rand(); + let pubkey = solana_pubkey::new_rand(); let matches = app().get_matches_from(vec!["test", "--single", &pubkey.to_string()]); assert_eq!(value_of(&matches, "single"), Some(pubkey)); } @@ -315,8 +315,8 @@ mod tests { #[test] fn test_pubkeys_sigs_of() { - let key1 = solana_sdk::pubkey::new_rand(); - let key2 = solana_sdk::pubkey::new_rand(); + let key1 = solana_pubkey::new_rand(); + let key2 = solana_pubkey::new_rand(); let sig1 = Keypair::new().sign_message(&[0u8]); let sig2 = Keypair::new().sign_message(&[1u8]); let signer1 = format!("{key1}={sig1}"); diff --git a/clap-utils/src/input_validators.rs b/clap-utils/src/input_validators.rs index fbe72d987c205a..fe9aeb3141f4b5 100644 --- a/clap-utils/src/input_validators.rs +++ b/clap-utils/src/input_validators.rs @@ -1,12 +1,11 @@ use { crate::keypair::{parse_signer_source, SignerSourceKind, ASK_KEYWORD}, chrono::DateTime, - solana_sdk::{ - clock::{Epoch, Slot}, - hash::Hash, - pubkey::{Pubkey, MAX_SEED_LEN}, - signature::{read_keypair_file, Signature}, - }, + solana_clock::{Epoch, Slot}, + solana_hash::Hash, + solana_keypair::read_keypair_file, + solana_pubkey::{Pubkey, MAX_SEED_LEN}, + solana_signature::Signature, std::{fmt::Display, ops::RangeBounds, str::FromStr}, }; diff --git a/clap-utils/src/keypair.rs b/clap-utils/src/keypair.rs index bddd20c3361c18..969abe117e5624 100644 --- a/clap-utils/src/keypair.rs +++ b/clap-utils/src/keypair.rs @@ -19,21 +19,22 @@ use { clap::ArgMatches, rpassword::prompt_password, solana_derivation_path::{DerivationPath, DerivationPathError}, + solana_hash::Hash, + solana_keypair::{ + keypair_from_seed, keypair_from_seed_phrase_and_passphrase, read_keypair, + read_keypair_file, seed_derivable::keypair_from_seed_and_derivation_path, Keypair, + }, + solana_presigner::Presigner, + solana_program::message::Message, + solana_pubkey::Pubkey, solana_remote_wallet::{ locator::{Locator as RemoteWalletLocator, LocatorError as RemoteWalletLocatorError}, remote_keypair::generate_remote_keypair, remote_wallet::{maybe_wallet_manager, RemoteWalletError, RemoteWalletManager}, }, - solana_sdk::{ - hash::Hash, - message::Message, - pubkey::Pubkey, - signature::{ - generate_seed_from_seed_phrase_and_passphrase, keypair_from_seed, - keypair_from_seed_and_derivation_path, keypair_from_seed_phrase_and_passphrase, - read_keypair, read_keypair_file, Keypair, NullSigner, Presigner, Signature, Signer, - }, - }, + solana_seed_phrase::generate_seed_from_seed_phrase_and_passphrase, + solana_signature::Signature, + solana_signer::{null_signer::NullSigner, Signer}, std::{ cell::RefCell, convert::TryFrom, @@ -207,7 +208,7 @@ impl DefaultSigner { /// use clap::{App, Arg, value_t_or_exit}; /// use solana_clap_utils::keypair::{DefaultSigner, signer_from_path}; /// use solana_clap_utils::offline::OfflineArgs; - /// use solana_sdk::signer::Signer; + /// use solana_signer::Signer; /// /// let clap_app = App::new("my-program") /// // The argument we'll parse as a signer "path" @@ -1123,8 +1124,9 @@ mod tests { crate::offline::OfflineArgs, assert_matches::assert_matches, clap::{value_t_or_exit, App, Arg}, + solana_keypair::write_keypair_file, + solana_program::system_instruction, solana_remote_wallet::{locator::Manufacturer, remote_wallet::initialize_wallet_manager}, - solana_sdk::{signer::keypair::write_keypair_file, system_instruction}, tempfile::{NamedTempFile, TempDir}, }; diff --git a/programs/sbf/Cargo.lock b/programs/sbf/Cargo.lock index 67af139491beea..ba57249ce81a99 100644 --- a/programs/sbf/Cargo.lock +++ b/programs/sbf/Cargo.lock @@ -2141,6 +2141,19 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286" +[[package]] +name = "hidapi" +version = "2.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03b876ecf37e86b359573c16c8366bc3eba52b689884a0fc42ba3f67203d2a8b" +dependencies = [ + "cc", + "cfg-if 1.0.0", + "libc", + "pkg-config", + "windows-sys 0.48.0", +] + [[package]] name = "histogram" version = "0.6.9" @@ -5154,9 +5167,20 @@ dependencies = [ "chrono", "clap", "rpassword", + "solana-clock", + "solana-cluster-type", + "solana-commitment-config", "solana-derivation-path", + "solana-hash", + "solana-keypair", + "solana-native-token", + "solana-presigner", + "solana-program", + "solana-pubkey", "solana-remote-wallet", - "solana-sdk", + "solana-seed-phrase", + "solana-signature", + "solana-signer", "thiserror 1.0.69", "tiny-bip39", "uriparse", @@ -6301,6 +6325,7 @@ version = "2.2.0" dependencies = [ "console", "dialoguer", + "hidapi", "log", "num-derive", "num-traits",