Skip to content

Commit

Permalink
📝 Update documentation comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
sheagrief committed Sep 5, 2024
1 parent 44fa2fe commit c564327
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 0 deletions.
2 changes: 2 additions & 0 deletions mpc-algebra/src/r1cs_helper.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
16 changes: 16 additions & 0 deletions mpc-algebra/src/wire/field.rs
Original file line number Diff line number Diff line change
Expand Up @@ -576,6 +576,14 @@ impl<F: Field, S: FieldShare<F>> Zero for MpcField<F, S> {

impl<F: PrimeField + SquareRootField, S: FieldShare<F>> EqualityZero for MpcField<F, S> {
type Output = MpcBooleanField<F, S>;

/// 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(_) => {
Expand Down Expand Up @@ -626,6 +634,14 @@ impl<F: PrimeField + SquareRootField, S: FieldShare<F>> EqualityZero for MpcFiel

impl<F: PrimeField + SquareRootField, S: FieldShare<F>> BitDecomposition for MpcField<F, S> {
type BooleanField = MpcBooleanField<F, S>;

/// 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<Self::BooleanField> {
match self.is_shared() {
true => {
Expand Down
1 change: 1 addition & 0 deletions src/circuits/smaller_than.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ use mpc_algebra::{MpcBoolean, MpcEqGadget, MpcFpVar};
type Fr = ark_bls12_377::Fr;
type MFr = MpcField<Fr>;

/// This circuit checks if a value is smaller than another value.
pub struct SmallerThanCircuit<F: PrimeField> {
pub a: F,
pub b: F,
Expand Down
4 changes: 4 additions & 0 deletions src/groth16.rs
Original file line number Diff line number Diff line change
@@ -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};
Expand Down
4 changes: 4 additions & 0 deletions src/marlin.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down

0 comments on commit c564327

Please sign in to comment.