Skip to content
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

gkr_nonnative intial review #1162

Open
wants to merge 26 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
removed unused fns
  • Loading branch information
amit0365 committed Jun 12, 2024
commit 2825fdc8b6d94391f9587de77eb2426886ff9472
29 changes: 1 addition & 28 deletions std/recursion/sumcheck/gkr_nonnative.go
Original file line number Diff line number Diff line change
@@ -673,24 +673,6 @@ func (v *GKRVerifier[FR]) bindChallenge(fs *fiatshamir.Transcript, challengeName
return nil
}

// deriveChallenge binds the values for challengeName and then returns the
// challenge using in-circuit Fiat-Shamir transcript. It also returns the rest
// of the challenge names for used in the protocol.
func (v *GKRVerifier[FR]) deriveChallenge(fs *fiatshamir.Transcript, challengeNames []string, values []emulated.Element[FR]) (challenge *emulated.Element[FR], restChallengeNames []string, err error) {
var fr FR
if err = v.bindChallenge(fs, challengeNames[0], values); err != nil {
return nil, nil, fmt.Errorf("bind: %w", err)
}
nativeChallenge, err := fs.ComputeChallenge(challengeNames[0])
if err != nil {
return nil, nil, fmt.Errorf("compute challenge %s: %w", challengeNames[0], err)
}
// TODO: when implementing better way (construct from limbs instead of bits) then change
chBts := bits.ToBinary(v.api, nativeChallenge, bits.WithNbDigits(fr.Modulus().BitLen()))
challenge = v.f.FromBits(chBts...)
return challenge, challengeNames[1:], nil
}

func (v *GKRVerifier[FR]) setup(api frontend.API, c CircuitFr[FR], assignment WireAssignmentFr[FR], transcriptSettings fiatshamir.Settings, options []OptionFr[FR], sumcheck_opts ...VerifyOption[FR]) (settingsFr[FR], error) {
var fr FR
var o settingsFr[FR]
@@ -866,15 +848,6 @@ func getChallenges(transcript *fiatshamir.Transcript, names []string) (challenge
return
}

func getFirstChallengeNamesFr[FR emulated.FieldParams](logNbInstances int, prefix string) []string {
res := make([]string, logNbInstances)
firstChallengePrefix := prefix + "fC."
for i := 0; i < logNbInstances; i++ {
res[i] = firstChallengePrefix + strconv.Itoa(i)
}
return res
}

func (v *GKRVerifier[FR]) getChallengesFr(transcript *fiatshamir.Transcript, names []string) (challenges []emulated.Element[FR], err error) {
challenges = make([]emulated.Element[FR], len(names))
var challenge emulated.Element[FR]
@@ -963,7 +936,7 @@ func (v *GKRVerifier[FR]) Verify(api frontend.API, c CircuitFr[FR], assignment W

claims := newClaimsManagerFr(c, assignment)
var firstChallenge []emulated.Element[FR]
firstChallenge, err = v.getChallengesFr(o.transcript, getFirstChallengeNamesFr[FR](o.nbVars, o.transcriptPrefix))
firstChallenge, err = v.getChallengesFr(o.transcript, getFirstChallengeNames(o.nbVars, o.transcriptPrefix))
if err != nil {
return err
}
Loading