Skip to content

Conversation

@Tabaie
Copy link
Contributor

@Tabaie Tabaie commented May 24, 2023

Equivalent of #668 for Groth16.

res := make([]uint64, len(commitments))
for i := range res {
res[i] = uint64(commitments[i].CommitmentIndex)
func (c Commitments) CommitmentWireIndexes() []int {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe evaluate if instead of computing all the index (wires, commited etc) during proving time, it would not be worth it to store these slices in the CommitmentInfo data struct? Particularly to avoid allocations in the prover.


if vk.HasCommitment {
kSum.AddMixed(&proof.Commitment)
for i := range proof.Commitments {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same, my understanding is we probably won't go over comuple of commitments, but if we do, this place might be a good candidate for a batchAddition

import "math/big"

// DivideByThresholdOrList divides x into two sub-lists. list must be sorted, non-repeating and contain no value less than indexThreshold
func DivideByThresholdOrList(indexThreshold int, list []int, x []*big.Int) (ltOrInList, gtAndNotInList []*big.Int) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do that in place?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replaced, but it still allocates a slice of size len(list), which in this application is small.

if t.VID < builder.cs.GetNbPublicVariables() {
nbPublicCommitted++
} else {
// Cannot commit to a secret variable that has already been committed to
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

out of curiosity; why can't we just continue here and ignore that? Will comitting to a commitment help in anyway?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because of how the result of an api.Commit must be usable as a fiat-shamir challenge, it must have a "one-way" dependence on every variable input to this function. However, the way the commitment scheme is verified is Groth16 necessitates that every private variable can be used in one commitment at most. So if it were needed in multiple commitments, the next best thing is to commit to its commitment (commitments to commitments are easy, they're just conventional hashes.)

@@ -0,0 +1,18 @@
package utils

// BinarySearch attempts to find the target in x. If not found, returns false and the index where the target would be inserted.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not use go standard std Find method?

})
}

func hollow(c frontend.Circuit) frontend.Circuit {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you document a bit more this file / the functions?

@Tabaie Tabaie requested a review from gbotrel June 9, 2023 14:50
commitmentWires := commitmentInfo.CommitmentIndexes()
privateCommitted := commitmentInfo.GetPrivateCommitted()
nbPrivateCommittedWires := internal.NbElements(privateCommitted)
//nbPrivateCommittedWires, privateCommitted, publicAndCommitmentCommitted :=
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

deadcode

@Tabaie Tabaie merged commit aa46799 into develop Jun 9, 2023
@Tabaie Tabaie deleted the feat/g16-multicommits branch June 9, 2023 15:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants