-
Notifications
You must be signed in to change notification settings - Fork 64
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
Feature/sumcheck #40
Feature/sumcheck #40
Conversation
hypernova working with poseidon based transcript here |
Is this ready for review @dmpierre ? |
Yes thanks! Forgot to assign, so just added Arnau as well |
Added a raw sum-check implementation in the meantime, might help to get rid of |
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.
Great! Thanks for this!! I've reviewed all except for sum_check_unstable.rs
, left some proposals.
@arnaucube pinged me about code duplication. So I'll save time and review once the changes have been addressed! Could you ping once done @dmpierre ?? |
I think we are getting closer! We eventually go for implementing a more generic trait over Keeping our own sum-check implementation for later since it will require additional work on top of it if we want to use it - things like removing the dependency to |
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.
Nice work @dmpierre ! ^^
Just left a question about some absorbs in the transcript that I'm not sure about.
.unwrap(); | ||
let gamma_scalar = C::ScalarField::from_le_bytes_mod_order(b"gamma"); | ||
transcript.absorb(&gamma_scalar); | ||
let gamma: C::ScalarField = transcript.get_challenge(); |
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.
I'm not an expert on transcripts, so not sure about this, but if these strings are not essential maybe we could skip them so in-circuit don't add extra constraints?
The reasoning would be that we are already absorbing the value of the computed challenge, and we're interested into absorbing the values computed through the protocol to prevent the prover from 'choosing' the 'random challenges' obtainted, but some hardcoded strings would not affect that, and furthermore, later when we reproduce the transcript in-circuit, absorbing strings would add extra constraints (although a small amount).
Maybe the 'absorbing the string' tradition comes from Merlin (https://merlin.cool , used by the transcript from the Espresso impl), which allows to use strings as kind of separators when absorbing values into the transcript.
I've skimmed through the Merlin docs but didn't find a reason for absorbing the strings, but again, I'm not sure about this, so posting this as a question for others here. (tagging @CPerezz and @han0110 who might have more insight here)
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.
I think it's like a domain separator for the underlying hash function, zcash/halo2
does the same thing, so I guess it'd be a good practice.
But I also don't understand the theoretical part, and not sure where convention this comes from.
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.
Nice work!
Some suggestions left.
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!
Thanks for this work!
edited before merging
We want
folding_schemes
to have a sum-check implementation generic over hash functions.To achieve this, we re-use
hyperplonk
's sumcheck implementation. To be able to make it generic over any hash, we tweak it to be generic over our ownTranscript
trait (not the one found inhyperplonk
).This PR:
SumCheck
,SumCheckProver
andSumCheckVerifier
traits to be generic over aCurveGroup
, withprove
andverify
methods generic overfolding_schemes::Transcript
.IOPProverState
andIOPVerifier
states to be generic over aCurveGroup
.Also, we change
hyperplonk
calls to its transcript object when re-implementing theprove
andverify
method cited above:transcript.append_serializable_element
becomestranscript.absorb
(example) ortranscript.absorb_vec
when needed (example).transcript.get_and_append_challenge
becomestranscript.get_challenge
(example)The main disadvantage from taking this route is codebase inflation. However, we gain the short-term ability to have a somewhat robust and generic sum-check implementation. Still, although practical, it seems like a temporary implementation which might be re-evaluated in the future (e.g. implementing our own sum-check from scratch,
hyperplonk
's implementation might have possible low-hanging optimizations).