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

Short Weierstrass G1Var::new_input behaves differently from G1::to_field_elements #106

Open
nulltea opened this issue Oct 13, 2022 · 0 comments

Comments

@nulltea
Copy link

nulltea commented Oct 13, 2022

Summary of Bug

There's a discrepancy between input variable allocation and constraint field conversion for the Short Weierstrass curve group, specifically, how the infinity marker's value field is used.

For the curve group, it's either zero or one depending on the value of the infinity marker. Please see the following trace:

  1. https://github.com/arkworks-rs/algebra/blob/master/ec/src/models/short_weierstrass/group.rs#L624
  2. https://github.com/arkworks-rs/algebra/blob/master/ec/src/models/short_weierstrass/affine.rs#L390
  3. https://github.com/arkworks-rs/algebra/blob/master/ff/src/to_field_vec.rs#L14

However, in the r1cs variant it's always F::one, see: https://github.com/arkworks-rs/r1cs-std/blob/master/src/groups/curves/short_weierstrass/mod.rs#L219

For the algebra repo, the behavior seems correct. I see that for r1cs there is conversion after allocation here, but since the FpVar was already allocated as FpVar::one, I get a conflict during proof verification.

Version

Reproduces in v0.3.0 and the latest master.

Steps to Reproduce

  1. Allocate short_weierstrass::G1Var with non-infinity value
  2. Generate proof
  3. Get public input
  4. Verify proof
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

1 participant