mirror of
https://github.com/exfinen/zk-toolkit.git
synced 2026-01-10 04:28:02 -05:00
rename PinocchioX to X
This commit is contained in:
@@ -4,7 +4,7 @@ use crate::{
|
||||
curves::bls12_381::g2_point::G2Point,
|
||||
field::prime_field::PrimeField,
|
||||
},
|
||||
zk::w_trusted_setup::pinocchio::pinocchio_prover::PinocchioProver,
|
||||
zk::w_trusted_setup::pinocchio::prover::Prover,
|
||||
};
|
||||
|
||||
pub struct EvaluationKeys {
|
||||
@@ -45,7 +45,7 @@ impl CRS {
|
||||
#[allow(non_snake_case)]
|
||||
pub fn new(
|
||||
f: &PrimeField,
|
||||
p: &PinocchioProver,
|
||||
p: &Prover,
|
||||
) -> Self {
|
||||
println!("--> Building CRS...");
|
||||
let g1 = &G1Point::g();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
pub mod crs;
|
||||
pub mod pinocchio_proof;
|
||||
pub mod pinocchio_prover;
|
||||
pub mod pinocchio_verifier;
|
||||
pub mod proof;
|
||||
pub mod prover;
|
||||
pub mod verifier;
|
||||
pub mod witness;
|
||||
|
||||
@@ -5,7 +5,7 @@ use crate::building_block::curves::bls12_381::{
|
||||
g2_point::G2Point,
|
||||
};
|
||||
|
||||
pub struct PinocchioProof {
|
||||
pub struct Proof {
|
||||
pub v_mid_s: G1Point,
|
||||
pub g1_w_mid_s: G1Point,
|
||||
pub g2_w_mid_s: G2Point,
|
||||
@@ -27,14 +27,14 @@ use crate::{
|
||||
},
|
||||
pinocchio::{
|
||||
crs::CRS,
|
||||
pinocchio_proof::PinocchioProof,
|
||||
proof::Proof,
|
||||
witness::Witness,
|
||||
},
|
||||
},
|
||||
};
|
||||
use std::collections::HashMap;
|
||||
|
||||
pub struct PinocchioProver {
|
||||
pub struct Prover {
|
||||
pub f: PrimeField,
|
||||
pub max_degree: usize,
|
||||
pub num_constraints: usize,
|
||||
@@ -46,7 +46,7 @@ pub struct PinocchioProver {
|
||||
pub yi: Vec<Polynomial>,
|
||||
}
|
||||
|
||||
impl PinocchioProver {
|
||||
impl Prover {
|
||||
pub fn new(
|
||||
f: &PrimeField,
|
||||
expr: &str,
|
||||
@@ -80,7 +80,7 @@ impl PinocchioProver {
|
||||
let witness = Witness::new(&r1cs.witness.clone(), &tmpl.mid_beg);
|
||||
let num_constraints = tmpl.constraints.len();
|
||||
|
||||
PinocchioProver {
|
||||
Prover {
|
||||
f: f.clone(),
|
||||
max_degree,
|
||||
num_constraints,
|
||||
@@ -93,7 +93,7 @@ impl PinocchioProver {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn prove(&self, crs: &CRS) -> PinocchioProof {
|
||||
pub fn prove(&self, crs: &CRS) -> Proof {
|
||||
println!("--> Generating proof...");
|
||||
let witness_mid = &self.witness.mid();
|
||||
|
||||
@@ -156,7 +156,7 @@ impl PinocchioProver {
|
||||
h_s + w_s * delta_v + -(&crs.vk.one_g2 * delta_y)
|
||||
};
|
||||
|
||||
PinocchioProof {
|
||||
Proof {
|
||||
v_mid_s,
|
||||
g1_w_mid_s,
|
||||
g2_w_mid_s,
|
||||
@@ -173,7 +173,7 @@ impl PinocchioProver {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::zk::w_trusted_setup::pinocchio::pinocchio_verifier::PinocchioVerifier;
|
||||
use crate::zk::w_trusted_setup::pinocchio::verifier::Verifier;
|
||||
|
||||
#[test]
|
||||
fn test_generate_proof_and_verify() {
|
||||
@@ -195,8 +195,8 @@ mod tests {
|
||||
(Out, eq.rhs),
|
||||
])
|
||||
};
|
||||
let prover = &PinocchioProver::new(f, expr, &witness_map);
|
||||
let verifier = &PinocchioVerifier::new();
|
||||
let prover = &Prover::new(f, expr, &witness_map);
|
||||
let verifier = &Verifier::new();
|
||||
let crs = CRS::new(f, prover);
|
||||
|
||||
let proof = prover.prove(&crs);
|
||||
@@ -11,26 +11,26 @@ use crate::{
|
||||
},
|
||||
zk::w_trusted_setup::pinocchio::{
|
||||
crs::CRS,
|
||||
pinocchio_proof::PinocchioProof,
|
||||
proof::Proof,
|
||||
},
|
||||
};
|
||||
|
||||
pub struct PinocchioVerifier {
|
||||
pub struct Verifier {
|
||||
pairing: Pairing,
|
||||
}
|
||||
|
||||
impl PinocchioVerifier {
|
||||
impl Verifier {
|
||||
pub fn new() -> Self {
|
||||
let pairing = Pairing::new();
|
||||
|
||||
PinocchioVerifier {
|
||||
Verifier {
|
||||
pairing,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn verify(
|
||||
&self,
|
||||
proof: &PinocchioProof,
|
||||
proof: &Proof,
|
||||
crs: &CRS,
|
||||
witness_io: &SparseVec,
|
||||
) -> bool {
|
||||
Reference in New Issue
Block a user