arkworks-rs / r1cs-std

R1CS constraints for bits, fields, and elliptic curves
https://www.arkworks.rs
Apache License 2.0
133 stars 58 forks source link

Montgomery cannot use TE affine as intermediate representations #103

Closed weikengchen closed 2 years ago

weikengchen commented 2 years ago

Description

In the implementation of incomplete Montgomery, we use TE's GroupAffine for the intermediate representations. It turns out that ark-ec will refuse to do so, because the coordinates in the Montgomery curve are not valid coordinates for the TE curve.

This PR fixes so, using the appropriate MontgomeryAffine.

Recall that this Montgomery is incomplete---and we require this to be used for only CRS that the possibility of hitting those exceptions is negligible. An explicit error is made when trying to create the point of infinity on the Montgomery curve.


Before we can merge this PR, please make sure that all the following items have been checked off. If any of the checklist items are not applicable, please leave them but write a little note why.

N/A: