snark_verifier/pcs/
kzg.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
//! [KZG](<https://www.iacr.org/archive/asiacrypt2010/6477178/6477178.pdf>)
//! polynomial commitment scheme and accumulation scheme.

use crate::util::arithmetic::CurveAffine;

mod accumulation;
mod accumulator;
mod decider;
mod multiopen;

pub use accumulation::{KzgAs, KzgAsProvingKey, KzgAsVerifyingKey};
pub use accumulator::{KzgAccumulator, LimbsEncoding};
pub use decider::KzgDecidingKey;
pub use multiopen::{Bdfg21, Bdfg21Proof, Gwc19, Gwc19Proof};

#[cfg(feature = "loader_halo2")]
pub use accumulator::LimbsEncodingInstructions;
use serde::{Deserialize, Serialize};

/// KZG succinct verifying key.
#[derive(Clone, Copy, Debug, Serialize, Deserialize)]
pub struct KzgSuccinctVerifyingKey<C: Copy> {
    /// Generator.
    pub g: C,
}

impl<C: CurveAffine> KzgSuccinctVerifyingKey<C> {
    /// Initialize a [`KzgSuccinctVerifyingKey`].
    pub fn new(g: C) -> Self {
        Self { g }
    }
}

impl<C: CurveAffine> From<C> for KzgSuccinctVerifyingKey<C> {
    fn from(g: C) -> KzgSuccinctVerifyingKey<C> {
        KzgSuccinctVerifyingKey::new(g)
    }
}