Skip to content

Commit

Permalink
perf: parallelize v2 construction within eval_vmv_re_prove (#127)
Browse files Browse the repository at this point in the history
# Rationale for this change

This reduces the `eval_vmv_re_prove` component of the proof time from
one of the larger factors to a negligible amount.

# What changes are included in this PR?

The computation of v2 within `eval_vmv_re_prove` now uses a rayon
iterator.

# Are these changes tested?

Yes
  • Loading branch information
JayWhite2357 authored Sep 5, 2024
1 parent d4d239c commit 1c01ad5
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions crates/proof-of-sql/src/proof_primitive/dory/eval_vmv_re.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use super::{
};
use ark_ec::VariableBaseMSM;
use merlin::Transcript;
use rayon::iter::{IntoParallelRefIterator, ParallelIterator};

/// This is the prover side of the Eval-VMV-RE algorithm in section 5 of https://eprint.iacr.org/2020/1274.pdf.
///
Expand Down Expand Up @@ -32,10 +33,11 @@ pub fn eval_vmv_re_prove(
messages.prover_send_GT_message(transcript, C);
messages.prover_send_GT_message(transcript, D_2);
messages.prover_send_G1_message(transcript, E_1);
let Gamma_2_fin = setup.Gamma_2_fin;
let v2 = state
.v_vec
.iter()
.map(|c| (setup.Gamma_2_fin * c).into())
.par_iter()
.map(|c| (Gamma_2_fin * c).into())
.collect::<Vec<_>>();
ExtendedProverState::from_vmv_prover_state(state, v2)
}
Expand Down

0 comments on commit 1c01ad5

Please sign in to comment.