-
Notifications
You must be signed in to change notification settings - Fork 20k
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
chore: Add Gnark Bn254 precompile methods for fuzzing #30585
base: master
Are you sure you want to change the base?
Conversation
// This is just the addition formula | ||
// but given we know that we do not need Jacobian | ||
// coordinates, we use the naive implementation. | ||
// | ||
// Ideally, we push this into gnark |
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.
As mentioned, I can remove this file and or upstream to gnark first -- added it as I noticed that most cryptography libraries are not well suited to the usecase where we do an operation on a point and then serialize straight after, most libraries asssume that you are going to make further computations on the result
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 did some rough benchmarks and it looked like this smooths out the variance between the worse cases
running
|
running BenchmarkPrecompiledBn256Add after change with Option 3:
|
running BenchmarkPrecompiledBn256Add after change with Option 2:
|
running BenchmarkPrecompiledBn256Add after change with Option 1:
|
running BenchmarkPrecompiledBn256ScalarMul before this change:
after this change:
|
running BenchmarkPrecompiledBn256Pairing before this change:
after this change:
Note: |
Could you also add it to the fuzzer already? |
This adds the gnark precompile methods so that they can be used as fuzzing and perhaps in the future replace the google variant; I noticed that the google variant looked quite similar to the cloudflare one.