Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3,127 changes: 1,875 additions & 1,252 deletions Cargo.lock

Large diffs are not rendered by default.

16 changes: 9 additions & 7 deletions clients/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,26 @@ futures = "0.3"
serde = "1.0.219"
serde_derive = "1.0.103"
serde_json = "1.0.149"
solana-account-decoder = "3.0.0"
solana-account-decoder = "4.0.0-beta.7"
solana-clap-v3-utils = { version = "3.1.0", features = ["agave-unstable-api"] }
solana-cli-config = { version = "3.1.0", features = ["agave-unstable-api"] }
solana-cli-output = { version = "3.1.0", features = ["agave-unstable-api"] }
solana-client = { version = "3.1.0", features = ["agave-unstable-api"] }
solana-cli-config = { version = "4.0.0-beta.7", features = ["agave-unstable-api"] }
solana-cli-output = { version = "4.0.0-beta.7", features = ["agave-unstable-api"] }
solana-client = { version = "4.0.0-beta.7", features = ["agave-unstable-api"] }
solana-commitment-config = "3.1.1"
solana-logger = "3.0.0"
solana-remote-wallet = { version = "3.1.0", features = ["agave-unstable-api"] }
solana-sdk = "3.0.0"
solana-system-interface = "3.0.0"
solana-transaction-status = "3.0.0"
solana-zk-sdk = "6.0.1"
solana-zk-sdk-pod = "0.1.1"
spl-associated-token-account-interface = { version = "2.0.0" }
spl-pod = { version = "0.7.3" }
spl-token-interface = "2.0.0"
spl-token-2022-interface = { version = "2.0.0", path = "../../interface" }
spl-token-2022 = { version = "10.0.0", path = "../../program", features = ["no-entrypoint"] }
spl-token-client = { version = "0.18.0", path = "../rust-legacy" }
spl-token-confidential-transfer-proof-generation = { version = "0.5.0", path = "../../confidential/proof-generation" }
spl-token-confidential-transfer-proof-generation = { version = "0.6.0", path = "../../confidential/proof-generation" }
spl-token-metadata-interface = { version = "0.8.0" }
spl-token-group-interface = { version = "0.7.0" }
spl-memo-interface = "2.0.0"
Expand All @@ -47,9 +49,9 @@ strum_macros = "0.28"
tokio = "1.52"

[dev-dependencies]
solana-nonce = "3.2.0"
solana-nonce = "3.1.0"
solana-sdk-ids = "3.1.0"
solana-test-validator = { version = "3.1.0", features = ["agave-unstable-api"] }
solana-test-validator = { version = "4.0.0-beta.7", features = ["agave-unstable-api"] }
assert_cmd = "2.2.1"
libtest-mimic = "0.8"
serial_test = "3.4.0"
Expand Down
10 changes: 5 additions & 5 deletions clients/cli/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ use {
signature::{Keypair, Signer},
},
solana_system_interface::program as system_program,
solana_zk_sdk::encryption::{
auth_encryption::AeKey,
elgamal::{self, ElGamalKeypair},
},
solana_zk_sdk_pod::encryption::elgamal::PodElGamalPubkey,
spl_associated_token_account_interface::address::get_associated_token_address_with_program_id,
spl_pod::optional_keys::OptionalNonZeroPubkey,
spl_token_2022_interface::{
Expand All @@ -55,11 +60,6 @@ use {
transfer_hook::TransferHook,
BaseStateWithExtensions, ExtensionType, StateWithExtensionsOwned,
},
solana_zk_sdk::encryption::{
auth_encryption::AeKey,
elgamal::{self, ElGamalKeypair},
pod::elgamal::PodElGamalPubkey,
},
state::{Account, AccountState, Mint},
},
spl_token_client::{
Expand Down
6 changes: 2 additions & 4 deletions clients/cli/src/encryption_keypair.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@
use {
base64::{prelude::BASE64_STANDARD, Engine},
clap::ArgMatches,
spl_token_2022_interface::solana_zk_sdk::encryption::{
elgamal::{ElGamalKeypair, ElGamalPubkey},
pod::elgamal::PodElGamalPubkey,
},
solana_zk_sdk::encryption::elgamal::{ElGamalKeypair, ElGamalPubkey},
solana_zk_sdk_pod::encryption::elgamal::PodElGamalPubkey,
};

const ELGAMAL_PUBKEY_MAX_BASE64_LEN: usize = 44;
Expand Down
4 changes: 2 additions & 2 deletions clients/cli/tests/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ use {
solana_sdk_ids::bpf_loader_upgradeable,
solana_system_interface::{instruction as system_instruction, program as system_program},
solana_test_validator::{TestValidator, TestValidatorGenesis, UpgradeableProgramInfo},
solana_zk_sdk_pod::encryption::elgamal::PodElGamalPubkey,
spl_associated_token_account_interface::address::get_associated_token_address_with_program_id,
spl_token_2022_interface::{
extension::{
Expand All @@ -35,7 +36,6 @@ use {
BaseStateWithExtensions, ExtensionType, StateWithExtensionsOwned,
},
instruction::create_native_mint,
solana_zk_sdk::encryption::pod::elgamal::PodElGamalPubkey,
state::{Account, AccountState, Mint, Multisig},
},
spl_token_cli::{
Expand Down Expand Up @@ -2909,7 +2909,7 @@ async fn transfer_fee_basis_point(test_validator: &TestValidator, payer: &Keypai
}

async fn confidential_transfer(test_validator: &TestValidator, payer: &Keypair) {
use spl_token_2022_interface::solana_zk_sdk::encryption::elgamal::ElGamalKeypair;
use solana_zk_sdk::encryption::elgamal::ElGamalKeypair;

let config =
test_config_with_default_signer(test_validator, payer, &spl_token_2022_interface::id());
Expand Down
24 changes: 13 additions & 11 deletions clients/rust-legacy/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,36 +27,38 @@ futures = "0.3.32"
futures-util = "0.3"
solana-account = "3.2.0"
solana-address = "2.6.0"
solana-banks-client = { version = "3.0.0", optional = true }
solana-banks-interface = { version = "3.0.0", optional = true }
solana-banks-client = { version = "4.0.0-beta.7", optional = true }
solana-banks-interface = { version = "4.0.0-beta.7", optional = true }
solana-compute-budget-interface = "3.0.0"
solana-cli-output = { version = "3.1.0", features = ["agave-unstable-api"], optional = true }
solana-hash = "4.3.0"
solana-cli-output = { version = "4.0.0-beta.7", features = ["agave-unstable-api"], optional = true }
solana-hash = "4.2.0"
solana-instruction = "3.0.0"
solana-message = "3.0.0"
solana-packet = "4.1.0"
solana-program-error = "3.0.1"
solana-program-pack = "3.1.0"
solana-program-test = { version = "3.0.0", optional = true }
solana-rpc-client = "3.0.0"
solana-rpc-client-api = "3.0.0"
solana-program-test = { version = "4.0.0-beta.7", optional = true, features = ["agave-unstable-api"] }
solana-rpc-client = "4.0.0-beta.7"
solana-rpc-client-api = "4.0.0-beta.7"
solana-signature = "3.0.0"
solana-signer = "3.0.0"
solana-system-interface = "3.0.0"
solana-transaction = "3.0.0"
solana-zk-sdk = "4.0.0"
solana-zk-sdk = "6.0.1"
spl-associated-token-account-interface = { version = "2.0.0" }
spl-elgamal-registry = { version = "0.4.0", path = "../../confidential/elgamal-registry", features = ["no-entrypoint"] }
spl-memo-interface = "2.0.0"
spl-record = { version = "0.4.0", features = ["no-entrypoint"] }
spl-token-interface = "2.0.0"
spl-token-confidential-transfer-proof-extraction = { path = "../../confidential/proof-extraction", version = "0.5.0" }
spl-token-confidential-transfer-proof-generation = { path = "../../confidential/proof-generation", version = "0.5.0" }
spl-token-confidential-transfer-proof-extraction = { path = "../../confidential/proof-extraction", version = "0.6.0" }
spl-token-confidential-transfer-proof-generation = { path = "../../confidential/proof-generation", version = "0.6.0" }
spl-token-2022-interface = { version = "2.0.0", path = "../../interface" }
spl-token-2022 = { version = "10.0.0", path = "../../program", features = ["no-entrypoint"] }
spl-token-group-interface = { version = "0.7.0" }
spl-token-metadata-interface = { version = "0.8.0" }
spl-transfer-hook-interface = { version = "2.1.0" }
solana-zk-sdk-pod = "0.1.1"
solana-zk-elgamal-proof-interface = "0.1.2"
tokio = "1"
thiserror = "2.0"

Expand All @@ -65,7 +67,7 @@ async-trait = "0.1"
borsh = "1.6.1"
bytemuck = "1.25.0"
futures-util = "0.3"
solana-program-test = { version = "3.1.0", features = ["agave-unstable-api"] }
solana-program-test = { version = "4.0.0-beta.7", features = ["agave-unstable-api"] }
solana-sdk = "3.0.0"
solana-sdk-ids = "3.1.0"
spl-pod = { version = "0.7.3" }
Expand Down
35 changes: 18 additions & 17 deletions clients/rust-legacy/src/token.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,23 @@ use {
solana_signer::{signers::Signers, Signer, SignerError},
solana_system_interface::instruction as system_instruction,
solana_transaction::Transaction,
solana_zk_elgamal_proof_interface::{
self as zk_elgamal_proof_program,
instruction::{close_context_state, ContextStateInfo},
proof_data::*,
state::ProofContextState,
},
solana_zk_sdk::{
encryption::{
auth_encryption::AeKey,
elgamal::{ElGamalCiphertext, ElGamalKeypair, ElGamalPubkey, ElGamalSecretKey},
},
zk_elgamal_proof_program::build_pubkey_validity_proof_data,
},
solana_zk_sdk_pod::encryption::{
auth_encryption::PodAeCiphertext,
elgamal::{PodElGamalCiphertext, PodElGamalPubkey},
},
spl_associated_token_account_interface::{
address::get_associated_token_address_with_program_id,
instruction::{
Expand All @@ -50,22 +67,6 @@ use {
ExtensionType, StateWithExtensionsOwned,
},
instruction,
solana_zk_sdk::{
encryption::{
auth_encryption::AeKey,
elgamal::{ElGamalCiphertext, ElGamalKeypair, ElGamalPubkey, ElGamalSecretKey},
pod::{
auth_encryption::PodAeCiphertext,
elgamal::{PodElGamalCiphertext, PodElGamalPubkey},
},
},
zk_elgamal_proof_program::{
self,
instruction::{close_context_state, ContextStateInfo},
proof_data::*,
state::ProofContextState,
},
},
state::{Account, AccountState, Mint, Multisig},
},
spl_token_confidential_transfer_proof_extraction::instruction::{
Expand Down Expand Up @@ -2083,7 +2084,7 @@ where
None
} else {
Some(
confidential_transfer::instruction::PubkeyValidityProofData::new(elgamal_keypair)
build_pubkey_validity_proof_data(elgamal_keypair)
.map_err(|_| TokenError::ProofGeneration)?,
)
};
Expand Down
13 changes: 7 additions & 6 deletions clients/rust-legacy/src/zk_proofs/confidential_mint_burn.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
use {
solana_zk_elgamal_proof_interface::proof_data::CiphertextCiphertextEqualityProofData,
solana_zk_sdk::{
encryption::{
auth_encryption::{AeCiphertext, AeKey},
elgamal::{ElGamalCiphertext, ElGamalKeypair, ElGamalPubkey},
pedersen::PedersenOpening,
pod::{
auth_encryption::PodAeCiphertext,
elgamal::{PodElGamalCiphertext, PodElGamalPubkey},
},
},
zk_elgamal_proof_program::proof_data::CiphertextCiphertextEqualityProofData,
zk_elgamal_proof_program::build_ciphertext_ciphertext_equality_proof_data,
},
solana_zk_sdk_pod::encryption::{
auth_encryption::PodAeCiphertext,
elgamal::{PodElGamalCiphertext, PodElGamalPubkey},
},
spl_token_2022_interface::{
error::TokenError,
Expand Down Expand Up @@ -98,7 +99,7 @@ impl SupplyAccountInfo {
let new_supply_ciphertext =
new_supply_elgamal_pubkey.encrypt_with(current_supply, &new_supply_opening);

CiphertextCiphertextEqualityProofData::new(
build_ciphertext_ciphertext_equality_proof_data(
current_supply_elgamal_keypair,
new_supply_elgamal_pubkey,
&self
Expand Down
5 changes: 3 additions & 2 deletions clients/rust-legacy/src/zk_proofs/confidential_transfer.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
use {
solana_zk_elgamal_proof_interface::proof_data::ZeroCiphertextProofData,
solana_zk_sdk::{
encryption::{
auth_encryption::{AeCiphertext, AeKey},
elgamal::{ElGamalKeypair, ElGamalPubkey, ElGamalSecretKey},
},
zk_elgamal_proof_program::proof_data::ZeroCiphertextProofData,
zk_elgamal_proof_program::build_zero_ciphertext_proof_data,
},
spl_token_2022_interface::{
error::TokenError,
Expand Down Expand Up @@ -47,7 +48,7 @@ impl EmptyAccountAccountInfo {
.try_into()
.map_err(|_| TokenError::MalformedCiphertext)?;

ZeroCiphertextProofData::new(elgamal_keypair, &available_balance)
build_zero_ciphertext_proof_data(elgamal_keypair, &available_balance)
.map_err(|_| TokenError::ProofGeneration)
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
use {
solana_zk_elgamal_proof_interface::proof_data::ciphertext_ciphertext_equality::CiphertextCiphertextEqualityProofData,
solana_zk_sdk::{
encryption::{
elgamal::{ElGamalCiphertext, ElGamalKeypair, ElGamalPubkey},
pedersen::PedersenOpening,
},
zk_elgamal_proof_program::proof_data::ciphertext_ciphertext_equality::CiphertextCiphertextEqualityProofData,
zk_elgamal_proof_program::build_ciphertext_ciphertext_equality_proof_data,
},
spl_token_2022_interface::{
error::TokenError, extension::confidential_transfer_fee::EncryptedWithheldAmount,
Expand Down Expand Up @@ -48,7 +49,7 @@ impl WithheldTokensInfo {
let destination_ciphertext = destination_elgamal_pubkey
.encrypt_with(decrypted_withheld_amount_in_mint, &destination_opening);

CiphertextCiphertextEqualityProofData::new(
build_ciphertext_ciphertext_equality_proof_data(
withdraw_withheld_authority_elgamal_keypair,
destination_elgamal_pubkey,
&withheld_amount_in_mint,
Expand Down
5 changes: 2 additions & 3 deletions clients/rust-legacy/tests/confidential_mint_burn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ use {
transaction::TransactionError,
transport::TransportError,
},
solana_zk_sdk::encryption::{auth_encryption::*, elgamal::*},
solana_zk_sdk_pod::encryption::elgamal::PodElGamalCiphertext,
spl_token_2022_interface::{
error::TokenError,
extension::{
Expand All @@ -18,9 +20,6 @@ use {
ExtensionType,
},
instruction::AuthorityType,
solana_zk_sdk::encryption::{
auth_encryption::*, elgamal::*, pod::elgamal::PodElGamalCiphertext,
},
},
spl_token_client::{
client::{ProgramBanksClientProcessTransaction, SendTransaction, SimulateTransaction},
Expand Down
23 changes: 10 additions & 13 deletions clients/rust-legacy/tests/confidential_transfer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,18 @@ use {
transport::TransportError,
},
solana_system_interface::instruction as system_instruction,
solana_zk_sdk::{
encryption::{auth_encryption::*, elgamal::*},
zk_elgamal_proof_program::build_pubkey_validity_proof_data,
},
solana_zk_sdk_pod::encryption::elgamal::PodElGamalCiphertext,
spl_elgamal_registry::state::ELGAMAL_REGISTRY_ACCOUNT_LEN,
spl_token_2022_interface::{
error::TokenError,
extension::{
confidential_transfer::{
self, ConfidentialTransferAccount, MAXIMUM_DEPOSIT_TRANSFER_AMOUNT,
},
confidential_transfer::{ConfidentialTransferAccount, MAXIMUM_DEPOSIT_TRANSFER_AMOUNT},
BaseStateWithExtensions, ExtensionType,
},
solana_zk_sdk::{
encryption::{auth_encryption::*, elgamal::*, pod::elgamal::PodElGamalCiphertext},
zk_elgamal_proof_program::proof_data::*,
},
},
spl_token_client::{
client::ProgramBanksClientProcessTransaction,
Expand Down Expand Up @@ -74,7 +73,8 @@ async fn configure_account_with_option<S: Signers>(
.await
}
ConfidentialTransferOption::ContextStateAccount => {
let pubkey_validity_proof_data = PubkeyValidityProofData::new(elgamal_keypair).unwrap();
let pubkey_validity_proof_data =
build_pubkey_validity_proof_data(elgamal_keypair).unwrap();

let pubkey_validity_proof_context_account = Keypair::new();
let context_account_authority = Keypair::new();
Expand Down Expand Up @@ -2651,8 +2651,7 @@ async fn confidential_transfer_configure_token_account_with_registry() {

// create ElGamal registry
let ctx = context.context.lock().await;
let proof_data =
confidential_transfer::instruction::PubkeyValidityProofData::new(&elgamal_keypair).unwrap();
let proof_data = build_pubkey_validity_proof_data(&elgamal_keypair).unwrap();
let proof_location = ProofLocation::InstructionOffset(1.try_into().unwrap(), &proof_data);

let elgamal_registry_address = spl_elgamal_registry::get_elgamal_registry_address(
Expand Down Expand Up @@ -2684,9 +2683,7 @@ async fn confidential_transfer_configure_token_account_with_registry() {
let new_elgamal_keypair =
ElGamalKeypair::new_from_signer(&alice, &alice_account_keypair.pubkey().to_bytes())
.unwrap();
let proof_data =
confidential_transfer::instruction::PubkeyValidityProofData::new(&new_elgamal_keypair)
.unwrap();
let proof_data = build_pubkey_validity_proof_data(&new_elgamal_keypair).unwrap();
let proof_location = ProofLocation::InstructionOffset(1.try_into().unwrap(), &proof_data);

let payer_pubkey = ctx.payer.pubkey();
Expand Down
Loading
Loading