From bb6bf73d758aa531fa9db77a8128aa34368f6cc7 Mon Sep 17 00:00:00 2001 From: Ben Savage Date: Sun, 17 Mar 2024 01:44:39 +1000 Subject: [PATCH] using the same variable and constant names as the paper --- .../ipa_prf/malicious_security/prover.rs | 29 +++++++++++-------- 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/ipa-core/src/protocol/ipa_prf/malicious_security/prover.rs b/ipa-core/src/protocol/ipa_prf/malicious_security/prover.rs index 699c79f96..405a8ce83 100644 --- a/ipa-core/src/protocol/ipa_prf/malicious_security/prover.rs +++ b/ipa-core/src/protocol/ipa_prf/malicious_security/prover.rs @@ -18,26 +18,31 @@ pub struct ProofGenerator { v: Vec, } +/// +/// Distributed Zero Knowledge Proofs algorithm drawn from +/// `https://eprint.iacr.org/2023/909.pdf` +/// impl ProofGenerator where F: PrimeField, { - pub fn compute_proof(self) -> GenericArray, U1>> + #![allow(non_camel_case_types)] + pub fn compute_proof<λ: ArrayLength>(self) -> GenericArray, U1>> where - N: ArrayLength + Add + Sub, - ::Output: Sub, - <::Output as Sub>::Output: ArrayLength, - >::Output: ArrayLength, + λ: ArrayLength + Add + Sub, + <λ as Add>::Output: Sub, + <<λ as Add>::Output as Sub>::Output: ArrayLength, + <λ as Sub>::Output: ArrayLength, { - assert!(self.u.len() % N::USIZE == 0); // We should pad with zeroes eventually + assert!(self.u.len() % λ::USIZE == 0); // We should pad with zeroes eventually - let strip_len = self.u.len() / N::USIZE; + let s = self.u.len() / λ::USIZE; - let denominator = CanonicalLagrangeDenominator::::new(); - let lagrange_table = LagrangeTable::>::Output>::from(denominator); - let extrapolated_points = (0..strip_len).map(|i| { - let p: GenericArray = (0..N::USIZE).map(|j| self.u[i * N::USIZE + j]).collect(); - let q: GenericArray = (0..N::USIZE).map(|j| self.v[i * N::USIZE + j]).collect(); + let denominator = CanonicalLagrangeDenominator::::new(); + let lagrange_table = LagrangeTable::>::Output>::from(denominator); + let extrapolated_points = (0..s).map(|i| { + let p: GenericArray = (0..λ::USIZE).map(|j| self.u[i * λ::USIZE + j]).collect(); + let q: GenericArray = (0..λ::USIZE).map(|j| self.v[i * λ::USIZE + j]).collect(); let p_extrapolated = lagrange_table.eval(&p); let q_extrapolated = lagrange_table.eval(&q); zip(