Skip to content

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

Open
@nulltea

Description

@nulltea

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions