Skip to content

Commit

Permalink
Verifier tests (#23)
Browse files Browse the repository at this point in the history
* Update polynomial_arithmetic.rs

Added more documentation for cargo docs.

* docs/PhantomData in `polynomials.rs`

Added documentation and removed the use of `PhatomData` here as it seemed unnecessary.

* Update evaluation_domain.rs

* addressed some verifier test errors

fixed most borrow checker errors

lifetime annotations, verifier test compiles

cleaned up commented code

update unimplemented message

making it work on composer, assuming you squash this

* saying polynomial in funny voice in my head rn

* cargo fix n format

---------

Co-authored-by: Colin Roberts <[email protected]>
Co-authored-by: Claudia Richoux <[email protected]>
  • Loading branch information
3 people committed Jul 16, 2023
1 parent 050cbc2 commit 201dbc5
Show file tree
Hide file tree
Showing 13 changed files with 696 additions and 226 deletions.
16 changes: 8 additions & 8 deletions barustenberg-benches/benches/a_benchmark.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
use criterion::{criterion_group, criterion_main, Criterion};

pub fn add_benchmark(c: &mut Criterion) {
let mut rvg = barustenberg::test_utils::Rvg::deterministic();
let int_val_1 = rvg.sample(&(0..100i32));
let int_val_2 = rvg.sample(&(0..100i32));
// let mut rvg = barustenberg::test_utils::Rvg::deterministic();
// let int_val_1 = rvg.sample(&(0..100i32));
// let int_val_2 = rvg.sample(&(0..100i32));

c.bench_function("add", |b| {
b.iter(|| {
barustenberg::add(int_val_1, int_val_2);
})
});
// c.bench_function("add", |b| {
// b.iter(|| {
// barustenberg::add(int_val_1, int_val_2);
// })
// });
}
criterion_group!(benches, add_benchmark);
criterion_main!(benches);
9 changes: 8 additions & 1 deletion barustenberg/src/plonk/composer/composer_base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ use crate::{
},
polynomials::Polynomial,
srs::reference_string::ReferenceStringFactory,
transcript::Manifest,
};

pub(crate) const DUMMY_TAG: u32 = 0;
Expand All @@ -40,6 +41,12 @@ pub(crate) enum ComposerType {
StandardHonk,
}

impl ComposerType {
pub(crate) fn create_manifest(self, _x: usize) -> Manifest {
unimplemented!("ComposerType::create_manifest")
}
}

#[derive(Debug, PartialEq, Eq, Clone, Copy)]
pub(crate) struct CycleNode {
pub(crate) gate_index: u32,
Expand Down Expand Up @@ -652,7 +659,7 @@ pub(crate) trait ComposerBase {
let mut selector_poly = (*selector_poly).borrow_mut();
let selector_poly_coefficients = &mut selector_poly.coefficients;

let mut reference_string = (*proving_key.reference_string).borrow_mut();
let reference_string = (*proving_key.reference_string).borrow_mut();
let mut pippenger_runtime_state = proving_key.pippenger_runtime_state.clone();

// Commit to the constraint selector polynomial and insert the commitment in the verification key.
Expand Down
8 changes: 2 additions & 6 deletions barustenberg/src/plonk/proof_system/utils/permutation.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use ark_ec::AffineRepr;
use ark_ff::{FftField, Field};

use crate::{
Expand All @@ -19,10 +18,7 @@ pub(crate) struct PermutationSubgroupElement {
is_tag: bool,
}

pub(crate) fn compute_permutation_lagrange_base_single<
H: BarretenHasher,
Fr: Field + FftField,
>(
pub(crate) fn compute_permutation_lagrange_base_single<H: BarretenHasher, Fr: Field + FftField>(
output: &mut Polynomial<Fr>,
permutation: &[u32],
small_domain: &EvaluationDomain<Fr>,
Expand Down Expand Up @@ -87,4 +83,4 @@ pub(crate) fn compute_permutation_lagrange_base_single_helper<
}
}
}
}
}
4 changes: 2 additions & 2 deletions barustenberg/src/plonk/proof_system/verifier/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ use super::verification_key::VerificationKey;

use anyhow::{anyhow, Result};

// #[cfg(test)]
// mod test;
#[cfg(test)]
mod test;

#[derive(Debug)]
pub struct Verifier<H: BarretenHasher, S: Settings<Hasher = H, Field = Fr, Group = G1Affine>> {
Expand Down
Loading

0 comments on commit 201dbc5

Please sign in to comment.