-
Notifications
You must be signed in to change notification settings - Fork 158
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
Feat/commitment #266
Conversation
786f9aa
to
3e72010
Compare
} | ||
|
||
// VerifyKnowledgeProof checks if the proof of knowledge is valid | ||
func (k *Key) VerifyKnowledgeProof(commitment bn254.G1Affine, knowledgeProof bn254.G1Affine) error { |
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.
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)
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.
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 👍
ecc/bn254/fr/pedersen/pedersen.go
Outdated
return slice | ||
} | ||
|
||
func (k *Key) Commit(values []*fr.Element) (commitment bn254.G1Affine, knowledgeProof bn254.G1Affine, err error) { |
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.
why are the entries in values pointers ?
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.
Same as the other two 😁
ecc/bn254/fr/pedersen/pedersen.go
Outdated
return bn254.HashToG2(gBytes, []byte("random on g2")) | ||
} | ||
|
||
func Setup(basis []*bn254.G1Affine) (Key, error) { |
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.
Why do you use pointers 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.
It is non-pointer now 👍
ecc/bn254/fr/pedersen/pedersen.go
Outdated
type Key struct { | ||
g bn254.G2Affine // TODO @tabaie: does this really have to be randomized? | ||
gRootSigmaNeg bn254.G2Affine //gRootSigmaNeg = g^{-1/σ} | ||
basis []*bn254.G1Affine |
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.
why is basis a slice of pointers ?
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.
Also fixed by 7ed767f
Efficiently verifiable Pedersen commitments as described in https://eprint.iacr.org/2022/1072.pdf subsection 6.1