From fbfbfa2d472c05f92f7757d3e0cbc17afa522e18 Mon Sep 17 00:00:00 2001 From: Kevin Heavey Date: Wed, 13 Nov 2024 13:32:01 +0400 Subject: [PATCH] remove solana-sdk from solana-zk-sdk (#3418) * remove solana-sdk from solana-zk-sdk * post-rebase fix --- Cargo.lock | 6 +++++- programs/sbf/Cargo.lock | 5 ++++- zk-sdk/Cargo.toml | 9 ++++++++- zk-sdk/src/encryption/auth_encryption.rs | 15 ++++++--------- zk-sdk/src/encryption/elgamal.rs | 15 +++++++-------- zk-sdk/src/sigma_proofs/pubkey_validity.rs | 3 ++- 6 files changed, 32 insertions(+), 21 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 584033fe24acf9..cf2e8177cafaa0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -9293,9 +9293,13 @@ dependencies = [ "sha3", "solana-derivation-path", "solana-instruction", + "solana-keypair", "solana-pubkey", - "solana-sdk", "solana-sdk-ids", + "solana-seed-derivable", + "solana-seed-phrase", + "solana-signature", + "solana-signer", "subtle", "thiserror", "tiny-bip39", diff --git a/programs/sbf/Cargo.lock b/programs/sbf/Cargo.lock index 15a1710b1db2c7..970c65162bcb8a 100644 --- a/programs/sbf/Cargo.lock +++ b/programs/sbf/Cargo.lock @@ -7731,8 +7731,11 @@ dependencies = [ "solana-derivation-path", "solana-instruction", "solana-pubkey", - "solana-sdk", "solana-sdk-ids", + "solana-seed-derivable", + "solana-seed-phrase", + "solana-signature", + "solana-signer", "subtle", "thiserror", "wasm-bindgen", diff --git a/zk-sdk/Cargo.toml b/zk-sdk/Cargo.toml index ef68ca0b03a433..c822ab002105c8 100644 --- a/zk-sdk/Cargo.toml +++ b/zk-sdk/Cargo.toml @@ -22,6 +22,7 @@ solana-sdk-ids = { workspace = true } thiserror = { workspace = true } [dev-dependencies] +solana-keypair = { workspace = true } tiny-bip39 = { workspace = true } [target.'cfg(not(target_os = "solana"))'.dependencies] @@ -36,10 +37,16 @@ serde_derive = { workspace = true } serde_json = { workspace = true } sha3 = { workspace = true } solana-derivation-path = { workspace = true } -solana-sdk = { workspace = true } +solana-seed-derivable = { workspace = true } +solana-seed-phrase = { workspace = true } +solana-signature = { workspace = true } +solana-signer = { workspace = true } subtle = { workspace = true } zeroize = { workspace = true, features = ["zeroize_derive"] } +[target.'cfg(not(target_arch = "wasm32"))'.dependencies] +solana-pubkey = { workspace = true, features = ["bytemuck"] } + [target.'cfg(target_arch = "wasm32")'.dependencies] js-sys = { workspace = true } wasm-bindgen = { workspace = true } diff --git a/zk-sdk/src/encryption/auth_encryption.rs b/zk-sdk/src/encryption/auth_encryption.rs index e28b3fcc053ea9..b8a9d19d630327 100644 --- a/zk-sdk/src/encryption/auth_encryption.rs +++ b/zk-sdk/src/encryption/auth_encryption.rs @@ -25,13 +25,10 @@ use { sha3::Digest, sha3::Sha3_512, solana_derivation_path::DerivationPath, - solana_sdk::{ - signature::Signature, - signer::{ - keypair::generate_seed_from_seed_phrase_and_passphrase, EncodableKey, SeedDerivable, - Signer, SignerError, - }, - }, + solana_seed_derivable::SeedDerivable, + solana_seed_phrase::generate_seed_from_seed_phrase_and_passphrase, + solana_signature::Signature, + solana_signer::{EncodableKey, Signer, SignerError}, std::{ error, io::{Read, Write}, @@ -281,8 +278,8 @@ impl fmt::Display for AeCiphertext { #[cfg(test)] mod tests { use { - super::*, - solana_sdk::{pubkey::Pubkey, signature::Keypair, signer::null_signer::NullSigner}, + super::*, solana_keypair::Keypair, solana_pubkey::Pubkey, + solana_signer::null_signer::NullSigner, }; #[test] diff --git a/zk-sdk/src/encryption/elgamal.rs b/zk-sdk/src/encryption/elgamal.rs index 9df73d6b199b85..25003eff60a351 100644 --- a/zk-sdk/src/encryption/elgamal.rs +++ b/zk-sdk/src/encryption/elgamal.rs @@ -25,13 +25,10 @@ use { crate::encryption::discrete_log::DiscreteLog, sha3::Digest, solana_derivation_path::DerivationPath, - solana_sdk::{ - signature::Signature, - signer::{ - keypair::generate_seed_from_seed_phrase_and_passphrase, EncodableKey, EncodableKeypair, - SeedDerivable, Signer, SignerError, - }, - }, + solana_seed_derivable::SeedDerivable, + solana_seed_phrase::generate_seed_from_seed_phrase_and_passphrase, + solana_signature::Signature, + solana_signer::{EncodableKey, EncodableKeypair, Signer, SignerError}, std::{ error, io::{Read, Write}, @@ -838,7 +835,9 @@ mod tests { super::*, crate::encryption::pedersen::Pedersen, bip39::{Language, Mnemonic, MnemonicType, Seed}, - solana_sdk::{pubkey::Pubkey, signature::Keypair, signer::null_signer::NullSigner}, + solana_keypair::Keypair, + solana_pubkey::Pubkey, + solana_signer::null_signer::NullSigner, std::fs::{self, File}, }; diff --git a/zk-sdk/src/sigma_proofs/pubkey_validity.rs b/zk-sdk/src/sigma_proofs/pubkey_validity.rs index 52aca468c8b396..a8af3b51196c1c 100644 --- a/zk-sdk/src/sigma_proofs/pubkey_validity.rs +++ b/zk-sdk/src/sigma_proofs/pubkey_validity.rs @@ -143,7 +143,8 @@ mod test { crate::{ encryption::pod::elgamal::PodElGamalPubkey, sigma_proofs::pod::PodPubkeyValidityProof, }, - solana_sdk::{pubkey::Pubkey, signature::Keypair}, + solana_keypair::Keypair, + solana_pubkey::Pubkey, std::str::FromStr, };