Skip to content

Commit

Permalink
cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
chaosma committed Nov 30, 2024
1 parent 188cc7d commit 4171495
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 29 deletions.
4 changes: 1 addition & 3 deletions src/crypto/merkle_tree/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,7 @@ pub fn default_config<F: CanonicalSerialize + Send>(
) {
<LeafH<F> as CRHScheme>::setup(rng).unwrap();
{
<CompressH as TwoToOneCRHScheme>::setup(rng)
.unwrap();

<CompressH as TwoToOneCRHScheme>::setup(rng).unwrap();
};

((), ())
Expand Down
2 changes: 1 addition & 1 deletion src/fs_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ pub trait WhirPoWIOPattern {
fn pow(self, bits: f64) -> Self;
}

impl <IOPattern> WhirPoWIOPattern for IOPattern
impl<IOPattern> WhirPoWIOPattern for IOPattern
where
IOPattern: PoWIOPattern,
{
Expand Down
5 changes: 1 addition & 4 deletions src/ntt/transpose.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,7 @@ fn transpose_copy_parallel<F: Sized + Copy + Send>(

/// Sets `dst` to the transpose of `src`. This will panic if the sizes of `src` and `dst` are not compatible.
/// This is the non-parallel version
fn transpose_copy_not_parallel<F: Sized + Copy>(
src: MatrixMut<'_, F>,
mut dst: MatrixMut<'_, F>,
) {
fn transpose_copy_not_parallel<F: Sized + Copy>(src: MatrixMut<'_, F>, mut dst: MatrixMut<'_, F>) {
assert_eq!(src.rows(), dst.cols());
assert_eq!(src.cols(), dst.rows());
if src.rows() * src.cols() > workload_size::<F>() {
Expand Down
31 changes: 23 additions & 8 deletions src/sumcheck/prover_not_skipping.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
use ark_ff::Field;
use nimue::{plugins::ark::{FieldChallenges, FieldIOPattern, FieldWriter}, IOPattern, ProofResult};
use nimue::{
plugins::ark::{FieldChallenges, FieldIOPattern, FieldWriter},
IOPattern, ProofResult,
};
use nimue_pow::{PoWChallenge, PowStrategy};

use crate::{
Expand Down Expand Up @@ -101,7 +104,10 @@ where
#[cfg(test)]
mod tests {
use ark_ff::Field;
use nimue::{plugins::ark::{FieldChallenges, FieldIOPattern, FieldReader}, IOPattern, Merlin, ProofResult};
use nimue::{
plugins::ark::{FieldChallenges, FieldIOPattern, FieldReader},
IOPattern, Merlin, ProofResult,
};
use nimue_pow::blake3::Blake3PoW;

use crate::{
Expand Down Expand Up @@ -151,8 +157,11 @@ mod tests {
],
);

let folding_randomness_1 =
prover.compute_sumcheck_polynomials::<Blake3PoW, Merlin>(&mut merlin, folding_factor, 0.)?;
let folding_randomness_1 = prover.compute_sumcheck_polynomials::<Blake3PoW, Merlin>(
&mut merlin,
folding_factor,
0.,
)?;

// Compute the answers
let folded_poly_1 = polynomial.fold(&folding_randomness_1);
Expand Down Expand Up @@ -237,15 +246,21 @@ mod tests {
],
);

let folding_randomness_1 =
prover.compute_sumcheck_polynomials::<Blake3PoW, Merlin>(&mut merlin, folding_factor, 0.)?;
let folding_randomness_1 = prover.compute_sumcheck_polynomials::<Blake3PoW, Merlin>(
&mut merlin,
folding_factor,
0.,
)?;

let folded_poly_1 = polynomial.fold(&folding_randomness_1);
let fold_eval = folded_poly_1.evaluate_at_extension(&fold_point);
prover.add_new_equality(&[fold_point.clone()], &combination_randomness, &[fold_eval]);

let folding_randomness_2 =
prover.compute_sumcheck_polynomials::<Blake3PoW, Merlin>(&mut merlin, folding_factor, 0.)?;
let folding_randomness_2 = prover.compute_sumcheck_polynomials::<Blake3PoW, Merlin>(
&mut merlin,
folding_factor,
0.,
)?;

// Compute the answers
let folded_poly_1 = polynomial.fold(&folding_randomness_1);
Expand Down
8 changes: 4 additions & 4 deletions src/whir/mod.rs
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
use ark_crypto_primitives::merkle_tree::{Config, MultiPath};
use ark_ff::FftField;
use ark_serialize::{CanonicalDeserialize, CanonicalSerialize};
use goldilocks::ExtensionField;
use serde::{de::DeserializeOwned, Serialize};
// use goldilocks::ExtensionField;
use std::fmt::Debug;

use crate::errors::Error;
use crate::poly_utils::MultilinearPoint;

pub mod committer;
mod fs_utils;
pub mod iopattern;
pub mod parameters;
pub mod pcs;
pub mod prover;
pub mod verifier;
mod fs_utils;

#[derive(Debug, Clone, Default)]
pub struct Statement<F> {
Expand All @@ -39,7 +39,7 @@ where
transcript.len() + whir_proof.serialized_size(ark_serialize::Compress::Yes)
}

pub trait PolynomialCommitmentScheme<E: ExtensionField>: Clone {
pub trait PolynomialCommitmentScheme<E: FftField>: Clone {
type Param: Clone;
type ProverParam: Clone;
type VerifierParam: Clone;
Expand Down
2 changes: 1 addition & 1 deletion src/whir/pcs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ type WhirPCSConfig<E> = WhirConfig<E, MerkleTreeParams<E>, ()>;

impl<E> PolynomialCommitmentScheme<E> for Whir<E>
where
E: FftField + ExtensionField + CanonicalSerialize + CanonicalDeserialize,
E: FftField + CanonicalSerialize + CanonicalDeserialize,
{
type Param = WhirPCSConfig<E>;
type ProverParam = WhirPCSConfig<E>;
Expand Down
13 changes: 7 additions & 6 deletions src/whir/prover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ where
self.0.final_queries,
merlin,
)?;

let merkle_proof = round_state
.prev_merkle
.generate_multi_proof(final_challenge_indexes.clone())
Expand Down Expand Up @@ -351,11 +351,12 @@ where
)
});

let folding_randomness = sumcheck_prover.compute_sumcheck_polynomials::<PowStrategy, Merlin>(
merlin,
self.0.folding_factor,
round_params.folding_pow_bits,
)?;
let folding_randomness = sumcheck_prover
.compute_sumcheck_polynomials::<PowStrategy, Merlin>(
merlin,
self.0.folding_factor,
round_params.folding_pow_bits,
)?;

let round_state = RoundState {
round: round_state.round + 1,
Expand Down
4 changes: 2 additions & 2 deletions src/whir/verifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ use ark_crypto_primitives::merkle_tree::Config;
use ark_ff::FftField;
use ark_poly::EvaluationDomain;
use nimue::{
plugins::ark::{FieldChallenges, FieldReader}
, ByteChallenges, ByteReader, ProofError, ProofResult,
plugins::ark::{FieldChallenges, FieldReader},
ByteChallenges, ByteReader, ProofError, ProofResult,
};
use nimue_pow::{self, PoWChallenge};

Expand Down

0 comments on commit 4171495

Please sign in to comment.