-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Change BLS Pairing Engine #3670
Conversation
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 revert everything under shared/bls/spectest. Why remove those sources? Why move the generated yaml files into the tests? We may need to regenerate those in the future if the inputs change.
Codecov Report
@@ Coverage Diff @@
## master #3670 +/- ##
===========================================
- Coverage 53.04% 35.92% -17.12%
===========================================
Files 172 5 -167
Lines 11197 309 -10888
===========================================
- Hits 5939 111 -5828
+ Misses 4407 187 -4220
+ Partials 851 11 -840 |
shared/bls/bls.go
Outdated
} | ||
|
||
// PublicKeyFromBytes creates a BLS public key from a LittleEndian byte slice. | ||
func PublicKeyFromBytes(pub []byte) (*PublicKey, error) { | ||
if featureconfig.FeatureConfig().SkipBLSVerify { | ||
return &PublicKey{}, nil | ||
} | ||
cv := pubkeyCache.Get(string(pub)) |
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 remove this? This method was called in high frequency with infrequently changing parameters. Aligning the bytes to the curve was expensive.
shared/bls/bls.go
Outdated
} | ||
|
||
// Copy the public key to a new pointer reference. | ||
// Copy copies the public key and returns it. |
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.
Can you revert this comment?
// Copy copies the public key and returns it. | |
// Copy the public key to a new pointer reference. |
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.
LGTM.
Such an incredible performance improvement. This will break ARM builds, but we can tackle that later. Thanks for your contribution!
This PR changes current BLS pairing engine to the new engine and speeds up signature verification process by 3x.
While BLS signature and keys API remains as is, only underlying math library is changed.
For now, ‘try and increment’ method for hash to G2 is considered. Standart hash method will be added soon after BLS standardization is finalized.
x86 assembly code is generated using github.com/kilic/fp libary
This new pairing engine library processes single pairing in ~2.4ms. Such performance is comparable to rust implementation.