Skip to content

Commit

Permalink
Fix intradoc links & lint checks
Browse files Browse the repository at this point in the history
  • Loading branch information
davidnevadoc committed Apr 26, 2022
1 parent d1a3737 commit cbc7e97
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 17 deletions.
5 changes: 3 additions & 2 deletions plonk-core/src/circuit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,8 @@ where
}

/// Generates a proof using the provided [`ProverKey`] and
/// [`PC::UniversalParams`]. Returns a proof and the Public Inputs
/// [`ark_poly_commit::PCUniversalParams`]. Returns a
/// [`crate::proof_system::Proof`] and the [`PI`].
fn gen_proof<PC>(
&mut self,
u_params: &PC::UniversalParams,
Expand Down Expand Up @@ -309,7 +310,7 @@ where
let (_, vk) = PC::trim(u_params, padded_circuit_size, 0, None)
.map_err(to_pc_error::<F, PC>)?;

verifier.verify(proof, &vk, &public_inputs)
verifier.verify(proof, &vk, public_inputs)
}

#[cfg(test)]
Expand Down
23 changes: 8 additions & 15 deletions plonk-core/src/proof_system/pi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
//
// Copyright (c) ZK-Garage. All rights reserved.

//! Public Inputs of the circuit. This values are available for the [`Prover`]
//! and [`Verifier`].
//! Public Inputs of the circuit. This values are available for the
//! [`super::Prover`] and [`super::Verifier`].
//!
//! This module contains the implementation of the [`PI`] struct and all the
//! basic manipulations such as inserting new values and getting the public
Expand Down Expand Up @@ -68,7 +68,7 @@ where

/// Inserts a new public input value at a given position.
pub fn insert(&mut self, pos: usize, val: F) {
if let Some(_) = self.values.insert(pos, val) {
if self.values.insert(pos, val).is_some() {
panic!("Insertion in public inputs conflicts with previous value at position {}", pos);
}
}
Expand Down Expand Up @@ -103,7 +103,7 @@ where
.to_field_elements()
.ok_or(Error::InvalidPublicInputValue)?;

for (pos2, elem) in item_repr.into_iter().enumerate() {
for (pos2, elem) in item_repr.iter().enumerate() {
self.values.insert(init_pos + pos1 + pos2, *elem);
result += 1;
}
Expand All @@ -119,20 +119,13 @@ where
}
}

impl<F> Into<DensePolynomial<F>> for &PI<F>
impl<F> From<&PI<F>> for DensePolynomial<F>
where
F: PrimeField,
{
fn into(self) -> DensePolynomial<F> {
let domain = GeneralEvaluationDomain::<F>::new(self.n).unwrap();
let evals = self.as_evals();
fn from(pi: &PI<F>) -> Self {
let domain = GeneralEvaluationDomain::<F>::new(pi.n).unwrap();
let evals = pi.as_evals();
DensePolynomial::from_coefficients_vec(domain.ifft(&evals))
}
}

// impl<F> for PI<F>
// where
// F: Field,
// {

// }

0 comments on commit cbc7e97

Please sign in to comment.