Skip to content
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

Implement EIP-2537 using gnark-crypto #168

Merged
merged 35 commits into from
Jun 25, 2024

Conversation

garyschulte
Copy link
Contributor

@garyschulte garyschulte commented May 11, 2024

Implement eip-2537 using gnark-crypto.

related to #165
related to #91

  • implements EIP-2537 using gnark-crypto, including as-spec'd subgroup checks and is-on-curve checks.
  • implements EIP-196 using gnark-crypto, adds test cases
  • adds test cases for EIP-196 to matter-labs implementation
  • shims gnark-crypto implementation to be a drop-in replacement for matter-labs

Motivation

The primary motivation is to get besu onto a supported library for the ECC precompiles since the matter-labs eip-1962 repo appears to be unmaintained. There is additional benefit in that gnark-crypto performs better than matter labs on every precompile benchmark.

Testing on both x86_64 and ARM64 indicate this implementation compares very favorably with the matter-labs eip-1962 implementation for all operations.

Screenshot 2024-06-11 at 1 59 16 PM Screenshot 2024-06-06 at 4 55 57 PM Screenshot 2024-06-06 at 4 56 07 PM Screenshot 2024-06-11 at 1 58 20 PM Screenshot 2024-06-06 at 4 56 21 PM Screenshot 2024-06-06 at 4 56 30 PM Screenshot 2024-06-06 at 4 56 41 PM Screenshot 2024-06-06 at 4 56 49 PM Screenshot 2024-06-06 at 4 56 57 PM Screenshot 2024-06-07 at 8 04 37 AM Screenshot 2024-06-07 at 8 04 30 AM Screenshot 2024-06-07 at 8 04 46 AM

@garyschulte garyschulte marked this pull request as ready for review June 6, 2024 20:28
build.gradle Outdated Show resolved Hide resolved
Copy link
Contributor Author

@garyschulte garyschulte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix a few minor things

@garyschulte garyschulte changed the title Implement EIP-2537 in gnark Implement EIP-2537 using gnark-crypto Jun 7, 2024
Copy link
Contributor

@shemnon shemnon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If gnark is the library of choice, should we make a plan to remove matterlabs from this repo?

build.gradle Outdated Show resolved Hide resolved
@garyschulte
Copy link
Contributor Author

If gnark is the library of choice, should we make a plan to remove matterlabs from this repo?

Once we have a besu release with gnark-crypto, we can remove matter labs and the original altbn128 implementation 👍

garyschulte added a commit that referenced this pull request Jun 24, 2024
garyschulte added a commit that referenced this pull request Jun 25, 2024
ryjones pushed a commit that referenced this pull request Jun 25, 2024
Signed-off-by: garyschulte <[email protected]>
Signed-off-by: garyschulte <[email protected]>
Still todo:pairing and fpToG1 fpToG2

Signed-off-by: garyschulte <[email protected]>
Signed-off-by: garyschulte <[email protected]>
clean up blst implementation, remove timings and test loops

Signed-off-by: garyschulte <[email protected]>
Signed-off-by: garyschulte <[email protected]>
…-labs

add gnark eip-196 implementation and tests
add tests to matter-labs eip-196 for comparison
TODO: gnark eip-197 pairing currently failing

Signed-off-by: garyschulte <[email protected]>
use gnark native Unmarshal for all eip196
cleanup for PR review

Signed-off-by: garyschulte <[email protected]>
Signed-off-by: garyschulte <[email protected]>
…ead of repurposing output array

Signed-off-by: garyschulte <[email protected]>
…ts, clean up 2537 implementation

Signed-off-by: garyschulte <[email protected]>
…ark-crypto PR 510 until gnark-crypto is released

Signed-off-by: garyschulte <[email protected]>
@garyschulte garyschulte merged commit fd81455 into hyperledger:main Jun 25, 2024
11 checks passed
@garyschulte garyschulte deleted the feature/gnark-bls12-381 branch June 25, 2024 18:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants