Revert "chore: from_values takes ref"

This reverts commit 7cc123e0a442d41a3610a57a2ee4f8008ef5811f.
This commit is contained in:
David Palm 2023-11-30 15:07:10 +01:00
parent 7cc123e0a4
commit 37918cccfd
No known key found for this signature in database
GPG Key ID: AC8A213E894DB26D
6 changed files with 23 additions and 14 deletions

View File

@ -722,11 +722,15 @@ mod tests {
stark.generate_trace(input, 8, &mut timing)
);
// TODO: Cloning this isn't great; consider having `from_values` accept a reference,
// or having `compute_permutation_z_polys` read trace values from the `PolynomialBatch`.
let cloned_trace_poly_values = timed!(timing, "clone", trace_poly_values.clone());
let trace_commitments = timed!(
timing,
"compute trace commitment",
PolynomialBatch::<F, C, D>::from_values(
&trace_poly_values,
cloned_trace_poly_values,
config.fri_config.rate_bits,
false,
config.fri_config.cap_height,

View File

@ -102,7 +102,14 @@ where
timing,
&format!("compute trace commitment for {:?}", table),
PolynomialBatch::<F, C, D>::from_values(
trace, rate_bits, false, cap_height, timing, None,
// TODO: Cloning this isn't great; consider having `from_values` accept a reference,
// or having `compute_permutation_z_polys` read trace values from the `PolynomialBatch`.
trace.clone(),
rate_bits,
false,
cap_height,
timing,
None,
)
)
})
@ -373,7 +380,7 @@ where
timing,
"compute auxiliary polynomials commitment",
PolynomialBatch::from_values(
&auxiliary_polys,
auxiliary_polys,
rate_bits,
false,
config.fri_config.cap_height,

View File

@ -55,7 +55,7 @@ impl<F: RichField + Extendable<D>, C: GenericConfig<D, F = F>, const D: usize>
{
/// Creates a list polynomial commitment for the polynomials interpolating the values in `values`.
pub fn from_values(
values: &[PolynomialValues<F>],
values: Vec<PolynomialValues<F>>,
rate_bits: usize,
blinding: bool,
cap_height: usize,
@ -65,11 +65,7 @@ impl<F: RichField + Extendable<D>, C: GenericConfig<D, F = F>, const D: usize>
let coeffs = timed!(
timing,
"IFFT",
values
.into_par_iter()
.cloned()
.map(|v| v.ifft())
.collect::<Vec<_>>()
values.into_par_iter().map(|v| v.ifft()).collect::<Vec<_>>()
);
Self::from_coeffs(

View File

@ -1029,7 +1029,7 @@ impl<F: RichField + Extendable<D>, const D: usize> CircuitBuilder<F, D> {
let constants_sigmas_commitment = if commit_to_sigma {
let constants_sigmas_vecs = [constant_vecs, sigma_vecs.clone()].concat();
PolynomialBatch::<F, C, D>::from_values(
&constants_sigmas_vecs,
constants_sigmas_vecs,
rate_bits,
PlonkOracle::CONSTANTS_SIGMAS.blinding,
cap_height,

View File

@ -171,7 +171,7 @@ where
timing,
"compute wires commitment",
PolynomialBatch::<F, C, D>::from_values(
&wires_values,
wires_values,
config.fri_config.rate_bits,
config.zero_knowledge && PlonkOracle::WIRES.blinding,
config.fri_config.cap_height,
@ -238,7 +238,7 @@ where
timing,
"commit to partial products, Z's and, if any, lookup polynomials",
PolynomialBatch::from_values(
&zs_partial_products_lookups,
zs_partial_products_lookups,
config.fri_config.rate_bits,
config.zero_knowledge && PlonkOracle::ZS_PARTIAL_PRODUCTS.blinding,
config.fri_config.cap_height,

View File

@ -55,7 +55,9 @@ where
timing,
"compute trace commitment",
PolynomialBatch::<F, C, D>::from_values(
&trace_poly_values,
// TODO: Cloning this isn't great; consider having `from_values` accept a reference,
// or having `compute_permutation_z_polys` read trace values from the `PolynomialBatch`.
trace_poly_values.clone(),
rate_bits,
false,
cap_height,
@ -86,7 +88,7 @@ where
timing,
"compute permutation Z commitments",
PolynomialBatch::from_values(
&permutation_z_polys,
permutation_z_polys,
rate_bits,
false,
config.fri_config.cap_height,