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

Feat/commitment #266

Merged
merged 5 commits into from
Dec 5, 2022
Merged

Feat/commitment #266

merged 5 commits into from
Dec 5, 2022

Conversation

Tabaie
Copy link
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
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
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
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
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
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
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
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
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.

None yet

3 participants