mirror of
https://github.com/saymrwulf/pasta_curves-source.git
synced 2026-09-06 20:20:34 +00:00
Cleanups
This commit is contained in:
parent
da9c24bcfa
commit
869aba389a
2 changed files with 12 additions and 10 deletions
10
src/plonk.rs
10
src/plonk.rs
|
|
@ -314,9 +314,11 @@ fn test_proving() {
|
||||||
// Initialize the SRS
|
// Initialize the SRS
|
||||||
let srs = SRS::generate(¶ms, &empty_circuit).expect("SRS generation should not fail");
|
let srs = SRS::generate(¶ms, &empty_circuit).expect("SRS generation should not fail");
|
||||||
|
|
||||||
// Create a proof
|
for _ in 0..100 {
|
||||||
let proof = Proof::create::<DummyHash<Fq>, DummyHash<Fp>, _>(¶ms, &srs, &circuit)
|
// Create a proof
|
||||||
.expect("proof generation should not fail");
|
let proof = Proof::create::<DummyHash<Fq>, DummyHash<Fp>, _>(¶ms, &srs, &circuit)
|
||||||
|
.expect("proof generation should not fail");
|
||||||
|
|
||||||
assert!(proof.verify::<DummyHash<Fq>, DummyHash<Fp>>(¶ms, &srs));
|
assert!(proof.verify::<DummyHash<Fq>, DummyHash<Fp>>(¶ms, &srs));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -152,7 +152,10 @@ impl<C: CurveAffine> Proof<C> {
|
||||||
// For each row i, compute
|
// For each row i, compute
|
||||||
// p_j(\omega^i) + \beta s_j(\omega^i) + \gamma
|
// p_j(\omega^i) + \beta s_j(\omega^i) + \gamma
|
||||||
// where p_j(omega^i) = tmp[i]
|
// where p_j(omega^i) = tmp[i]
|
||||||
for (tmp_advice_value, permuted_advice_value) in tmp_advice_values.iter_mut().zip(permuted_wire_values.iter()) {
|
for (tmp_advice_value, permuted_advice_value) in tmp_advice_values
|
||||||
|
.iter_mut()
|
||||||
|
.zip(permuted_wire_values.iter())
|
||||||
|
{
|
||||||
*tmp_advice_value += &(x_0 * permuted_advice_value);
|
*tmp_advice_value += &(x_0 * permuted_advice_value);
|
||||||
*tmp_advice_value += &x_1;
|
*tmp_advice_value += &x_1;
|
||||||
}
|
}
|
||||||
|
|
@ -326,10 +329,7 @@ impl<C: CurveAffine> Proof<C> {
|
||||||
let mut right = permutation_product_cosets_inv[permutation_index].clone();
|
let mut right = permutation_product_cosets_inv[permutation_index].clone();
|
||||||
let mut current_delta = x_0 * &C::Scalar::ZETA;
|
let mut current_delta = x_0 * &C::Scalar::ZETA;
|
||||||
let step = domain.get_extended_omega();
|
let step = domain.get_extended_omega();
|
||||||
for advice in wires
|
for advice in wires.iter().map(|&wire_index| &advice_cosets[wire_index.0]) {
|
||||||
.iter()
|
|
||||||
.map(|&wire_index| &advice_cosets[wire_index.0])
|
|
||||||
{
|
|
||||||
// TODO: parallelize
|
// TODO: parallelize
|
||||||
let mut beta_term = current_delta;
|
let mut beta_term = current_delta;
|
||||||
for (right, advice) in right.iter_mut().zip(advice.iter()) {
|
for (right, advice) in right.iter_mut().zip(advice.iter()) {
|
||||||
|
|
@ -398,7 +398,7 @@ impl<C: CurveAffine> Proof<C> {
|
||||||
|
|
||||||
let permutation_product_inv_evals: Vec<C::Scalar> = permutation_product_polys
|
let permutation_product_inv_evals: Vec<C::Scalar> = permutation_product_polys
|
||||||
.iter()
|
.iter()
|
||||||
.map(|poly| eval_polynomial(poly, srs.domain.get_omega_inv() * &x_3))
|
.map(|poly| eval_polynomial(poly, domain.rotate_omega(x_3, Rotation(-1))))
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
let permutation_evals: Vec<Vec<C::Scalar>> = srs
|
let permutation_evals: Vec<Vec<C::Scalar>> = srs
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue