-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improving Shplonk implementation #326
Conversation
d92eaba
to
7b7f469
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some (duplicated) comments to give pointers about optimizations. If you prefer to tackle them as another PR feel free to mark them as resolved and I'll approve this one. Otherwise, happy to give this another look later.
src/provider/shplonk.rs
Outdated
} | ||
|
||
let C_P: E::G1 = pi.comms.iter().map(|comm| comm.to_curve()).rlc(&q); | ||
// TODO: revisit C_P computing later with progress in https://github.com/huitseeker/arecibo/tree/rayon-parscan | ||
let q_powers = HyperKZG::<E, NE>::batch_challenge_powers(q, comms.len()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can make spartan::powers
pub (in crate)
:
let q_powers = HyperKZG::<E, NE>::batch_challenge_powers(q, comms.len()); | |
let q_powers = crate::spartan::powers(q, comms.len()); |
src/provider/shplonk.rs
Outdated
#[allow(clippy::redundant_closure)] | ||
let C_P: E::G1 = comms | ||
.par_iter() | ||
.zip_eq(q_powers.par_iter()) | ||
.fold(|| E::G1::identity(), |acc, (comm, q_i)| acc + *comm * q_i) | ||
.sum::<E::G1>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#[allow(clippy::redundant_closure)] | |
let C_P: E::G1 = comms | |
.par_iter() | |
.zip_eq(q_powers.par_iter()) | |
.fold(|| E::G1::identity(), |acc, (comm, q_i)| acc + *comm * q_i) | |
.sum::<E::G1>(); | |
let C_P: E::G1 = comms | |
.par_iter() | |
.zip_eq(q_powers.par_iter()) | |
.fold(E::G1::identity, |acc, (comm, q_i)| acc + *comm * q_i) | |
.sum::<E::G1>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems to be irrelevant after rebasing to latest dev which includes #330
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Feel free to apply the suggestions by @huitseeker (will re-approve if necessary)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
* avoid explicit compression/decompression * update version
Fixes #303
This PR introduces 2 improvements:
Next PR should include careful merging Shplonk and HyperKZG implementations leaving hyperkzg.rs source file and removing shplonk.rs (fixing #302). I expect some more improving of prover performance with this merge.
Concrete results of benchmarking at this stage (Shplonk vs current HyperKZG) are following (similar to #301 (comment) - comparable verifier and improved prover):
P.S. @huitseeker, I saw your WIP branch related to parallel rlc. Please, notify me when you land that, so I can simplify
C_P
computing by utilising you work