Skip to content

Commit

Permalink
docs(nifs): protogalaxy::{prove,verify}
Browse files Browse the repository at this point in the history
  • Loading branch information
cyphersnake committed Jul 29, 2024
1 parent 12577d9 commit 73a9970
Showing 1 changed file with 60 additions and 0 deletions.
60 changes: 60 additions & 0 deletions src/nifs/protogalaxy/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,36 @@ impl<C: CurveAffine, const L: usize> FoldingScheme<C, L> for ProtoGalaxy<C, L> {
.run_sps_protocol(ck, instance, witness, ro_nark, pp.S.num_challenges)?)
}

/// Proves a statement using the ProtoGalaxy protocol.
///
/// # Algorithm
///
/// The logic of the proof generation follows several key steps:
///
/// 1. **Generate Delta:**
/// - **RO Seeds**: includes all input parameters except `ck` & witness from `incoming`
/// - `delta = ro_acc.squeeze()`
///
/// 2. **Compute Polynomial F:**
/// - `F = [`poly::compute_F`]`
///
/// 3. **Generate Alpha:**
/// - **RO Update**: absorb `poly_F`
/// - `alpha = ro_acc.squeeze()`
///
/// 4. **Update Beta* Values:**
/// - `beta*[i] = beta[i] + alpha * delta[i]`
///
/// 5. **Compute Polynomial K:**
/// - `G = [`poly::compute_G`]
/// - `K = [`poly::compute_K`]
///
/// 6. **Generate Gamma:**
/// - **RO Update**: Absorb `poly_K`
/// - `gamma = ro_acc.squeeze()`
///
/// 7. **Fold the Trace:**
/// - [`ProtoGalaxy::fold_witness`] & [`ProtoGalaxy::fold_instance`]
fn prove(
_ck: &CommitmentKey<C>,
pp: &Self::ProverParam,
Expand Down Expand Up @@ -332,6 +362,36 @@ impl<C: CurveAffine, const L: usize> FoldingScheme<C, L> for ProtoGalaxy<C, L> {
))
}

/// Proves a statement using the ProtoGalaxy protocol.
///
/// # Algorithm
///
/// The logic of the proof generation follows several key steps:
///
/// 1. **Generate Delta:**
/// - **RO Seeds**: includes all input parameters except `ck`
/// - `delta = ro_acc.squeeze()`
///
/// 2. **Compute Polynomial F:**
/// - `F = [`poly::compute_F`]`
///
/// 3. **Generate Alpha:**
/// - **RO Update**: absorb `poly_F`
/// - `alpha = ro_acc.squeeze()`
///
/// 4. **Update Beta* Values:**
/// - `beta*[i] = beta[i] + alpha * delta[i]`
///
/// 5. **Compute Polynomial K:**
/// - `G = [`poly::compute_G`]
/// - `K = [`poly::compute_K`]
///
/// 6. **Generate Gamma:**
/// - **RO Update**: Absorb `poly_K`
/// - `gamma = ro_acc.squeeze()`
///
/// 7. **Fold the Instance:**
/// - [`ProtoGalaxy::fold_instance`]
fn verify(
vp: &Self::VerifierParam,
ro_nark: &mut impl ROTrait<C::Base>,
Expand Down

0 comments on commit 73a9970

Please sign in to comment.