-
Notifications
You must be signed in to change notification settings - Fork 34
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
Initial Shplonk prover/verifier implementation #301
Changes from 7 commits
7080006
a82c4bf
7c4079f
1dd320b
936d19b
f05d82a
64b18f0
ac21d62
bc57e05
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,18 +61,20 @@ where | |
E::Fr: TranscriptReprTrait<E::G1>, | ||
E::G1Affine: TranscriptReprTrait<E::G1>, // TODO: this bound on DlogGroup is really unusable! | ||
{ | ||
fn compute_challenge( | ||
/// TODO: write doc | ||
pub fn compute_challenge( | ||
com: &[E::G1Affine], | ||
transcript: &mut impl TranscriptEngineTrait<NE>, | ||
) -> E::Fr { | ||
transcript.absorb(b"c", &com.to_vec().as_slice()); | ||
transcript.squeeze(b"c").unwrap() | ||
} | ||
|
||
/// TODO: write doc | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I like the existing comment already :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, so I do not focus on this only because we are going to merge Shplonk with HyperKZG eventually. The followup PR or "final" commit that you mentioned will for sure include these TODO resolvings |
||
// Compute challenge q = Hash(vk, C0, ..., C_{k-1}, u0, ...., u_{t-1}, | ||
// (f_i(u_j))_{i=0..k-1,j=0..t-1}) | ||
// It is assumed that both 'C' and 'u' are already absorbed by the transcript | ||
fn get_batch_challenge( | ||
pub fn get_batch_challenge( | ||
v: &[Vec<E::Fr>], | ||
transcript: &mut impl TranscriptEngineTrait<NE>, | ||
) -> E::Fr { | ||
|
@@ -88,14 +90,16 @@ where | |
transcript.squeeze(b"r").unwrap() | ||
} | ||
|
||
fn batch_challenge_powers(q: E::Fr, k: usize) -> Vec<E::Fr> { | ||
/// TODO: write doc | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The inner comment should perhaps just be moved as a doc comment of this function. See also |
||
pub fn batch_challenge_powers(q: E::Fr, k: usize) -> Vec<E::Fr> { | ||
// Compute powers of q : (1, q, q^2, ..., q^(k-1)) | ||
std::iter::successors(Some(E::Fr::ONE), |&x| Some(x * q)) | ||
.take(k) | ||
.collect() | ||
} | ||
|
||
fn verifier_second_challenge( | ||
/// TODO: write doc | ||
pub fn verifier_second_challenge( | ||
W: &[E::G1Affine], | ||
transcript: &mut impl TranscriptEngineTrait<NE>, | ||
) -> E::Fr { | ||
|
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 remove
to_vec().as_slice()
, the transcript already takes slices.