diff --git a/src/sonic/helped/batch.rs b/src/sonic/helped/batch.rs index 445f7e5..17f9871 100644 --- a/src/sonic/helped/batch.rs +++ b/src/sonic/helped/batch.rs @@ -109,22 +109,30 @@ impl Batch { 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 Batch { } } - +#[derive(Clone, Debug)] pub struct VerifyingKey { pub alpha_x: E::G2Affine, diff --git a/src/sonic/helped/mod.rs b/src/sonic/helped/mod.rs index e555ba0..b330fed 100644 --- a/src/sonic/helped/mod.rs +++ b/src/sonic/helped/mod.rs @@ -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 { - 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 { - 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 } \ No newline at end of file diff --git a/src/sonic/transcript/mod.rs b/src/sonic/transcript/mod.rs index bede612..fc5035f 100644 --- a/src/sonic/transcript/mod.rs +++ b/src/sonic/transcript/mod.rs @@ -58,7 +58,7 @@ impl RollingHashTranscript { } 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 TranscriptProtocol for RollingHashTranscript { fn get_challenge_scalar(&mut self) -> F { use byteorder::ByteOrder; - let mut nonce = 0u32; loop { let mut nonce_bytes = vec![0u8; 4]; @@ -111,6 +110,7 @@ impl TranscriptProtocol for RollingHashTranscript { 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) {