arkworks-rs / r1cs-std

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

why there is no constraints in some Fp operation? #125

Closed readygo67 closed 1 year ago

readygo67 commented 1 year ago

in fields/fp/mod.rs, some operations has no constraints, such as add and mul_constant image.

image

while some operation like mul applied constraints.

image

As a user, I have to check each operation has constraints or not, it's very confusing. Can arkworks add uniform constraints in its implementation?

Pratyush commented 1 year ago

Adding constraints for these operations would greatly blow up the constraint count for many circuits. Generally, in most arithmetic circuit systems, addition gates and multiply-by-constant gates tend to have much lower cost than multiplication gates, and r1cs-std reflects that