fix for V-SCT-VUL-002 and V-SCT-VUL-003

This commit is contained in:
Kevin Jue 2023-12-18 15:42:09 -08:00
parent 6af5b0ae93
commit 297a82025f

View File

@ -193,7 +193,7 @@ func (p *Chip) Reduce(x Variable) Variable {
remainder := NewVariable(result[1])
p.RangeCheck(remainder)
p.api.AssertIsEqual(x, p.api.Add(p.api.Mul(quotient, MODULUS), remainder.Limb))
p.api.AssertIsEqual(x.Limb, p.api.Add(p.api.Mul(quotient, MODULUS), remainder.Limb))
return remainder
}
@ -218,7 +218,7 @@ func (p *Chip) ReduceWithMaxBits(x Variable, maxNbBits uint64) Variable {
remainder := NewVariable(result[1])
p.RangeCheck(remainder)
p.api.AssertIsEqual(x, p.api.Add(p.api.Mul(quotient, MODULUS), remainder.Limb))
p.api.AssertIsEqual(x.Limb, p.api.Add(p.api.Mul(quotient, MODULUS), remainder.Limb))
return remainder
}