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

Bellman tests failed for Groth16 on BN254 curve #473

Closed
esuwu opened this issue Feb 13, 2023 · 4 comments
Closed

Bellman tests failed for Groth16 on BN254 curve #473

esuwu opened this issue Feb 13, 2023 · 4 comments

Comments

@esuwu
Copy link

esuwu commented Feb 13, 2023

Greetings!
Tests taken from Bellman implementation test_vectors.txt
fail.
Previous issue has been fixed but only for BLS-12381. See here previous PR.

The verification key format is slightly different, however you described how you converted Bellman VK format to gnark VK. I did the same, and Bellman tests are passed for BLS-12381. However for BN254 the tests (test_vectors.txt) fail.

@gbotrel
Copy link
Collaborator

gbotrel commented Feb 14, 2023

hi :) can you:

  1. link the snippets where bellman generates this test vector / the test running on it?
  2. add in this issue the corresponding gnark code you used that failed?

@esuwu
Copy link
Author

esuwu commented Feb 17, 2023

Of course
The test vector are generated from this library that is based on Bellman implementation. The same library that has been used to generate these test vectors.

The code I used from Gnark is in this implementation. I convert Bellman representation of VK to Gnark VK. You can run it and see
You can also see that BLS tests pass, but BN254 tests fail

@esuwu
Copy link
Author

esuwu commented Feb 17, 2023

There is another implementation of groth16 verifier based on Bellman here (not using Gnark). The implementation is not perfect in terms of optimization but the tests for BN254 are passed successfully there

@gbotrel
Copy link
Collaborator

gbotrel commented Feb 17, 2023

The error is: "invalid point: subgroup check failed" when unmarshaling the input points.

Very likely, the way compressed points are encoded differs. In the gowaves code you have:

https://github.com/wavesplatform/gowaves/blob/3c8690431fe83406249c78c3cbeb17dc132ce460/pkg/crypto/internal/groth16/bn256/utils/bn254/g1.go#L95

versus:

https://github.com/ConsenSys/gnark-crypto/blob/8f7ca09273c24ed9465043566906cbecf5dcee91/ecc/bn254/marshal.go#L39

@esuwu esuwu closed this as not planned Won't fix, can't repro, duplicate, stale Mar 30, 2023
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

2 participants