ZKP, Gnark: Does AssertIsLessOrEqual work with negative numbers?

182 Views Asked by At

Does gnarks (ZeroKnowledgeProof framework) AssertIsLessOrEqual work with negative numbers and ecc.BN254 curve? https://pkg.go.dev/github.com/consensys/[email protected]/frontend

It seems most computations including multiplication works with negative numbers but AssertIsLessOrEqual does not work as expected when it has negative parameters.

1

There are 1 best solutions below

0
On

gnark/bn254 works with unsigned numbers. When you pass -3 then it is 21888242871839275222246405745257275088548364400416034343698204186575808495614

What may mislead as frontend.API.Println will print 21888242871839275222246405745257275088548364400416034343698204186575808495614 as -3

AssertIsLessOrEqual will consider -3 as 21888242871839275222246405745257275088548364400416034343698204186575808495614