done junction with ETH

This commit is contained in:
Alex Vlasov 2019-02-06 01:20:41 +03:00
parent 746eb56e0f
commit a3f910cb52
3 changed files with 26 additions and 18 deletions

@ -109,22 +109,30 @@ impl<E: Engine> Batch<E> {
let alpha_x = multiexp(
self.alpha_x.iter().map(|x| &x.0),
self.alpha_x.iter().map(|x| &x.1),
).into_affine().prepare();
).into_affine();
let alpha_x = alpha_x.prepare();
let alpha = multiexp(
self.alpha.iter().map(|x| &x.0),
self.alpha.iter().map(|x| &x.1),
).into_affine().prepare();
).into_affine();
let alpha = alpha.prepare();
let neg_h = multiexp(
self.neg_h.iter().map(|x| &x.0),
self.neg_h.iter().map(|x| &x.1),
).into_affine().prepare();
).into_affine();
let neg_h = neg_h.prepare();
let neg_x_n_minus_d = multiexp(
self.neg_x_n_minus_d.iter().map(|x| &x.0),
self.neg_x_n_minus_d.iter().map(|x| &x.1),
).into_affine().prepare();
).into_affine();
let neg_x_n_minus_d = neg_x_n_minus_d.prepare();
E::final_exponentiation(&E::miller_loop(&[
(&alpha_x, &self.alpha_x_precomp),
@ -135,7 +143,7 @@ impl<E: Engine> Batch<E> {
}
}
#[derive(Clone, Debug)]
pub struct VerifyingKey<E: Engine> {
pub alpha_x: E::G2Affine,

@ -16,19 +16,19 @@ pub use self::helper::{Aggregate, create_aggregate};
pub use self::verifier::{MultiVerifier};
pub use self::prover::{create_proof, create_advice};
#[derive(Clone)]
#[derive(Clone, Debug)]
pub struct SxyAdvice<E: Engine> {
s: E::G1Affine,
opening: E::G1Affine,
szy: E::Fr,
pub s: E::G1Affine,
pub opening: E::G1Affine,
pub szy: E::Fr,
}
#[derive(Clone)]
#[derive(Clone, Debug)]
pub struct Proof<E: Engine> {
r: E::G1Affine,
t: E::G1Affine,
rz: E::Fr,
rzy: E::Fr,
z_opening: E::G1Affine,
zy_opening: E::G1Affine
pub r: E::G1Affine,
pub t: E::G1Affine,
pub rz: E::Fr,
pub rzy: E::Fr,
pub z_opening: E::G1Affine,
pub zy_opening: E::G1Affine
}

@ -58,7 +58,7 @@ impl<H: Hasher> RollingHashTranscript<H> {
}
pub fn commit_bytes(&mut self, personalization: &[u8], bytes: &[u8]) {
let mut h = H::new(personalization);
let mut h = H::new(&[]);
h.update(&self.buffer);
h.update(personalization);
h.update(bytes);
@ -101,7 +101,6 @@ impl<H:Hasher> TranscriptProtocol for RollingHashTranscript<H> {
fn get_challenge_scalar<F: PrimeField>(&mut self) -> F {
use byteorder::ByteOrder;
let mut nonce = 0u32;
loop {
let mut nonce_bytes = vec![0u8; 4];
@ -111,6 +110,7 @@ impl<H:Hasher> TranscriptProtocol for RollingHashTranscript<H> {
repr.read_be(&challenge_bytes[..]).unwrap();
if let Ok(result) = F::from_repr(repr) {
// println!("Got a challenge {} for nonce = {}", result, nonce);
return result;
}
if nonce == (0xffffffff as u32) {