3

Does gnarks (ZeroKnowledgeProof framework) AssertIsLessOrEqual work with negative numbers and ecc.BN254 curve? https://pkg.go.dev/github.com/consensys/gnark@v0.7.0/frontend

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

Max
  • 6,286
  • 5
  • 44
  • 86

1 Answers1

3

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

user3130782
  • 841
  • 1
  • 6
  • 15