Skip to content

Commit

Permalink
Fmt and docs
Browse files Browse the repository at this point in the history
Signed-off-by: lovesh <[email protected]>
  • Loading branch information
lovesh committed Jul 3, 2024
1 parent 5eeffde commit 82f19ab
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 18 deletions.
6 changes: 4 additions & 2 deletions bbs_plus/src/proof_23.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@
//! that `r` and Schnorr responses for the equal messages `m_k` are equal. i.e. for known messages `J_1`,
//! `J_2`, hidden messages `I_1`, `I_2` for signatures `sigma_1`, `sigma_2` with equal messages `m_k` being
//! a subset of `I_1`, `I_2`, `r` and `m_k` are same in following 2 relations:
//! `{B_1}_bar = C_{J_1}(m) * r + \sum_{i in I_1}(h_i * (m_i*r)) + {A_1}_bar * -e_1`
//! `{B_2}_bar = C_{J_2}(m) * r + \sum_{i in I_2}(h_i * (m_i*r)) + {A_2}_bar * -e_2`
//!
//! - `{B_1}_bar = C_{J_1}(m) * r + \sum_{i in I_1}(h_i * (m_i*r)) + {A_1}_bar * -e_1`
//! - `{B_2}_bar = C_{J_2}(m) * r + \sum_{i in I_2}(h_i * (m_i*r)) + {A_2}_bar * -e_2`
//!
//! Its important to prove that `r` is same in `C_{J_1}(m)` and `C_{J_2}(m)` otherwise two unequal
//! messages `m_a` and `m_b` can be proven equal by using signature randomizers `r_1` and `r2` such that `m_a * r_1 = m_b * r_2`
Expand Down
2 changes: 1 addition & 1 deletion bulletproofs_plus_plus/src/range_proof_arbitrary_range.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use dock_crypto_utils::msm::WindowTable;
/// Range proof for values in arbitrary ranges where each value `v_i` belongs to interval `[min_i, max_i)`
/// Uses the range proof for perfect ranges of form `[0, base^l)` where upper bound is a power of the base.
/// It splits a single range check of the form `min_i <= v_i < max_i` into 2 as `0 <= v_i - min_i` and `0 <= max_i - 1 - v_i`
/// and creates proofs both both checks. Along the proofs, it outputs commitments to `v_i - min_i` and `max_i - 1 - v_i` as
/// and creates proofs both checks. Along the proofs, it outputs commitments to `v_i - min_i` and `max_i - 1 - v_i` as
/// `g * (v_i - min_i) + h * {r_i}_1` and `g * (max_i - 1 - v_i) + h * {r_i}_2` respectively and both which can be
/// transformed to `g * v_i + h * {r_i}_1`, `g * v_i + h * {r_i}_2` by the verifier and the prover proves that
/// `v_i` in `g * v_i + h * r_i` in is same as `v_i` in `g * v_i + h * {r_i}_1`, `g * v_i + h * {r_i}_2`
Expand Down
4 changes: 2 additions & 2 deletions proof_system/src/prover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use legogroth16::aggregation::srs::PreparedProverSRS;

use crate::{
constants::{
BBS_23_LABEL, BBS_PLUS_LABEL, BBDT16_KVAC_LABEL, COMPOSITE_PROOF_CHALLENGE_LABEL,
BBDT16_KVAC_LABEL, BBS_23_LABEL, BBS_PLUS_LABEL, COMPOSITE_PROOF_CHALLENGE_LABEL,
COMPOSITE_PROOF_LABEL, CONTEXT_LABEL, KB_POS_ACCUM_CDH_MEM_LABEL, KB_POS_ACCUM_MEM_LABEL,
KB_UNI_ACCUM_CDH_MEM_LABEL, KB_UNI_ACCUM_CDH_NON_MEM_LABEL, KB_UNI_ACCUM_MEM_LABEL,
KB_UNI_ACCUM_NON_MEM_LABEL, NONCE_LABEL, PS_LABEL, VB_ACCUM_CDH_MEM_LABEL,
Expand Down Expand Up @@ -48,10 +48,10 @@ use crate::{
KBUniversalAccumulatorNonMembershipSubProtocol, VBAccumulatorMembershipSubProtocol,
VBAccumulatorNonMembershipSubProtocol,
},
bbdt16_kvac::PoKOfMACSubProtocol,
bbs_23::PoKBBSSigG1SubProtocol,
bbs_23_ietf::PoKBBSSigIETFG1SubProtocol,
bbs_plus::PoKBBSSigG1SubProtocol as PoKBBSPlusSigG1SubProtocol,
bbdt16_kvac::PoKOfMACSubProtocol,
bound_check_bpp::BoundCheckBppProtocol,
bound_check_legogroth16::BoundCheckLegoGrothProtocol,
bound_check_smc::BoundCheckSmcProtocol,
Expand Down
3 changes: 1 addition & 2 deletions proof_system/src/sub_protocols/bound_check_bpp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ impl<'a, G: AffineRepr> BoundCheckBppProtocol<'a, G> {
commitments: None,
bpp_randomness: None,
values: None,
// bpp_proof: None,
sp1: None,
sp2: None,
}
Expand Down Expand Up @@ -86,7 +85,7 @@ impl<'a, G: AffineRepr> BoundCheckBppProtocol<'a, G> {
blindings_for_bpp: (G::ScalarField, G::ScalarField),
commitments: &[G],
) -> Result<(), ProofSystemError> {
// blinding used to prove knowledge of message in `snark_proof.d`. The caller of this method ensures
// blinding used to prove knowledge of message. The caller of this method ensures
// that this will be same as the one used proving knowledge of the corresponding message in BBS+
// signature, thus allowing them to be proved equal.
let blinding = if blinding.is_none() {
Expand Down
2 changes: 1 addition & 1 deletion proof_system/src/sub_protocols/mod.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
pub mod accumulator;
#[macro_use]
pub mod bbs_plus;
pub mod bbdt16_kvac;
pub mod bbs_23;
pub mod bbs_23_ietf;
pub mod bbdt16_kvac;
pub mod bound_check_bpp;
pub mod bound_check_legogroth16;
pub mod bound_check_smc;
Expand Down
4 changes: 2 additions & 2 deletions proof_system/src/verifier.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::{
constants::{
BBS_23_LABEL, BBS_PLUS_LABEL, BBDT16_KVAC_LABEL, COMPOSITE_PROOF_CHALLENGE_LABEL,
BBDT16_KVAC_LABEL, BBS_23_LABEL, BBS_PLUS_LABEL, COMPOSITE_PROOF_CHALLENGE_LABEL,
COMPOSITE_PROOF_LABEL, CONTEXT_LABEL, KB_POS_ACCUM_CDH_MEM_LABEL, KB_POS_ACCUM_MEM_LABEL,
KB_UNI_ACCUM_CDH_MEM_LABEL, KB_UNI_ACCUM_CDH_NON_MEM_LABEL, KB_UNI_ACCUM_MEM_LABEL,
KB_UNI_ACCUM_NON_MEM_LABEL, NONCE_LABEL, PS_LABEL, VB_ACCUM_CDH_MEM_LABEL,
Expand Down Expand Up @@ -29,10 +29,10 @@ use crate::{
KBUniversalAccumulatorNonMembershipSubProtocol, VBAccumulatorMembershipSubProtocol,
VBAccumulatorNonMembershipSubProtocol,
},
bbdt16_kvac::PoKOfMACSubProtocol,
bbs_23::PoKBBSSigG1SubProtocol as PoKBBSSig23G1SubProtocol,
bbs_23_ietf::PoKBBSSigIETFG1SubProtocol as PoKBBSSig23IETFG1SubProtocol,
bbs_plus::PoKBBSSigG1SubProtocol,
bbdt16_kvac::PoKOfMACSubProtocol,
bound_check_bpp::BoundCheckBppProtocol,
bound_check_legogroth16::BoundCheckLegoGrothProtocol,
bound_check_smc::BoundCheckSmcProtocol,
Expand Down
14 changes: 10 additions & 4 deletions utils/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
<!-- cargo-rdme start -->

A collection of utilities used by our other crypto libraries. Some examples are Pedersen commitment,
Elgamal encryption, some finite field utilities like inner product, weighted inner product, hadamard product,
etc, multiscalar multiplication (MSM) like Fixed Base MSM, polynomial utilities like multiplying polynomials,
creating polynomial from roots, etc, efficient way of checking several pairing relations in a single multi-pairing.
A collection of utilities used by our other libraries in this workspace.

- Pedersen commitment
- Elgamal encryption
- finite field utilities like inner product, weighted inner product, hadamard product, etc.
- multiscalar multiplication (MSM) like Fixed Base MSM
- polynomial utilities like multiplying polynomials, creating polynomial from roots, etc.
- An efficient way to check several equality relations involving pairings by combining the relations in a random linear combination and doing a multi-pairing check. Relies on Schwartz–Zippel lemma.
- hashing utilities like hashing arbitrary bytes to field element or group element.
- solving discrete log using Baby Step Giant Step algorithm

<!-- cargo-rdme end -->
13 changes: 9 additions & 4 deletions utils/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
//! A collection of utilities used by our other crypto libraries. Some examples are Pedersen commitment,
//! Elgamal encryption, some finite field utilities like inner product, weighted inner product, hadamard product,
//! etc, multiscalar multiplication (MSM) like Fixed Base MSM, polynomial utilities like multiplying polynomials,
//! creating polynomial from roots, etc, efficient way of checking several pairing relations in a single multi-pairing.
//! A collection of utilities used by our other libraries in this workspace.
//!
//! - Pedersen commitment
//! - Elgamal encryption
//! - finite field utilities like inner product, weighted inner product, hadamard product, etc.
//! - multiscalar multiplication (MSM) like Fixed Base MSM
//! - polynomial utilities like multiplying polynomials, creating polynomial from roots, etc.
//! - An efficient way to check several equality relations involving pairings by combining the relations in a random linear combination and doing a multi-pairing check. Relies on Schwartz–Zippel lemma.
//! - hashing utilities like hashing arbitrary bytes to field element or group element.
//! - solving discrete log using Baby Step Giant Step algorithm
#![cfg_attr(not(feature = "std"), no_std)]

Expand Down

0 comments on commit 82f19ab

Please sign in to comment.