-
Notifications
You must be signed in to change notification settings - Fork 20.3k
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
crypto, tests/fuzzers: add gnark bn254 precompile methods for fuzzing #30585
Conversation
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? |
Yep, I'll modify the fuzzer code
Alright, I'll delete the g1_aff code and go with
I'll open up an issue in Gnark to upstream this -- its not in gnark because its catering to a specific usecase that is expensive for every other usecase. |
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, ran the fuzzers a bit on my machine
package bn256 | ||
|
||
import ( | ||
"math/big" | ||
|
||
"github.com/consensys/gnark-crypto/ecc/bn254" |
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.
Me not being a cryptographer, bear with me... This is package bn256
, but it operates on bn254
operands? Why the discrepancy?
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.
This was mainly poor historical naming: bn128/bn256/bn254 all refer to the same thing -- the discrepancy in numbers refer to different properties of the curve.
The 128 referred to the level of security, however it was found out that it did not have this level of security and then it was changed to bn256 or bn254 depending on who you ask
…#30585) Makes the gnark precompile methods more amenable to fuzzing
…ethereum#30585) Makes the gnark precompile methods more amenable to fuzzing
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.