Skip to content

Commit 2d71697

Browse files
committed
[Not Compiling] Recursive step maybe done
1 parent 80bab3f commit 2d71697

File tree

2 files changed

+32
-20
lines changed

2 files changed

+32
-20
lines changed

src/inner_product_argument.rs

Lines changed: 31 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
#![allow(non_snake_case)]
2+
3+
use core::slice::SlicePattern;
24
use std::ops::Mul;
35

4-
use ark_bls12_381::{Fr, G1Affine, G1Projective};
6+
use ark_bls12_381::{Config, Fr, G1Affine, G1Projective};
57
use ark_ec::CurveGroup;
8+
use ark_ec::short_weierstrass::Projective;
69
use ark_ff::{batch_inversion, BigInt, Field, PrimeField};
710
use ark_serialize::{CanonicalDeserialize, CanonicalSerialize, Read, SerializationError, Write};
811
use ark_std::rand::RngCore;
@@ -41,10 +44,8 @@ pub struct WeightedInnerProductProof {
4144
g: G1Projective,
4245
h: G1Projective,
4346

44-
vec_c_L: Vec<G1Projective>,
45-
vec_c_R: Vec<G1Projective>,
46-
vec_d_L: Vec<G1Projective>,
47-
vec_d_R: Vec<G1Projective>,
47+
vec_L: Vec<G1Projective>,
48+
vec_R: Vec<G1Projective>,
4849

4950
c_final: Fr,
5051
d_final: Fr,
@@ -571,29 +572,39 @@ impl WeightedInnerProductProof {
571572
let e2_xL_einv2_xR = e2_xL + einv2_xR;
572573
let alpha_hat = alpha + e2_xL_einv2_xR;
573574

575+
// Now we make G_hat
576+
let e_yinv = e * powers_y_inv[n-1];
577+
let G_hat = (0..n)
578+
.map(|i| {
579+
let GLe_inv = G_L[i] * e_inv;
580+
let GRe_yinv = G_R[i] * e_yinv;
581+
*GRe_yinv + *GLe_inv
582+
})
583+
.collect::<Vec<G1Affine>>();
584+
// G = &mut G_hat[..];
574585

575-
576-
/*for i in 0..n {
577-
c_L[i] += gamma_inv * c_R[i];
578-
d_L[i] += gamma * d_R[i];
579-
G_L[i] = (G_L[i] + G_R[i].mul(gamma)).into_affine();
580-
H_L[i] = (H_L[i] + H_R[i].mul(gamma_inv)).into_affine();
581-
}*/
586+
let H_hat = (0..n)
587+
.map(|i| {
588+
let HLe = H_L[i] * e;
589+
let HRe_inv = H_R[i] * e_inv;
590+
*HLe + *HRe_inv
591+
})
592+
.collect::<Vec<G1Affine>>();
582593

583594
// Save the rescaled vector for splitting in the next loop
584-
slice_c = c_L;
585-
slice_d = d_L;
586-
slice_G = G_L;
587-
slice_H = H_L;
595+
slice_c = &mut c_hat.as_slice();
596+
slice_d = &mut d_hat.as_slice();
597+
slice_G = &mut G_hat.as_slice();
598+
slice_H = &mut H_hat.as_slice();
588599
}
589600

590601
WeightedInnerProductProof {
591602
G: crs_G_vec,
592603
H: crs_H_vec,
593-
vec_c_L: vec_c_L,
594-
vec_c_R: vec_c_R,
595-
vec_d_L: vec_d_L,
596-
vec_d_R: vec_d_R,
604+
g: *crs_G,
605+
h: *crs_H,
606+
vec_L: L,
607+
vec_R: R,
597608
c_final: slice_c[0],
598609
d_final: slice_d[0],
599610
}

src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#![doc = include_str!("../README.md")]
2+
extern crate core;
23

34
pub mod commitments;
45
pub mod crs;

0 commit comments

Comments
 (0)