feat: add Pectra BLS12-381 elliptic curve precompiles#1447
Conversation
Addressed all the points except the |
Yup - I think we could try to keep it simple for now. The only thing I'm worried about when having duplicate implementations (in sw_emulated and sw_bls12381) is that it may cause confusion when auditing or debugging bugs. I'll have another look, maybe I can come up with some idea while @ThomasPiellard is addressing the missing test comment. |
There was a problem hiding this comment.
Good from my side now. But before merging we need to wait for Consensys/gnark-crypto#674 to be merged to gnark-crypto master and then we need to update the dependency in this PR. Otherwise we may have non-linear dependencies and depend on go package cache in case the gnark-crypto PR is deleted.
I'll try moving AssertIsOnCurve and AssertIsOnG1 to interfaces and de-duplicate in separate PR.
Co-authored-by: Thomas Piellard <thomas.piellard@consensys.net> Co-authored-by: Ivo Kubjas <ivo.kubjas@consensys.net> Co-authored-by: Arya Tabaie <arya.pourtabatabaie@gmail.com>
Description
This PR adds gnark circuits corresponding to precompiles for BLS12-381 curve operations https://eips.ethereum.org/EIPS/eip-2537.
TODO:
ScalarMul()with GLVType of change
How has this been tested?
Tests are implemented in
std/evmprecompiles/bls_test.go.How has this been benchmarked?
PLONK (on BLS12-377) number of constraints (scs):
Scalar Multiplication
Scalar Multiplication
Checklist:
golangci-lintdoes not output errors locally