Skip to content

Feat/commitment#266

Merged
gbotrel merged 5 commits intodevelopfrom
feat/commitment
Dec 5, 2022
Merged

Feat/commitment#266
gbotrel merged 5 commits intodevelopfrom
feat/commitment

Conversation

@Tabaie
Copy link
Copy Markdown
Contributor

@Tabaie Tabaie commented Nov 17, 2022

Efficiently verifiable Pedersen commitments as described in https://eprint.iacr.org/2022/1072.pdf subsection 6.1

@Tabaie Tabaie marked this pull request as ready for review November 17, 2022 18:37
}

// VerifyKnowledgeProof checks if the proof of knowledge is valid
func (k *Key) VerifyKnowledgeProof(commitment bn254.G1Affine, knowledgeProof bn254.G1Affine) error {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You could ask @gbotrel for that but I think it's better not to use a pointer receiver when it can be avoided (in general not use pointers when it's not necessary)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

oh no, pointer receiver is fine --> having pointer receiver does not impact where your object is allocated.
sometime passing pointers versus values can force the compiler escape analysis to allocate an object on the heap, but here, in this context, I don't think that's an issue 👍

return slice
}

func (k *Key) Commit(values []*fr.Element) (commitment bn254.G1Affine, knowledgeProof bn254.G1Affine, err error) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

why are the entries in values pointers ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Same as the other two 😁

return bn254.HashToG2(gBytes, []byte("random on g2"))
}

func Setup(basis []*bn254.G1Affine) (Key, error) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why do you use pointers here ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It is non-pointer now 👍

type Key struct {
g bn254.G2Affine // TODO @tabaie: does this really have to be randomized?
gRootSigmaNeg bn254.G2Affine //gRootSigmaNeg = g^{-1/σ}
basis []*bn254.G1Affine
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

why is basis a slice of pointers ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Also fixed by 7ed767f

@gbotrel gbotrel merged commit 6b860ba into develop Dec 5, 2022
@gbotrel gbotrel deleted the feat/commitment branch December 5, 2022 15:55
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