Skip to content

Commit

Permalink
move crypto folder to test_helpers
Browse files Browse the repository at this point in the history
  • Loading branch information
z-tech committed Jul 31, 2024
1 parent 4e74c11 commit 1bcedea
Show file tree
Hide file tree
Showing 18 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/direct/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ mod tests {
use ark_std::test_rng;

use crate::{
crypto::{fields::Field256, fs, merkle_tree},
direct::{config::DirectConfig, ldt::DirectLDT},
domain::Domain,
ldt::{LowDegreeTest, Prover, Verifier},
test_helpers::{fields::Field256, fs, merkle_tree},
witness::{
single::{SingleWitness, SingleWitnessArgument},
Witness,
Expand Down
2 changes: 1 addition & 1 deletion src/direct/proof.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ where
// squeeze out the challenges as indices
let mut challenges = Vec::with_capacity(num_challenges);
for _ in 0..num_challenges {
challenges.push(squeeze_integer(&mut sponge, 32));
challenges.push(squeeze_integer(&mut sponge, self.committed_values.len()));
}
dedup(challenges)
}
Expand Down
6 changes: 3 additions & 3 deletions src/direct/verifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,17 @@ where
_witness: PhantomData::<W>,
}
}
fn verify(&self, claim: &Self::Statement, proof: &Self::Proof) -> bool {
fn verify(&self, statement: &Self::Statement, proof: &Self::Proof) -> bool {
// regenerate the challenges
let mut sponge = S::new(&self.config.sponge_config);
sponge.absorb(&claim.commitment_digest());
sponge.absorb(&statement.commitment_digest());
// squeeze out the challenges as indices
let mut challenges = Vec::with_capacity(self.config.num_challenges);
for _ in 0..self.config.num_challenges {
challenges.push(squeeze_integer(&mut sponge, proof.num_committed_values()));
}
challenges = dedup(challenges);
// verifiy the proof against the claim
proof.verify(claim.commitment_digest(), challenges)
proof.verify(statement.commitment_digest(), challenges)
}
}
2 changes: 1 addition & 1 deletion src/domain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ mod tests {
use hashbrown::HashSet;

use super::*;
use crate::crypto::fields::Field64 as TestField;
use crate::test_helpers::fields::Field64 as TestField;

#[test]
fn test_non_overlapping() {
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#![cfg_attr(not(feature = "std"), no_std)]
pub mod crypto;
pub mod direct;
pub mod domain;
pub mod ldt;
pub mod poly_utils;
pub mod statement;
pub mod stir;
pub mod test_helpers;
pub mod utils;
pub mod witness;
2 changes: 1 addition & 1 deletion src/poly_utils/bs08.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ where
#[cfg(test)]
mod tests {
use super::*;
use crate::crypto::fields::Field64 as TestField;
use crate::test_helpers::fields::Field64 as TestField;
use ark_ff::AdditiveGroup;
use ark_std::rand::Rng;

Expand Down
2 changes: 1 addition & 1 deletion src/poly_utils/folding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ mod tests {
use ark_poly::DenseUVPolynomial;

use super::*;
use crate::crypto::fields::Field64 as TestField;
use crate::test_helpers::fields::Field64 as TestField;

#[test]
fn test_folding() {
Expand Down
2 changes: 1 addition & 1 deletion src/poly_utils/interpolation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ pub fn evaluate_interpolation<'a, F: Field>(
#[cfg(test)]
mod tests {
use super::*;
use crate::{crypto::fields::Field64 as TestField, domain::Domain};
use crate::{domain::Domain, test_helpers::fields::Field64 as TestField};
use ark_ff::AdditiveGroup;
use ark_poly::domain::EvaluationDomain;

Expand Down
2 changes: 1 addition & 1 deletion src/poly_utils/quotient.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ mod tests {
use ark_std::vec;

use super::*;
use crate::crypto::fields::Field64 as TestField;
use crate::test_helpers::fields::Field64 as TestField;

#[test]
fn test_quotient() {
Expand Down
2 changes: 1 addition & 1 deletion src/stir/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ mod tests {
use ark_std::vec;

use crate::{
crypto::{fields::Field256, fs, merkle_tree},
domain::Domain,
ldt::{LowDegreeTest, Prover, Verifier},
stir::{config::STIRConfig, ldt::STIR},
test_helpers::{fields::Field256, fs, merkle_tree},
witness::{
single::{SingleWitness, SingleWitnessArgument},
Witness,
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use ark_ff::PrimeField;
use ark_serialize::{CanonicalDeserialize, CanonicalSerialize};
use ark_std::rand::RngCore;

use crate::crypto::fs;
use crate::test_helpers::fs;

use super::HashCounter;

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/witness/single.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ where
// squeeze out the challenges as indices
let mut challenges: Self::Challenges = Vec::with_capacity(num_challenges);
for _ in 0..num_challenges {
challenges.push(squeeze_integer(&mut sponge, 32)); // TODO (z-tech): this range must be set properly
challenges.push(squeeze_integer(&mut sponge, self.committed_values.len()));
}
challenges
}
Expand Down

0 comments on commit 1bcedea

Please sign in to comment.