polymerdao / plonky2-circom

Apache License 2.0
155 stars 49 forks source link

Potentially wrong constraints in `GlReduce` #5

Open shuklaayush opened 9 months ago

shuklaayush commented 9 months ago

Shouldn't the Reduce function constrain that both r and d are less than the Order() p instead of just constraining that they're less than 2^64?

https://github.com/polymerdao/plonky2-circom/blob/806f6a47026c453c547b95c18209b214c8366aba/circom/circuits/goldilocks.circom#L21-L37

Eg. If x is p + 1, then both (d, r) = (1, 1) and (0, p + 1) are valid witnesses with the current code