quarks_zk/lib.rs
1//! # Quarks: Quadruple-efficient transparent zkSNARKs
2//!
3//! Implementation of Xiphos and Kopis zkSNARKs from the paper:
4//! "Quarks: Quadruple-efficient transparent zkSNARKs" (Lee & Setty, 2020)
5//!
6//! ## Structure
7//!
8//! - `field`: Finite field arithmetic
9//! - `r1cs`: R1CS (Rank-1 Constraint System) representations
10//! - `polynomial`: Multilinear polynomials and operations
11//! - `sumcheck`: Sum-check protocol implementation
12//! - `commitments`: Polynomial commitment schemes
13//! - `kopis_pc`: Kopis-PC (constant-size commitments, O(√n) verification)
14//! - `dory_pc`: Dory-PC (constant-size commitments, O(log n) verification)
15//! - `grand_product`: Grand product SNARK
16//! - `sparkle`: Sparkle compiler for sparse polynomials
17//! - `zk`: Zero-knowledge transformations
18//! - `assistant`: Untrusted assistant protocol
19//! - `snark`: Complete SNARK implementations (Lakonia, Kopis, Xiphos)
20//! - `traits`: Generic trait abstractions (PCS, etc.)
21//!
22//! ## Architecture
23//!
24//! SNARKs are generic over Polynomial Commitment Schemes (PCS):
25//! ```ignore
26//! let xiphos_dory = XiphosSnark::<DoryPCS>::setup(16);
27//! let xiphos_kopis = XiphosSnark::<KopisPCS>::setup(16);
28//! ```
29
30pub mod field;
31pub mod r1cs;
32pub mod polynomial;
33pub mod sumcheck;
34pub mod commitments;
35pub mod kopis_pc;
36pub mod dory_pc;
37pub mod grand_product;
38pub mod sparkle;
39pub mod zk;
40pub mod assistant;
41pub mod snark;
42pub mod traits;
43
44pub mod errors;
45pub mod utils;
46
47// Re-exports
48pub use errors::{QuarksError, Result};
49pub use traits::PolynomialCommitmentScheme;
50
51// =============================================================================
52// PCS Re-exports
53// =============================================================================
54
55/// Kopis-PC: O(1) commitment, O(√n) verification
56pub use kopis_pc::KopisPCS;
57
58/// Dory-PC: O(1) commitment, O(log n) verification
59pub use dory_pc::DoryPCS;
60
61// =============================================================================
62// SNARK Type Aliases - Public API
63// =============================================================================
64
65/// Lakonia SNARK with Kopis-PC (O(√n) verification)
66pub type Lakonia = snark::lakonia::GenericLakoniaSnark<KopisPCS>;
67
68/// Lakonia SNARK with Dory-PC (O(log n) verification)
69pub type LakoniaDory = snark::lakonia::GenericLakoniaSnark<DoryPCS>;
70
71/// Kopis SNARK with Kopis-PC (O(√n) verification)
72pub type Kopis = snark::kopis::KopisSnark<KopisPCS>;
73
74/// Kopis SNARK with Dory-PC (O(log n) verification)
75pub type KopisDory = snark::kopis::KopisSnark<DoryPCS>;
76
77/// Xiphos SNARK with Dory-PC (O(log n) verification) - The "Quark"
78pub type Xiphos = snark::xiphos::XiphosSnark<DoryPCS>;
79
80/// Xiphos SNARK with Kopis-PC (O(√n) verification)
81pub type XiphosKopis = snark::xiphos::XiphosSnark<KopisPCS>;
82
83// =============================================================================
84// Generic SNARK Re-exports
85// =============================================================================
86
87pub use snark::lakonia::GenericLakoniaSnark as LakoniaSnark;
88pub use snark::kopis::KopisSnark;
89pub use snark::xiphos::XiphosSnark;
90pub use snark::common::{Witness, Proof, ComputationCommitment};