-
Notifications
You must be signed in to change notification settings - Fork 155
[FEAT] Curve Pairings #829
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
Conversation
} | ||
|
||
template <typename Config> | ||
typename Config::Fp6 add_in_place(typename Config::Fp6& r, const typename Config::G2Affine& q) |
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.
add documentation
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's basically just reciting the algorithms from the paper
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.
i understood it, link to the paper and relevant sections
@@ -0,0 +1,25 @@ | |||
#pragma once |
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 not put it in curve_config?
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.
The idea was to not compile anything related to pairings in other compilation units. But I might be mistaken, won't static functions defined inside pairing_config be recompiled locally for every object file?
* - The map preserves the bilinear property: e(aP, bQ) = e(P,Q)^(ab) | ||
*/ | ||
template <typename A, typename A2, typename PairingConfig, typename TargetField = typename PairingConfig::TargetField> | ||
eIcicleError pairing(const A& p, const A2& q, TargetField* output); |
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.
(1) Why output is not a reference too? I mean why inputs are reference but output is pointer?
(2) batch not relevant 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.
1 - At first they were all references, because I was thinking adding batch and making it a cpu backend function. But yeah, now it should be a reference.
2 - Actually, I don't know which is better, to have one function for both single pairing and multi-pairing or have two separate functions.
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.
IMO 1 func with batch support
|
||
namespace { | ||
template <typename Config> | ||
typename Config::Fp6 double_in_place(typename Config::Fp6& r, const typename Config::Fp& two_inv) |
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 need 'typename Config' everywhere rather than just 'Config'? I noticed it in other places too
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 doesn't compile without it
*/ | ||
template <typename PairingConfig> | ||
eIcicleError pairing( | ||
const typename PairingConfig::G1Affine& p, |
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.
Here too I suggest removing the 'typename' from the params
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.
error: missing 'typename' prior to dependent type name 'PairingConfig::G1Affine'
const PairingConfig::G1Affine& p,
icicle/tests/test_polynomial_api.cpp
Outdated
@@ -1060,7 +1087,9 @@ TEST_F(PolynomialTest, Groth16) | |||
|
|||
groth16_example.setup(); | |||
auto proof = groth16_example.prove(witness); | |||
// groth16_example.verify(proof); // cannot implement without pairing | |||
#ifdef PAIRING | |||
groth16_example.verify(proof, witness); |
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.
Please assert true 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.
Great work!
I left a few small comments
No description provided.