diff --git a/mpc-algebra/src/r1cs_helper.rs b/mpc-algebra/src/r1cs_helper.rs index c4c6a80..10bba55 100644 --- a/mpc-algebra/src/r1cs_helper.rs +++ b/mpc-algebra/src/r1cs_helper.rs @@ -1,3 +1,5 @@ +//! This module contains helper functions for creating R1CS constraints for MPC protocols. + pub mod mpc_boolean; pub use mpc_boolean::*; pub mod mpc_eq; diff --git a/mpc-algebra/src/wire/field.rs b/mpc-algebra/src/wire/field.rs index 0d43229..dc225f7 100644 --- a/mpc-algebra/src/wire/field.rs +++ b/mpc-algebra/src/wire/field.rs @@ -576,6 +576,14 @@ impl> Zero for MpcField { impl> EqualityZero for MpcField { type Output = MpcBooleanField; + + /// Check if the MPC field element is zero in MPC. + /// + /// # Arguments + /// `self` - A MPC field element. + /// + /// # Returns + /// A MPC boolean field element. fn is_zero_shared(&self) -> Self::Output { let res = match self { MpcField::Public(_) => { @@ -626,6 +634,14 @@ impl> EqualityZero for MpcFiel impl> BitDecomposition for MpcField { type BooleanField = MpcBooleanField; + + /// Bit decomposition of a field element. + /// + /// # Arguments + /// `self` - A Mpc field element. + /// + /// # Returns + /// A vector of bits of the Mpc field element(Little-Endian). fn bit_decomposition(&self) -> Vec { match self.is_shared() { true => { diff --git a/src/circuits/smaller_than.rs b/src/circuits/smaller_than.rs index f92745e..79a3ad7 100644 --- a/src/circuits/smaller_than.rs +++ b/src/circuits/smaller_than.rs @@ -13,6 +13,7 @@ use mpc_algebra::{MpcBoolean, MpcEqGadget, MpcFpVar}; type Fr = ark_bls12_377::Fr; type MFr = MpcField; +/// This circuit checks if a value is smaller than another value. pub struct SmallerThanCircuit { pub a: F, pub b: F, diff --git a/src/groth16.rs b/src/groth16.rs index 2f386d6..145530f 100644 --- a/src/groth16.rs +++ b/src/groth16.rs @@ -1,3 +1,7 @@ +//! # Groth16: zk-SNARKs +//! +//! This module provides functions for setting up, proving, and verifying MPC (Multi-Party Computation) circuits using the Groth16 zkSNARK. + #[cfg(test)] mod tests { use ark_bls12_377::{Bls12_377, Fr}; diff --git a/src/marlin.rs b/src/marlin.rs index 94d60e0..0153f11 100644 --- a/src/marlin.rs +++ b/src/marlin.rs @@ -1,3 +1,7 @@ +//! # Marlin: zk-SNARKs +//! +//! This module provides functions for setting up, proving, and verifying MPC (Multi-Party Computation) circuits using the Marlin zkSNARK. + use ark_ff::{BigInteger, PrimeField}; use ark_marlin::{ahp::prover::*, *}; use ark_poly::univariate::DensePolynomial;