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

feat: added HashToG2 and BLS G2 signature verification circuit for BLS12-381 #1024

Closed
wants to merge 11 commits into from

Conversation

weijiguo
Copy link

@weijiguo weijiguo commented Jan 28, 2024

Description

This PR implemented circuit for HashToG2 and BLS G2 signature verification for the BLS12-381 curve. The implementation is based on affine coordinations.

Along with the said functionalities, it also added G2.addUnified(p, q) function which can handle the case that p == q. And as an optimization, it also adopted a new hint to calculate the sqrtRatio function with the gnark-crypto library to save constraints. Therefore this PR depends on an update to gnark-crypto

Fixes # (issue)
#648

Type of change

  • New feature (non-breaking change which adds functionality)

How has this been tested?

Added unit tests to cover:

  • G2.addUnified for BLS12-381
  • HashToG2 for BLS12-381

How has this been benchmarked?

Added test cases for HashToG2. Results: 2761896 constraints with SCS and 779198 with R1CS for simple message ("abcd").

Checklist:

  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • I did not modify files generated from templates
  • golangci-lint does not output errors locally
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@CLAassistant
Copy link

CLAassistant commented Jan 28, 2024

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
2 out of 3 committers have signed the CLA.

✅ weijiguo
✅ readygo67
❌ keep


keep seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@weijiguo weijiguo changed the title implementation HashToG2 for bls12-381 feat: added HashToG2 circuit for BLS12-381 Jan 28, 2024
@weijiguo weijiguo marked this pull request as draft January 29, 2024 08:55
@weijiguo weijiguo marked this pull request as ready for review January 29, 2024 12:37
@weijiguo weijiguo changed the title feat: added HashToG2 circuit for BLS12-381 feat: added HashToG2 and BLS G2 signature verification circuit for BLS12-381 Jan 29, 2024
@weijiguo
Copy link
Author

weijiguo commented Feb 7, 2024

The source branch has been pushed some unwanted commits. I am closing this one and opening a new PR.

@weijiguo weijiguo closed this Feb 7, 2024
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.

3 participants