Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ ark-ec ="^0.3.0"
ark-ff ="^0.3.0"
ark-bls12-381 = "^0.3.0"
ark-std ="^0.3.0"
ark-serialize = "^0.3.0"
ark-serialize = { version = "^0.3.0", features = ["derive"] }
thiserror = "1.0.32"
hashbrown = "0.12.3"

Expand Down
3 changes: 2 additions & 1 deletion src/commitments.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,14 @@

use ark_bls12_381::{Fr, G1Projective};
use ark_ec::group::Group;
use ark_serialize::{CanonicalDeserialize, CanonicalSerialize, Read, SerializationError, Write};

use std::ops::{Add, Mul};

/// A GroupCommitment object
///
/// $GroupCommitment((G , H); T ; r ) = cm_T = (cm_{T,1} , cm_{T,2} ) = (r G , T + r H)$
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
#[derive(Copy, Clone, CanonicalDeserialize, CanonicalSerialize, Debug, PartialEq, Eq)]
pub struct GroupCommitment {
/// Given $GroupCommitment((G , H); T ; r )$ this is $rG$
pub T_1: G1Projective,
Expand Down
8 changes: 5 additions & 3 deletions src/curdleproofs.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#![allow(non_snake_case)]
use ark_bls12_381::{Fr, G1Affine, G1Projective};
pub use ark_bls12_381::{Fr, G1Affine, G1Projective};
use ark_ec::ProjectiveCurve;
use ark_ff::PrimeField;
pub use ark_serialize::{CanonicalDeserialize, CanonicalSerialize, SerializationError};
use ark_serialize::{Read, Write};
use ark_std::rand::RngCore;
use ark_std::rand::{rngs::StdRng, SeedableRng};
use ark_std::{UniformRand, Zero};
Expand All @@ -21,7 +23,7 @@ use crate::same_scalar_argument::SameScalarProof;
use crate::N_BLINDERS;

/// The Curdleproofs CRS
#[derive(Clone, Debug)]
#[derive(Clone, Debug, CanonicalSerialize, CanonicalDeserialize)]
pub struct CurdleproofsCrs {
/// Pedersen commitment bases
pub vec_G: Vec<G1Affine>,
Expand Down Expand Up @@ -67,7 +69,7 @@ pub fn generate_crs(ell: usize) -> CurdleproofsCrs {
}

/// A Curdleproofs proof object
#[derive(Clone, Debug)]
#[derive(Clone, Debug, CanonicalSerialize, CanonicalDeserialize)]
pub struct CurdleproofsProof {
A: G1Projective,
cm_T: GroupCommitment,
Expand Down
3 changes: 2 additions & 1 deletion src/grand_product_argument.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use core::iter;
use ark_bls12_381::{Fr, G1Affine, G1Projective};
use ark_ec::{AffineCurve, ProjectiveCurve};
use ark_ff::{Field, One};
use ark_serialize::{CanonicalDeserialize, CanonicalSerialize, Read, SerializationError, Write};
use ark_std::rand::RngCore;
use ark_std::Zero;

Expand All @@ -16,7 +17,7 @@ use crate::msm_accumulator::MsmAccumulator;
use crate::util::{generate_blinders, inner_product, msm};

/// A GrandProduct proof object
#[derive(Clone, Debug)]
#[derive(Clone, Debug, CanonicalSerialize, CanonicalDeserialize)]
pub struct GrandProductProof {
C: G1Projective,

Expand Down
3 changes: 2 additions & 1 deletion src/inner_product_argument.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use ark_ec::AffineCurve;
use ark_ec::ProjectiveCurve;
use ark_ff::PrimeField;
use ark_ff::{batch_inversion, Field};
use ark_serialize::{CanonicalDeserialize, CanonicalSerialize, Read, SerializationError, Write};
use ark_std::rand::RngCore;
use ark_std::{One, Zero};

Expand All @@ -17,7 +18,7 @@ use crate::util::{
};

/// An IPA proof object
#[derive(Clone, Debug)]
#[derive(Clone, Debug, CanonicalSerialize, CanonicalDeserialize)]
pub struct InnerProductProof {
B_c: G1Projective,
B_d: G1Projective,
Expand Down
4 changes: 4 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ pub mod same_permutation_argument;
pub mod same_scalar_argument;
pub mod transcript;
pub mod util;
pub mod whisk;

// To use in whisk code
pub use ark_bls12_381::g1::G1_GENERATOR_X;

#[doc = include_str!("../doc/notes.md")]
pub mod notes {
Expand Down
3 changes: 2 additions & 1 deletion src/same_multiscalar_argument.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use ark_ec::AffineCurve;
use ark_ec::ProjectiveCurve;
use ark_ff::PrimeField;
use ark_ff::{batch_inversion, Field, One};
use ark_serialize::{CanonicalDeserialize, CanonicalSerialize, Read, SerializationError, Write};
use ark_std::rand::RngCore;

use crate::transcript::CurdleproofsTranscript;
Expand All @@ -16,7 +17,7 @@ use crate::util::{
};

/// A $SameMsm$ proof object
#[derive(Clone, Debug)]
#[derive(Clone, Debug, CanonicalSerialize, CanonicalDeserialize)]
pub struct SameMultiscalarProof {
B_a: G1Projective,
B_t: G1Projective,
Expand Down
3 changes: 2 additions & 1 deletion src/same_permutation_argument.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use ark_bls12_381::{Fr, G1Affine, G1Projective};
use ark_ec::group::Group;
use ark_ec::ProjectiveCurve;
use ark_ff::PrimeField;
use ark_serialize::{CanonicalDeserialize, CanonicalSerialize, Read, SerializationError, Write};
use ark_std::rand::RngCore;

use crate::transcript::CurdleproofsTranscript;
Expand All @@ -16,7 +17,7 @@ use crate::msm_accumulator::MsmAccumulator;
use crate::util::{get_permutation, msm};

/// A same permutation proof object
#[derive(Clone, Debug)]
#[derive(Clone, Debug, CanonicalSerialize, CanonicalDeserialize)]
pub struct SamePermutationProof {
B: G1Projective,

Expand Down
3 changes: 2 additions & 1 deletion src/same_scalar_argument.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
use ark_bls12_381::{Fr, G1Projective};
use ark_ec::ProjectiveCurve;
use ark_ff::PrimeField;
use ark_serialize::{CanonicalDeserialize, CanonicalSerialize, Read, SerializationError, Write};
use ark_std::rand::RngCore;
use ark_std::UniformRand;

Expand All @@ -11,7 +12,7 @@ use crate::errors::ProofError;
use crate::transcript::CurdleproofsTranscript;
use merlin::Transcript;

#[derive(Clone, Debug)]
#[derive(Clone, Debug, CanonicalSerialize, CanonicalDeserialize)]
pub struct SameScalarProof {
cm_A: GroupCommitment,
cm_B: GroupCommitment,
Expand Down
Loading