From c046d7007c1c3d8858954f162d468d19de20872c Mon Sep 17 00:00:00 2001 From: samkim-crypto Date: Thu, 13 Jun 2024 06:15:34 +0900 Subject: [PATCH] [zk-sdk] Rename `elgamal_program` to `zk_elgamal_proof_program` module (#1698) * rename `elgamal_program` to `zk_elgamal_proof_program` * update dependencies outside of `zk-sdk` --- programs/zk-elgamal-proof/src/lib.rs | 2 +- zk-sdk/src/lib.rs | 2 +- .../errors.rs | 0 .../instruction.rs | 8 +++--- .../mod.rs | 0 .../handles_2.rs | 22 ++++++++-------- .../handles_3.rs | 22 ++++++++-------- .../mod.rs | 0 .../batched_range_proof_u128.rs | 26 +++++++++---------- .../batched_range_proof_u256.rs | 26 +++++++++---------- .../batched_range_proof_u64.rs | 26 +++++++++---------- .../proof_data/batched_range_proof/mod.rs | 2 +- .../ciphertext_ciphertext_equality.rs | 18 ++++++------- .../ciphertext_commitment_equality.rs | 24 ++++++++--------- .../proof_data/errors.rs | 0 .../grouped_ciphertext_validity/handles_2.rs | 22 ++++++++-------- .../grouped_ciphertext_validity/handles_3.rs | 22 ++++++++-------- .../grouped_ciphertext_validity/mod.rs | 0 .../proof_data/mod.rs | 2 +- .../proof_data/percentage_with_cap.rs | 4 +-- .../proof_data/pod.rs | 2 +- .../proof_data/pubkey_validity.rs | 4 +-- .../proof_data/zero_ciphertext.rs | 4 +-- .../state.rs | 2 +- 24 files changed, 120 insertions(+), 120 deletions(-) rename zk-sdk/src/{elgamal_program => zk_elgamal_proof_program}/errors.rs (100%) rename zk-sdk/src/{elgamal_program => zk_elgamal_proof_program}/instruction.rs (98%) rename zk-sdk/src/{elgamal_program => zk_elgamal_proof_program}/mod.rs (100%) rename zk-sdk/src/{elgamal_program => zk_elgamal_proof_program}/proof_data/batched_grouped_ciphertext_validity/handles_2.rs (97%) rename zk-sdk/src/{elgamal_program => zk_elgamal_proof_program}/proof_data/batched_grouped_ciphertext_validity/handles_3.rs (98%) rename zk-sdk/src/{elgamal_program => zk_elgamal_proof_program}/proof_data/batched_grouped_ciphertext_validity/mod.rs (100%) rename zk-sdk/src/{elgamal_program => zk_elgamal_proof_program}/proof_data/batched_range_proof/batched_range_proof_u128.rs (96%) rename zk-sdk/src/{elgamal_program => zk_elgamal_proof_program}/proof_data/batched_range_proof/batched_range_proof_u256.rs (96%) rename zk-sdk/src/{elgamal_program => zk_elgamal_proof_program}/proof_data/batched_range_proof/batched_range_proof_u64.rs (96%) rename zk-sdk/src/{elgamal_program => zk_elgamal_proof_program}/proof_data/batched_range_proof/mod.rs (98%) rename zk-sdk/src/{elgamal_program => zk_elgamal_proof_program}/proof_data/ciphertext_ciphertext_equality.rs (97%) rename zk-sdk/src/{elgamal_program => zk_elgamal_proof_program}/proof_data/ciphertext_commitment_equality.rs (96%) rename zk-sdk/src/{elgamal_program => zk_elgamal_proof_program}/proof_data/errors.rs (100%) rename zk-sdk/src/{elgamal_program => zk_elgamal_proof_program}/proof_data/grouped_ciphertext_validity/handles_2.rs (97%) rename zk-sdk/src/{elgamal_program => zk_elgamal_proof_program}/proof_data/grouped_ciphertext_validity/handles_3.rs (97%) rename zk-sdk/src/{elgamal_program => zk_elgamal_proof_program}/proof_data/grouped_ciphertext_validity/mod.rs (100%) rename zk-sdk/src/{elgamal_program => zk_elgamal_proof_program}/proof_data/mod.rs (97%) rename zk-sdk/src/{elgamal_program => zk_elgamal_proof_program}/proof_data/percentage_with_cap.rs (97%) rename zk-sdk/src/{elgamal_program => zk_elgamal_proof_program}/proof_data/pod.rs (87%) rename zk-sdk/src/{elgamal_program => zk_elgamal_proof_program}/proof_data/pubkey_validity.rs (95%) rename zk-sdk/src/{elgamal_program => zk_elgamal_proof_program}/proof_data/zero_ciphertext.rs (96%) rename zk-sdk/src/{elgamal_program => zk_elgamal_proof_program}/state.rs (97%) diff --git a/programs/zk-elgamal-proof/src/lib.rs b/programs/zk-elgamal-proof/src/lib.rs index 9c9a2784a91d7e..2514ab0c0d655d 100644 --- a/programs/zk-elgamal-proof/src/lib.rs +++ b/programs/zk-elgamal-proof/src/lib.rs @@ -4,7 +4,7 @@ use { bytemuck::Pod, solana_program_runtime::{declare_process_instruction, ic_msg, invoke_context::InvokeContext}, solana_sdk::{instruction::InstructionError, system_program}, - solana_zk_sdk::elgamal_program::{ + solana_zk_sdk::zk_elgamal_proof_program::{ id, instruction::ProofInstruction, proof_data::*, diff --git a/zk-sdk/src/lib.rs b/zk-sdk/src/lib.rs index 2994d14730c425..824a4718f14c5c 100644 --- a/zk-sdk/src/lib.rs +++ b/zk-sdk/src/lib.rs @@ -19,13 +19,13 @@ // `clippy::op_ref` is turned off to prevent clippy from warning that this is not idiomatic code. #![allow(clippy::arithmetic_side_effects, clippy::op_ref)] -pub mod elgamal_program; pub mod encryption; pub mod errors; pub mod pod; mod range_proof; mod sigma_proofs; mod transcript; +pub mod zk_elgamal_proof_program; /// Byte length of a compressed Ristretto point or scalar in Curve255519 const UNIT_LEN: usize = 32; diff --git a/zk-sdk/src/elgamal_program/errors.rs b/zk-sdk/src/zk_elgamal_proof_program/errors.rs similarity index 100% rename from zk-sdk/src/elgamal_program/errors.rs rename to zk-sdk/src/zk_elgamal_proof_program/errors.rs diff --git a/zk-sdk/src/elgamal_program/instruction.rs b/zk-sdk/src/zk_elgamal_proof_program/instruction.rs similarity index 98% rename from zk-sdk/src/elgamal_program/instruction.rs rename to zk-sdk/src/zk_elgamal_proof_program/instruction.rs index 4ff42edd4484da..2723bf1d6c07b7 100644 --- a/zk-sdk/src/elgamal_program/instruction.rs +++ b/zk-sdk/src/zk_elgamal_proof_program/instruction.rs @@ -33,7 +33,7 @@ //! [`context-state`]: https://docs.solanalabs.com/runtime/zk-token-proof#context-data use { - crate::elgamal_program::proof_data::ZkProofData, + crate::zk_elgamal_proof_program::proof_data::ZkProofData, bytemuck::{bytes_of, Pod}, num_derive::{FromPrimitive, ToPrimitive}, num_traits::{FromPrimitive, ToPrimitive}, @@ -306,7 +306,7 @@ pub fn close_context_state( let data = vec![ToPrimitive::to_u8(&ProofInstruction::CloseContextState).unwrap()]; Instruction { - program_id: crate::elgamal_program::id(), + program_id: crate::zk_elgamal_proof_program::id(), accounts, data, } @@ -335,7 +335,7 @@ impl ProofInstruction { data.extend_from_slice(bytes_of(proof_data)); Instruction { - program_id: crate::elgamal_program::id(), + program_id: crate::zk_elgamal_proof_program::id(), accounts, data, } @@ -361,7 +361,7 @@ impl ProofInstruction { data.extend_from_slice(&offset.to_le_bytes()); Instruction { - program_id: crate::elgamal_program::id(), + program_id: crate::zk_elgamal_proof_program::id(), accounts, data, } diff --git a/zk-sdk/src/elgamal_program/mod.rs b/zk-sdk/src/zk_elgamal_proof_program/mod.rs similarity index 100% rename from zk-sdk/src/elgamal_program/mod.rs rename to zk-sdk/src/zk_elgamal_proof_program/mod.rs diff --git a/zk-sdk/src/elgamal_program/proof_data/batched_grouped_ciphertext_validity/handles_2.rs b/zk-sdk/src/zk_elgamal_proof_program/proof_data/batched_grouped_ciphertext_validity/handles_2.rs similarity index 97% rename from zk-sdk/src/elgamal_program/proof_data/batched_grouped_ciphertext_validity/handles_2.rs rename to zk-sdk/src/zk_elgamal_proof_program/proof_data/batched_grouped_ciphertext_validity/handles_2.rs index 47614beb8f0e9b..56bc42d8606f30 100644 --- a/zk-sdk/src/elgamal_program/proof_data/batched_grouped_ciphertext_validity/handles_2.rs +++ b/zk-sdk/src/zk_elgamal_proof_program/proof_data/batched_grouped_ciphertext_validity/handles_2.rs @@ -5,29 +5,29 @@ //! grouped-ciphertext validity proof is shorter and more efficient than two individual //! grouped-ciphertext validity proofs. +use { + crate::{ + encryption::pod::{ + elgamal::PodElGamalPubkey, grouped_elgamal::PodGroupedElGamalCiphertext2Handles, + }, + sigma_proofs::pod::PodBatchedGroupedCiphertext2HandlesValidityProof, + zk_elgamal_proof_program::proof_data::{ProofType, ZkProofData}, + }, + bytemuck::{Pod, Zeroable}, +}; #[cfg(not(target_os = "solana"))] use { crate::{ - elgamal_program::errors::{ProofGenerationError, ProofVerificationError}, encryption::{ elgamal::ElGamalPubkey, grouped_elgamal::GroupedElGamalCiphertext, pedersen::PedersenOpening, }, sigma_proofs::batched_grouped_ciphertext_validity::BatchedGroupedCiphertext2HandlesValidityProof, + zk_elgamal_proof_program::errors::{ProofGenerationError, ProofVerificationError}, }, bytemuck::bytes_of, merlin::Transcript, }; -use { - crate::{ - elgamal_program::proof_data::{ProofType, ZkProofData}, - encryption::pod::{ - elgamal::PodElGamalPubkey, grouped_elgamal::PodGroupedElGamalCiphertext2Handles, - }, - sigma_proofs::pod::PodBatchedGroupedCiphertext2HandlesValidityProof, - }, - bytemuck::{Pod, Zeroable}, -}; /// The instruction data that is needed for the /// `ProofInstruction::VerifyBatchedGroupedCiphertextValidity` instruction. diff --git a/zk-sdk/src/elgamal_program/proof_data/batched_grouped_ciphertext_validity/handles_3.rs b/zk-sdk/src/zk_elgamal_proof_program/proof_data/batched_grouped_ciphertext_validity/handles_3.rs similarity index 98% rename from zk-sdk/src/elgamal_program/proof_data/batched_grouped_ciphertext_validity/handles_3.rs rename to zk-sdk/src/zk_elgamal_proof_program/proof_data/batched_grouped_ciphertext_validity/handles_3.rs index 405ff4d1764111..a98d9c8f47b526 100644 --- a/zk-sdk/src/elgamal_program/proof_data/batched_grouped_ciphertext_validity/handles_3.rs +++ b/zk-sdk/src/zk_elgamal_proof_program/proof_data/batched_grouped_ciphertext_validity/handles_3.rs @@ -5,29 +5,29 @@ //! grouped-ciphertext validity proof is shorter and more efficient than two individual //! grouped-ciphertext validity proofs. +use { + crate::{ + encryption::pod::{ + elgamal::PodElGamalPubkey, grouped_elgamal::PodGroupedElGamalCiphertext3Handles, + }, + sigma_proofs::pod::PodBatchedGroupedCiphertext3HandlesValidityProof, + zk_elgamal_proof_program::proof_data::{ProofType, ZkProofData}, + }, + bytemuck::{Pod, Zeroable}, +}; #[cfg(not(target_os = "solana"))] use { crate::{ - elgamal_program::errors::{ProofGenerationError, ProofVerificationError}, encryption::{ elgamal::ElGamalPubkey, grouped_elgamal::GroupedElGamalCiphertext, pedersen::PedersenOpening, }, sigma_proofs::batched_grouped_ciphertext_validity::BatchedGroupedCiphertext3HandlesValidityProof, + zk_elgamal_proof_program::errors::{ProofGenerationError, ProofVerificationError}, }, bytemuck::bytes_of, merlin::Transcript, }; -use { - crate::{ - elgamal_program::proof_data::{ProofType, ZkProofData}, - encryption::pod::{ - elgamal::PodElGamalPubkey, grouped_elgamal::PodGroupedElGamalCiphertext3Handles, - }, - sigma_proofs::pod::PodBatchedGroupedCiphertext3HandlesValidityProof, - }, - bytemuck::{Pod, Zeroable}, -}; /// The instruction data that is needed for the /// `ProofInstruction::VerifyBatchedGroupedCiphertext3HandlesValidity` instruction. diff --git a/zk-sdk/src/elgamal_program/proof_data/batched_grouped_ciphertext_validity/mod.rs b/zk-sdk/src/zk_elgamal_proof_program/proof_data/batched_grouped_ciphertext_validity/mod.rs similarity index 100% rename from zk-sdk/src/elgamal_program/proof_data/batched_grouped_ciphertext_validity/mod.rs rename to zk-sdk/src/zk_elgamal_proof_program/proof_data/batched_grouped_ciphertext_validity/mod.rs diff --git a/zk-sdk/src/elgamal_program/proof_data/batched_range_proof/batched_range_proof_u128.rs b/zk-sdk/src/zk_elgamal_proof_program/proof_data/batched_range_proof/batched_range_proof_u128.rs similarity index 96% rename from zk-sdk/src/elgamal_program/proof_data/batched_range_proof/batched_range_proof_u128.rs rename to zk-sdk/src/zk_elgamal_proof_program/proof_data/batched_range_proof/batched_range_proof_u128.rs index c39023331ee414..fbfab0d03052d3 100644 --- a/zk-sdk/src/elgamal_program/proof_data/batched_range_proof/batched_range_proof_u128.rs +++ b/zk-sdk/src/zk_elgamal_proof_program/proof_data/batched_range_proof/batched_range_proof_u128.rs @@ -1,25 +1,25 @@ //! The 128-bit batched range proof instruction. +#[cfg(not(target_os = "solana"))] use { crate::{ - elgamal_program::proof_data::{ - batched_range_proof::BatchedRangeProofContext, ProofType, ZkProofData, + encryption::pedersen::{PedersenCommitment, PedersenOpening}, + range_proof::RangeProof, + zk_elgamal_proof_program::{ + errors::{ProofGenerationError, ProofVerificationError}, + proof_data::batched_range_proof::MAX_COMMITMENTS, }, - range_proof::pod::PodRangeProofU128, }, - bytemuck::{Pod, Zeroable}, + std::convert::TryInto, }; -#[cfg(not(target_os = "solana"))] use { crate::{ - elgamal_program::{ - errors::{ProofGenerationError, ProofVerificationError}, - proof_data::batched_range_proof::MAX_COMMITMENTS, + range_proof::pod::PodRangeProofU128, + zk_elgamal_proof_program::proof_data::{ + batched_range_proof::BatchedRangeProofContext, ProofType, ZkProofData, }, - encryption::pedersen::{PedersenCommitment, PedersenOpening}, - range_proof::RangeProof, }, - std::convert::TryInto, + bytemuck::{Pod, Zeroable}, }; /// The instruction data that is needed for the @@ -102,8 +102,8 @@ mod test { use { super::*, crate::{ - elgamal_program::errors::ProofVerificationError, encryption::pedersen::Pedersen, - range_proof::errors::RangeProofVerificationError, + encryption::pedersen::Pedersen, range_proof::errors::RangeProofVerificationError, + zk_elgamal_proof_program::errors::ProofVerificationError, }, }; diff --git a/zk-sdk/src/elgamal_program/proof_data/batched_range_proof/batched_range_proof_u256.rs b/zk-sdk/src/zk_elgamal_proof_program/proof_data/batched_range_proof/batched_range_proof_u256.rs similarity index 96% rename from zk-sdk/src/elgamal_program/proof_data/batched_range_proof/batched_range_proof_u256.rs rename to zk-sdk/src/zk_elgamal_proof_program/proof_data/batched_range_proof/batched_range_proof_u256.rs index 9b77805e638833..a2f7426044ba4c 100644 --- a/zk-sdk/src/elgamal_program/proof_data/batched_range_proof/batched_range_proof_u256.rs +++ b/zk-sdk/src/zk_elgamal_proof_program/proof_data/batched_range_proof/batched_range_proof_u256.rs @@ -1,25 +1,25 @@ //! The 256-bit batched range proof instruction. +#[cfg(not(target_os = "solana"))] use { crate::{ - elgamal_program::proof_data::{ - batched_range_proof::BatchedRangeProofContext, ProofType, ZkProofData, + encryption::pedersen::{PedersenCommitment, PedersenOpening}, + range_proof::RangeProof, + zk_elgamal_proof_program::{ + errors::{ProofGenerationError, ProofVerificationError}, + proof_data::batched_range_proof::{MAX_COMMITMENTS, MAX_SINGLE_BIT_LENGTH}, }, - range_proof::pod::PodRangeProofU256, }, - bytemuck::{Pod, Zeroable}, + std::convert::TryInto, }; -#[cfg(not(target_os = "solana"))] use { crate::{ - elgamal_program::{ - errors::{ProofGenerationError, ProofVerificationError}, - proof_data::batched_range_proof::{MAX_COMMITMENTS, MAX_SINGLE_BIT_LENGTH}, + range_proof::pod::PodRangeProofU256, + zk_elgamal_proof_program::proof_data::{ + batched_range_proof::BatchedRangeProofContext, ProofType, ZkProofData, }, - encryption::pedersen::{PedersenCommitment, PedersenOpening}, - range_proof::RangeProof, }, - std::convert::TryInto, + bytemuck::{Pod, Zeroable}, }; #[cfg(not(target_os = "solana"))] @@ -116,8 +116,8 @@ mod test { use { super::*, crate::{ - elgamal_program::errors::ProofVerificationError, encryption::pedersen::Pedersen, - range_proof::errors::RangeProofVerificationError, + encryption::pedersen::Pedersen, range_proof::errors::RangeProofVerificationError, + zk_elgamal_proof_program::errors::ProofVerificationError, }, }; diff --git a/zk-sdk/src/elgamal_program/proof_data/batched_range_proof/batched_range_proof_u64.rs b/zk-sdk/src/zk_elgamal_proof_program/proof_data/batched_range_proof/batched_range_proof_u64.rs similarity index 96% rename from zk-sdk/src/elgamal_program/proof_data/batched_range_proof/batched_range_proof_u64.rs rename to zk-sdk/src/zk_elgamal_proof_program/proof_data/batched_range_proof/batched_range_proof_u64.rs index 598356e2018930..a701ae6a1370de 100644 --- a/zk-sdk/src/elgamal_program/proof_data/batched_range_proof/batched_range_proof_u64.rs +++ b/zk-sdk/src/zk_elgamal_proof_program/proof_data/batched_range_proof/batched_range_proof_u64.rs @@ -1,25 +1,25 @@ //! The 64-bit batched range proof instruction. +#[cfg(not(target_os = "solana"))] use { crate::{ - elgamal_program::proof_data::{ - batched_range_proof::BatchedRangeProofContext, ProofType, ZkProofData, + encryption::pedersen::{PedersenCommitment, PedersenOpening}, + range_proof::RangeProof, + zk_elgamal_proof_program::{ + errors::{ProofGenerationError, ProofVerificationError}, + proof_data::batched_range_proof::MAX_COMMITMENTS, }, - range_proof::pod::PodRangeProofU64, }, - bytemuck::{Pod, Zeroable}, + std::convert::TryInto, }; -#[cfg(not(target_os = "solana"))] use { crate::{ - elgamal_program::{ - errors::{ProofGenerationError, ProofVerificationError}, - proof_data::batched_range_proof::MAX_COMMITMENTS, + range_proof::pod::PodRangeProofU64, + zk_elgamal_proof_program::proof_data::{ + batched_range_proof::BatchedRangeProofContext, ProofType, ZkProofData, }, - encryption::pedersen::{PedersenCommitment, PedersenOpening}, - range_proof::RangeProof, }, - std::convert::TryInto, + bytemuck::{Pod, Zeroable}, }; /// The instruction data that is needed for the @@ -101,8 +101,8 @@ mod test { use { super::*, crate::{ - elgamal_program::errors::ProofVerificationError, encryption::pedersen::Pedersen, - range_proof::errors::RangeProofVerificationError, + encryption::pedersen::Pedersen, range_proof::errors::RangeProofVerificationError, + zk_elgamal_proof_program::errors::ProofVerificationError, }, }; diff --git a/zk-sdk/src/elgamal_program/proof_data/batched_range_proof/mod.rs b/zk-sdk/src/zk_elgamal_proof_program/proof_data/batched_range_proof/mod.rs similarity index 98% rename from zk-sdk/src/elgamal_program/proof_data/batched_range_proof/mod.rs rename to zk-sdk/src/zk_elgamal_proof_program/proof_data/batched_range_proof/mod.rs index aea254c29acdb2..828fcc08218e1a 100644 --- a/zk-sdk/src/elgamal_program/proof_data/batched_range_proof/mod.rs +++ b/zk-sdk/src/zk_elgamal_proof_program/proof_data/batched_range_proof/mod.rs @@ -27,8 +27,8 @@ use { #[cfg(not(target_os = "solana"))] use { crate::{ - elgamal_program::errors::{ProofGenerationError, ProofVerificationError}, encryption::pedersen::{PedersenCommitment, PedersenOpening}, + zk_elgamal_proof_program::errors::{ProofGenerationError, ProofVerificationError}, }, bytemuck::bytes_of, curve25519_dalek::traits::IsIdentity, diff --git a/zk-sdk/src/elgamal_program/proof_data/ciphertext_ciphertext_equality.rs b/zk-sdk/src/zk_elgamal_proof_program/proof_data/ciphertext_ciphertext_equality.rs similarity index 97% rename from zk-sdk/src/elgamal_program/proof_data/ciphertext_ciphertext_equality.rs rename to zk-sdk/src/zk_elgamal_proof_program/proof_data/ciphertext_ciphertext_equality.rs index bc99eb38547bda..5e2ba6cac9a7bc 100644 --- a/zk-sdk/src/elgamal_program/proof_data/ciphertext_ciphertext_equality.rs +++ b/zk-sdk/src/zk_elgamal_proof_program/proof_data/ciphertext_ciphertext_equality.rs @@ -5,28 +5,28 @@ //! the proof, a prover must provide the decryption key for the first ciphertext and the randomness //! used to generate the second ciphertext. +use { + crate::{ + encryption::pod::elgamal::{PodElGamalCiphertext, PodElGamalPubkey}, + sigma_proofs::pod::PodCiphertextCiphertextEqualityProof, + zk_elgamal_proof_program::proof_data::{ProofType, ZkProofData}, + }, + bytemuck::{Pod, Zeroable}, +}; #[cfg(not(target_os = "solana"))] use { crate::{ - elgamal_program::errors::{ProofGenerationError, ProofVerificationError}, encryption::{ elgamal::{ElGamalCiphertext, ElGamalKeypair, ElGamalPubkey}, pedersen::PedersenOpening, }, sigma_proofs::ciphertext_ciphertext_equality::CiphertextCiphertextEqualityProof, + zk_elgamal_proof_program::errors::{ProofGenerationError, ProofVerificationError}, }, bytemuck::bytes_of, merlin::Transcript, std::convert::TryInto, }; -use { - crate::{ - elgamal_program::proof_data::{ProofType, ZkProofData}, - encryption::pod::elgamal::{PodElGamalCiphertext, PodElGamalPubkey}, - sigma_proofs::pod::PodCiphertextCiphertextEqualityProof, - }, - bytemuck::{Pod, Zeroable}, -}; /// The instruction data that is needed for the /// `ProofInstruction::VerifyCiphertextCiphertextEquality` instruction. diff --git a/zk-sdk/src/elgamal_program/proof_data/ciphertext_commitment_equality.rs b/zk-sdk/src/zk_elgamal_proof_program/proof_data/ciphertext_commitment_equality.rs similarity index 96% rename from zk-sdk/src/elgamal_program/proof_data/ciphertext_commitment_equality.rs rename to zk-sdk/src/zk_elgamal_proof_program/proof_data/ciphertext_commitment_equality.rs index 7e598b341e4cd4..86f4dbd2d4055a 100644 --- a/zk-sdk/src/elgamal_program/proof_data/ciphertext_commitment_equality.rs +++ b/zk-sdk/src/zk_elgamal_proof_program/proof_data/ciphertext_commitment_equality.rs @@ -5,31 +5,31 @@ //! encrypts/encodes the same message. To generate the proof, a prover must provide the decryption //! key for the first ciphertext and the Pedersen opening for the commitment. +use { + crate::{ + encryption::pod::{ + elgamal::{PodElGamalCiphertext, PodElGamalPubkey}, + pedersen::PodPedersenCommitment, + }, + sigma_proofs::pod::PodCiphertextCommitmentEqualityProof, + zk_elgamal_proof_program::proof_data::{ProofType, ZkProofData}, + }, + bytemuck::{Pod, Zeroable}, +}; #[cfg(not(target_os = "solana"))] use { crate::{ - elgamal_program::errors::{ProofGenerationError, ProofVerificationError}, encryption::{ elgamal::{ElGamalCiphertext, ElGamalKeypair}, pedersen::{PedersenCommitment, PedersenOpening}, }, sigma_proofs::ciphertext_commitment_equality::CiphertextCommitmentEqualityProof, + zk_elgamal_proof_program::errors::{ProofGenerationError, ProofVerificationError}, }, bytemuck::bytes_of, merlin::Transcript, std::convert::TryInto, }; -use { - crate::{ - elgamal_program::proof_data::{ProofType, ZkProofData}, - encryption::pod::{ - elgamal::{PodElGamalCiphertext, PodElGamalPubkey}, - pedersen::PodPedersenCommitment, - }, - sigma_proofs::pod::PodCiphertextCommitmentEqualityProof, - }, - bytemuck::{Pod, Zeroable}, -}; /// The instruction data that is needed for the /// `ProofInstruction::VerifyCiphertextCommitmentEquality` instruction. /// diff --git a/zk-sdk/src/elgamal_program/proof_data/errors.rs b/zk-sdk/src/zk_elgamal_proof_program/proof_data/errors.rs similarity index 100% rename from zk-sdk/src/elgamal_program/proof_data/errors.rs rename to zk-sdk/src/zk_elgamal_proof_program/proof_data/errors.rs diff --git a/zk-sdk/src/elgamal_program/proof_data/grouped_ciphertext_validity/handles_2.rs b/zk-sdk/src/zk_elgamal_proof_program/proof_data/grouped_ciphertext_validity/handles_2.rs similarity index 97% rename from zk-sdk/src/elgamal_program/proof_data/grouped_ciphertext_validity/handles_2.rs rename to zk-sdk/src/zk_elgamal_proof_program/proof_data/grouped_ciphertext_validity/handles_2.rs index 51f08d3b4f7bc7..76083014c5ab2e 100644 --- a/zk-sdk/src/elgamal_program/proof_data/grouped_ciphertext_validity/handles_2.rs +++ b/zk-sdk/src/zk_elgamal_proof_program/proof_data/grouped_ciphertext_validity/handles_2.rs @@ -5,29 +5,29 @@ //! decryption handles. To generate the proof, a prover must provide the Pedersen opening //! associated with the grouped ciphertext's commitment. +use { + crate::{ + encryption::pod::{ + elgamal::PodElGamalPubkey, grouped_elgamal::PodGroupedElGamalCiphertext2Handles, + }, + sigma_proofs::pod::PodGroupedCiphertext2HandlesValidityProof, + zk_elgamal_proof_program::proof_data::{ProofType, ZkProofData}, + }, + bytemuck::{Pod, Zeroable}, +}; #[cfg(not(target_os = "solana"))] use { crate::{ - elgamal_program::errors::{ProofGenerationError, ProofVerificationError}, encryption::{ elgamal::ElGamalPubkey, grouped_elgamal::GroupedElGamalCiphertext, pedersen::PedersenOpening, }, sigma_proofs::grouped_ciphertext_validity::GroupedCiphertext2HandlesValidityProof, + zk_elgamal_proof_program::errors::{ProofGenerationError, ProofVerificationError}, }, bytemuck::bytes_of, merlin::Transcript, }; -use { - crate::{ - elgamal_program::proof_data::{ProofType, ZkProofData}, - encryption::pod::{ - elgamal::PodElGamalPubkey, grouped_elgamal::PodGroupedElGamalCiphertext2Handles, - }, - sigma_proofs::pod::PodGroupedCiphertext2HandlesValidityProof, - }, - bytemuck::{Pod, Zeroable}, -}; /// The instruction data that is needed for the `ProofInstruction::VerifyGroupedCiphertextValidity` /// instruction. diff --git a/zk-sdk/src/elgamal_program/proof_data/grouped_ciphertext_validity/handles_3.rs b/zk-sdk/src/zk_elgamal_proof_program/proof_data/grouped_ciphertext_validity/handles_3.rs similarity index 97% rename from zk-sdk/src/elgamal_program/proof_data/grouped_ciphertext_validity/handles_3.rs rename to zk-sdk/src/zk_elgamal_proof_program/proof_data/grouped_ciphertext_validity/handles_3.rs index 3bd0e87413a8b5..48420661b48d4a 100644 --- a/zk-sdk/src/elgamal_program/proof_data/grouped_ciphertext_validity/handles_3.rs +++ b/zk-sdk/src/zk_elgamal_proof_program/proof_data/grouped_ciphertext_validity/handles_3.rs @@ -5,29 +5,29 @@ //! decryption handles. To generate the proof, a prover must provide the Pedersen opening //! associated with the grouped ciphertext's commitment. +use { + crate::{ + encryption::pod::{ + elgamal::PodElGamalPubkey, grouped_elgamal::PodGroupedElGamalCiphertext3Handles, + }, + sigma_proofs::pod::PodGroupedCiphertext3HandlesValidityProof, + zk_elgamal_proof_program::proof_data::{ProofType, ZkProofData}, + }, + bytemuck::{Pod, Zeroable}, +}; #[cfg(not(target_os = "solana"))] use { crate::{ - elgamal_program::errors::{ProofGenerationError, ProofVerificationError}, encryption::{ elgamal::ElGamalPubkey, grouped_elgamal::GroupedElGamalCiphertext, pedersen::PedersenOpening, }, sigma_proofs::grouped_ciphertext_validity::GroupedCiphertext3HandlesValidityProof, + zk_elgamal_proof_program::errors::{ProofGenerationError, ProofVerificationError}, }, bytemuck::bytes_of, merlin::Transcript, }; -use { - crate::{ - elgamal_program::proof_data::{ProofType, ZkProofData}, - encryption::pod::{ - elgamal::PodElGamalPubkey, grouped_elgamal::PodGroupedElGamalCiphertext3Handles, - }, - sigma_proofs::pod::PodGroupedCiphertext3HandlesValidityProof, - }, - bytemuck::{Pod, Zeroable}, -}; /// The instruction data that is needed for the /// `ProofInstruction::VerifyGroupedCiphertext3HandlesValidity` instruction. diff --git a/zk-sdk/src/elgamal_program/proof_data/grouped_ciphertext_validity/mod.rs b/zk-sdk/src/zk_elgamal_proof_program/proof_data/grouped_ciphertext_validity/mod.rs similarity index 100% rename from zk-sdk/src/elgamal_program/proof_data/grouped_ciphertext_validity/mod.rs rename to zk-sdk/src/zk_elgamal_proof_program/proof_data/grouped_ciphertext_validity/mod.rs diff --git a/zk-sdk/src/elgamal_program/proof_data/mod.rs b/zk-sdk/src/zk_elgamal_proof_program/proof_data/mod.rs similarity index 97% rename from zk-sdk/src/elgamal_program/proof_data/mod.rs rename to zk-sdk/src/zk_elgamal_proof_program/proof_data/mod.rs index 99b28059a5e762..7bce5f5f66a1f9 100644 --- a/zk-sdk/src/elgamal_program/proof_data/mod.rs +++ b/zk-sdk/src/zk_elgamal_proof_program/proof_data/mod.rs @@ -1,5 +1,5 @@ #[cfg(not(target_os = "solana"))] -use crate::elgamal_program::errors::ProofVerificationError; +use crate::zk_elgamal_proof_program::errors::ProofVerificationError; use { bytemuck::Pod, num_derive::{FromPrimitive, ToPrimitive}, diff --git a/zk-sdk/src/elgamal_program/proof_data/percentage_with_cap.rs b/zk-sdk/src/zk_elgamal_proof_program/proof_data/percentage_with_cap.rs similarity index 97% rename from zk-sdk/src/elgamal_program/proof_data/percentage_with_cap.rs rename to zk-sdk/src/zk_elgamal_proof_program/proof_data/percentage_with_cap.rs index 3ca93e51f6e908..8a6b18e68bdf9b 100644 --- a/zk-sdk/src/elgamal_program/proof_data/percentage_with_cap.rs +++ b/zk-sdk/src/zk_elgamal_proof_program/proof_data/percentage_with_cap.rs @@ -9,9 +9,9 @@ #[cfg(not(target_os = "solana"))] use { crate::{ - elgamal_program::errors::{ProofGenerationError, ProofVerificationError}, encryption::pedersen::{PedersenCommitment, PedersenOpening}, sigma_proofs::percentage_with_cap::PercentageWithCapProof, + zk_elgamal_proof_program::errors::{ProofGenerationError, ProofVerificationError}, }, bytemuck::bytes_of, merlin::Transcript, @@ -19,10 +19,10 @@ use { }; use { crate::{ - elgamal_program::proof_data::{ProofType, ZkProofData}, encryption::pod::pedersen::PodPedersenCommitment, pod::PodU64, sigma_proofs::pod::PodPercentageWithCapProof, + zk_elgamal_proof_program::proof_data::{ProofType, ZkProofData}, }, bytemuck::{Pod, Zeroable}, }; diff --git a/zk-sdk/src/elgamal_program/proof_data/pod.rs b/zk-sdk/src/zk_elgamal_proof_program/proof_data/pod.rs similarity index 87% rename from zk-sdk/src/elgamal_program/proof_data/pod.rs rename to zk-sdk/src/zk_elgamal_proof_program/proof_data/pod.rs index 7d3f346a684d59..50e1a81a582705 100644 --- a/zk-sdk/src/elgamal_program/proof_data/pod.rs +++ b/zk-sdk/src/zk_elgamal_proof_program/proof_data/pod.rs @@ -1,5 +1,5 @@ use { - crate::elgamal_program::proof_data::{errors::ProofDataError, ProofType}, + crate::zk_elgamal_proof_program::proof_data::{errors::ProofDataError, ProofType}, bytemuck::{Pod, Zeroable}, num_traits::{FromPrimitive, ToPrimitive}, }; diff --git a/zk-sdk/src/elgamal_program/proof_data/pubkey_validity.rs b/zk-sdk/src/zk_elgamal_proof_program/proof_data/pubkey_validity.rs similarity index 95% rename from zk-sdk/src/elgamal_program/proof_data/pubkey_validity.rs rename to zk-sdk/src/zk_elgamal_proof_program/proof_data/pubkey_validity.rs index 610c05c503f347..b769458e5fb8c0 100644 --- a/zk-sdk/src/elgamal_program/proof_data/pubkey_validity.rs +++ b/zk-sdk/src/zk_elgamal_proof_program/proof_data/pubkey_validity.rs @@ -8,9 +8,9 @@ #[cfg(not(target_os = "solana"))] use { crate::{ - elgamal_program::errors::{ProofGenerationError, ProofVerificationError}, encryption::elgamal::ElGamalKeypair, sigma_proofs::pubkey_validity::PubkeyValidityProof, + zk_elgamal_proof_program::errors::{ProofGenerationError, ProofVerificationError}, }, bytemuck::bytes_of, merlin::Transcript, @@ -18,9 +18,9 @@ use { }; use { crate::{ - elgamal_program::proof_data::{ProofType, ZkProofData}, encryption::pod::elgamal::PodElGamalPubkey, sigma_proofs::pod::PodPubkeyValidityProof, + zk_elgamal_proof_program::proof_data::{ProofType, ZkProofData}, }, bytemuck::{Pod, Zeroable}, }; diff --git a/zk-sdk/src/elgamal_program/proof_data/zero_ciphertext.rs b/zk-sdk/src/zk_elgamal_proof_program/proof_data/zero_ciphertext.rs similarity index 96% rename from zk-sdk/src/elgamal_program/proof_data/zero_ciphertext.rs rename to zk-sdk/src/zk_elgamal_proof_program/proof_data/zero_ciphertext.rs index 71fbcff67d38ba..8a376304e05494 100644 --- a/zk-sdk/src/elgamal_program/proof_data/zero_ciphertext.rs +++ b/zk-sdk/src/zk_elgamal_proof_program/proof_data/zero_ciphertext.rs @@ -7,9 +7,9 @@ #[cfg(not(target_os = "solana"))] use { crate::{ - elgamal_program::errors::{ProofGenerationError, ProofVerificationError}, encryption::elgamal::{ElGamalCiphertext, ElGamalKeypair}, sigma_proofs::zero_ciphertext::ZeroCiphertextProof, + zk_elgamal_proof_program::errors::{ProofGenerationError, ProofVerificationError}, }, bytemuck::bytes_of, merlin::Transcript, @@ -17,9 +17,9 @@ use { }; use { crate::{ - elgamal_program::proof_data::{ProofType, ZkProofData}, encryption::pod::elgamal::{PodElGamalCiphertext, PodElGamalPubkey}, sigma_proofs::pod::PodZeroCiphertextProof, + zk_elgamal_proof_program::proof_data::{ProofType, ZkProofData}, }, bytemuck::{Pod, Zeroable}, }; diff --git a/zk-sdk/src/elgamal_program/state.rs b/zk-sdk/src/zk_elgamal_proof_program/state.rs similarity index 97% rename from zk-sdk/src/elgamal_program/state.rs rename to zk-sdk/src/zk_elgamal_proof_program/state.rs index fe9532f588dd52..7cd87bbf5827da 100644 --- a/zk-sdk/src/elgamal_program/state.rs +++ b/zk-sdk/src/zk_elgamal_proof_program/state.rs @@ -1,5 +1,5 @@ use { - crate::elgamal_program::proof_data::{pod::PodProofType, ProofType}, + crate::zk_elgamal_proof_program::proof_data::{pod::PodProofType, ProofType}, bytemuck::{bytes_of, Pod, Zeroable}, num_traits::ToPrimitive, solana_program::{