solana_zk_sdk/zk_elgamal_proof_program/proof_data/
mod.rs1#[cfg(not(target_os = "solana"))]
2use crate::zk_elgamal_proof_program::errors::ProofVerificationError;
3use {
4 bytemuck::Pod,
5 num_derive::{FromPrimitive, ToPrimitive},
6};
7
8pub mod batched_grouped_ciphertext_validity;
9pub mod batched_range_proof;
10pub mod ciphertext_ciphertext_equality;
11pub mod ciphertext_commitment_equality;
12pub mod errors;
13pub mod grouped_ciphertext_validity;
14pub mod percentage_with_cap;
15pub mod pod;
16pub mod pubkey_validity;
17pub mod zero_ciphertext;
18
19pub use {
20 batched_grouped_ciphertext_validity::{
21 BatchedGroupedCiphertext2HandlesValidityProofContext,
22 BatchedGroupedCiphertext2HandlesValidityProofData,
23 BatchedGroupedCiphertext3HandlesValidityProofContext,
24 BatchedGroupedCiphertext3HandlesValidityProofData,
25 },
26 batched_range_proof::{
27 batched_range_proof_u128::BatchedRangeProofU128Data,
28 batched_range_proof_u256::BatchedRangeProofU256Data,
29 batched_range_proof_u64::BatchedRangeProofU64Data, BatchedRangeProofContext,
30 },
31 ciphertext_ciphertext_equality::{
32 CiphertextCiphertextEqualityProofContext, CiphertextCiphertextEqualityProofData,
33 },
34 ciphertext_commitment_equality::{
35 CiphertextCommitmentEqualityProofContext, CiphertextCommitmentEqualityProofData,
36 },
37 grouped_ciphertext_validity::{
38 GroupedCiphertext2HandlesValidityProofContext, GroupedCiphertext2HandlesValidityProofData,
39 GroupedCiphertext3HandlesValidityProofContext, GroupedCiphertext3HandlesValidityProofData,
40 },
41 percentage_with_cap::{PercentageWithCapProofContext, PercentageWithCapProofData},
42 pubkey_validity::{PubkeyValidityProofContext, PubkeyValidityProofData},
43 zero_ciphertext::{ZeroCiphertextProofContext, ZeroCiphertextProofData},
44};
45
46#[derive(Clone, Copy, Debug, FromPrimitive, ToPrimitive, PartialEq, Eq)]
47#[repr(u8)]
48pub enum ProofType {
49 Uninitialized,
51 ZeroCiphertext,
52 CiphertextCiphertextEquality,
53 CiphertextCommitmentEquality,
54 PubkeyValidity,
55 PercentageWithCap,
56 BatchedRangeProofU64,
57 BatchedRangeProofU128,
58 BatchedRangeProofU256,
59 GroupedCiphertext2HandlesValidity,
60 BatchedGroupedCiphertext2HandlesValidity,
61 GroupedCiphertext3HandlesValidity,
62 BatchedGroupedCiphertext3HandlesValidity,
63}
64
65pub trait ZkProofData<T: Pod> {
66 const PROOF_TYPE: ProofType;
67
68 fn context_data(&self) -> &T;
69
70 #[cfg(not(target_os = "solana"))]
71 fn verify_proof(&self) -> Result<(), ProofVerificationError>;
72}