diff --git a/ceno_zkvm/examples/riscv_opcodes.rs b/ceno_zkvm/examples/riscv_opcodes.rs index 495623a22..453c956f6 100644 --- a/ceno_zkvm/examples/riscv_opcodes.rs +++ b/ceno_zkvm/examples/riscv_opcodes.rs @@ -25,7 +25,6 @@ use ff_ext::ff::Field; use goldilocks::GoldilocksExt2; use itertools::Itertools; use mpcs::{Basefold, BasefoldRSParams, PolynomialCommitmentScheme}; -use rand_chacha::ChaCha8Rng; use tracing_flame::FlameLayer; use tracing_subscriber::{EnvFilter, Registry, fmt, layer::SubscriberExt}; use transcript::Transcript; @@ -76,7 +75,7 @@ struct Args { fn main() { let args = Args::parse(); type E = GoldilocksExt2; - type Pcs = Basefold; + type Pcs = Basefold; let program = Program::new( CENO_PLATFORM.pc_base(), diff --git a/ceno_zkvm/src/scheme/tests.rs b/ceno_zkvm/src/scheme/tests.rs index 0540daf4c..4c5ed6351 100644 --- a/ceno_zkvm/src/scheme/tests.rs +++ b/ceno_zkvm/src/scheme/tests.rs @@ -10,7 +10,6 @@ use ff_ext::ExtensionField; use goldilocks::GoldilocksExt2; use itertools::Itertools; use mpcs::{Basefold, BasefoldDefault, BasefoldRSParams, PolynomialCommitmentScheme}; -use rand_chacha::ChaCha8Rng; use transcript::Transcript; use crate::{ @@ -197,7 +196,7 @@ const PROGRAM_CODE: [u32; PROGRAM_SIZE] = { #[test] fn test_single_add_instance_e2e() { type E = GoldilocksExt2; - type Pcs = Basefold; + type Pcs = Basefold; // set up program let program = Program::new( diff --git a/mpcs/benches/basecode.rs b/mpcs/benches/basecode.rs index 9422e04d2..193d15f88 100644 --- a/mpcs/benches/basecode.rs +++ b/mpcs/benches/basecode.rs @@ -18,7 +18,7 @@ use rand::{SeedableRng, rngs::OsRng}; use rand_chacha::ChaCha8Rng; use rayon::iter::{IntoParallelRefIterator, ParallelIterator}; -type Pcs = Basefold; +type Pcs = Basefold; type E = GoldilocksExt2; const NUM_SAMPLES: usize = 10; diff --git a/mpcs/benches/commit_open_verify_basecode.rs b/mpcs/benches/commit_open_verify_basecode.rs index 926244c39..1a22e9171 100644 --- a/mpcs/benches/commit_open_verify_basecode.rs +++ b/mpcs/benches/commit_open_verify_basecode.rs @@ -15,7 +15,7 @@ use rand::{SeedableRng, rngs::OsRng}; use rand_chacha::ChaCha8Rng; use transcript::Transcript; -type Pcs = Basefold; +type Pcs = Basefold; type T = Transcript; type E = GoldilocksExt2; diff --git a/mpcs/benches/commit_open_verify_rs.rs b/mpcs/benches/commit_open_verify_rs.rs index 55385c406..686253218 100644 --- a/mpcs/benches/commit_open_verify_rs.rs +++ b/mpcs/benches/commit_open_verify_rs.rs @@ -19,7 +19,7 @@ use rand_chacha::ChaCha8Rng; use rayon::iter::{IntoParallelIterator, ParallelIterator}; use transcript::Transcript; -type Pcs = Basefold; +type Pcs = Basefold; type T = Transcript; type E = GoldilocksExt2; diff --git a/mpcs/benches/rscode.rs b/mpcs/benches/rscode.rs index 0e88ab87e..ac9870d84 100644 --- a/mpcs/benches/rscode.rs +++ b/mpcs/benches/rscode.rs @@ -18,7 +18,7 @@ use rand::{SeedableRng, rngs::OsRng}; use rand_chacha::ChaCha8Rng; use rayon::iter::{IntoParallelRefIterator, ParallelIterator}; -type Pcs = Basefold; +type Pcs = Basefold; type E = GoldilocksExt2; const NUM_SAMPLES: usize = 10; diff --git a/mpcs/src/basefold.rs b/mpcs/src/basefold.rs index 6a6003aa5..3f85022cc 100644 --- a/mpcs/src/basefold.rs +++ b/mpcs/src/basefold.rs @@ -47,7 +47,6 @@ use multilinear_extensions::{ virtual_poly::build_eq_x_r_vec, }; -use rand_chacha::{ChaCha8Rng, rand_core::RngCore}; use rayon::{ iter::IntoParallelIterator, prelude::{IntoParallelRefIterator, IntoParallelRefMutIterator, ParallelIterator}, @@ -80,7 +79,7 @@ enum PolyEvalsCodeword { TooBig(usize), } -impl, Rng: RngCore> Basefold +impl> Basefold where E: Serialize + DeserializeOwned, E::BaseField: Serialize + DeserializeOwned, @@ -266,8 +265,7 @@ where /// positions are (i >> k) and (i >> k) XOR 1. /// (c) The verifier checks that the folding has been correctly computed /// at these positions. -impl, Rng: RngCore + std::fmt::Debug> - PolynomialCommitmentScheme for Basefold +impl> PolynomialCommitmentScheme for Basefold where E: Serialize + DeserializeOwned, E::BaseField: Serialize + DeserializeOwned, @@ -279,7 +277,6 @@ where type Commitment = BasefoldCommitment; type CommitmentChunk = Digest; type Proof = BasefoldProof; - type Rng = ChaCha8Rng; fn setup(poly_size: usize) -> Result { let pp = >::setup(log2_strict(poly_size)); @@ -1170,8 +1167,7 @@ where } } -impl, Rng: RngCore + std::fmt::Debug> NoninteractivePCS - for Basefold +impl> NoninteractivePCS for Basefold where E: Serialize + DeserializeOwned, E::BaseField: Serialize + DeserializeOwned, @@ -1188,12 +1184,11 @@ mod test { }, }; use goldilocks::GoldilocksExt2; - use rand_chacha::ChaCha8Rng; use super::{BasefoldRSParams, structure::BasefoldBasecodeParams}; - type PcsGoldilocksRSCode = Basefold; - type PcsGoldilocksBaseCode = Basefold; + type PcsGoldilocksRSCode = Basefold; + type PcsGoldilocksBaseCode = Basefold; #[test] fn commit_open_verify_goldilocks_basecode_base() { diff --git a/mpcs/src/basefold/structure.rs b/mpcs/src/basefold/structure.rs index 00c7006b9..0cb0748a0 100644 --- a/mpcs/src/basefold/structure.rs +++ b/mpcs/src/basefold/structure.rs @@ -5,12 +5,10 @@ use crate::{ use core::fmt::Debug; use ff_ext::ExtensionField; -use rand::RngCore; use serde::{Deserialize, Serialize, de::DeserializeOwned}; use multilinear_extensions::mle::FieldType; -use rand_chacha::ChaCha8Rng; use std::{marker::PhantomData, slice}; pub use super::encoding::{EncodingProverParameters, EncodingScheme, RSCode, RSCodeDefaultSpec}; @@ -248,13 +246,11 @@ where } #[derive(Debug)] -pub struct Basefold, Rng: RngCore>( - PhantomData<(E, Spec, Rng)>, -); +pub struct Basefold>(PhantomData<(E, Spec)>); -pub type BasefoldDefault = Basefold; +pub type BasefoldDefault = Basefold; -impl, Rng: RngCore> Clone for Basefold { +impl> Clone for Basefold { fn clone(&self) -> Self { Self(PhantomData) } diff --git a/mpcs/src/lib.rs b/mpcs/src/lib.rs index 5cdda9967..46fbea0ff 100644 --- a/mpcs/src/lib.rs +++ b/mpcs/src/lib.rs @@ -1,7 +1,6 @@ use ff_ext::ExtensionField; use itertools::Itertools; use multilinear_extensions::mle::DenseMultilinearExtension; -use rand::RngCore; use serde::{Serialize, de::DeserializeOwned}; use std::fmt::Debug; use transcript::Transcript; @@ -116,7 +115,6 @@ pub trait PolynomialCommitmentScheme: Clone + Debug { type Commitment: Clone + Debug + Default + Serialize + DeserializeOwned; type CommitmentChunk: Clone + Debug + Default; type Proof: Clone + Debug + Serialize + DeserializeOwned; - type Rng: RngCore + Clone; fn setup(poly_size: usize) -> Result; @@ -375,7 +373,7 @@ pub mod test_util { num_vars_start: usize, num_vars_end: usize, ) where - Pcs: PolynomialCommitmentScheme, + Pcs: PolynomialCommitmentScheme, { for num_vars in num_vars_start..num_vars_end { // Setup @@ -434,7 +432,7 @@ pub mod test_util { num_vars_end: usize, ) where E: ExtensionField, - Pcs: PolynomialCommitmentScheme, + Pcs: PolynomialCommitmentScheme, { for num_vars in num_vars_start..num_vars_end { let batch_size = 2; @@ -550,7 +548,7 @@ pub mod test_util { batch_size: usize, ) where E: ExtensionField, - Pcs: PolynomialCommitmentScheme, + Pcs: PolynomialCommitmentScheme, { for num_vars in num_vars_start..num_vars_end { let rng = ChaCha8Rng::from_seed([0u8; 32]);