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

Integrate Zexe backend and new curves #596

Closed
2 tasks done
Schaeff opened this issue May 11, 2020 · 8 comments
Closed
2 tasks done

Integrate Zexe backend and new curves #596

Schaeff opened this issue May 11, 2020 · 8 comments

Comments

@Schaeff
Copy link
Member

Schaeff commented May 11, 2020

Prerequisites:

  • curve-generic zokrates
  • curve pragma statements

Let's sync on this issue!

Ping @iAmMichaelConnor @dark64

@iAmMichaelConnor
Copy link

@Westlad @ChaitanyaKonda

@dark64
Copy link
Member

dark64 commented May 18, 2020

There is a PR currently in progress that will ease the integration of zexe backend #598. Would love to hear from you about the state of your work on this issue so we don't change something you might rely on atm. @Westlad @ChaitanyaKonda

@ChaitanyaKonda
Copy link

@dark64 These changes in #598 look good to me. I'm adding BLS12_377 and BW6_761 curves by using a zexe backend. These two curves will use Zexe backend for GM17 scheme. I will pull your changes and keep it consistent for these curves too

@Westlad
Copy link

Westlad commented May 19, 2020

@dark64 This looks great and doesn't cause us any problems. We're a quite an early stage and we've only been trying to understand the ZoKrates code and wondering about the best way to add Zexe-derived curves to ZoKrates.

@ChaitanyaKonda
Copy link

ChaitanyaKonda commented May 20, 2020

@dark64 Your changes seem to make the backend generic. That's very useful. I was working on similar changes by renaming the bn128 file into curve. This seems like an even cleaner way to do it.

There might be some additional changes required in the contract template in line with these changes, such as

  • editing uint256 snark_scalar_field = 21888242871839275222246405745257275088548364400416034343698204186575808495617; inside verify function in CONTRACT_TEMPLATE. Currently this points to BN128 modulus. This will need to change with curve.
  • Also the templates SOLIDITY_G2_ADDITION_LIB, SOLIDITY_PAIRING_LIB, SOLIDITY_PAIRING_LIB_V2 might change for a curve whose modulus is more than 256 bit. BW6_761 is one of them. These could be defined under different variable names such as SOLIDITY_G2__761_ADDITION_LIB etc in solidity.rs and called with a match statement based on curve inside gm17.rs

Please let me know what you think?

@Schaeff
Copy link
Member Author

Schaeff commented May 20, 2020

Thanks for this @ChaitanyaKonda! For now only the BN128 curve is available on Ethereum so I feel it makes sense to treat export-verifier separately and not make the Solidity contract generic.

@ChaitanyaKonda
Copy link

ChaitanyaKonda commented May 20, 2020

@Schaeff Very true! Helps to understand the thinking behind this. export-verifier could be generalised at a later stage. Good thing that ZoKrates now has verify cli command.

@Schaeff
Copy link
Member Author

Schaeff commented May 25, 2020

Yes, typically the dimension we would add is something like verification environments, each of which supports a set of curves. But, you're right, this can wait.

@Schaeff Schaeff closed this as completed May 3, 2021
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

No branches or pull requests

5 participants