Fix sub_op to actually subtract constants (it was just adding them together before)
Only call fold_limbs in mul if the product result is not constant (this would fail because fold_limbs is not implemented for constants)
Return early from assert_is_equal in the constant case (this would fail because compact_limbs is not implemented for constants)
Add simple test covering these code paths
@avras: If there is a reason why assert_is_equal was falling through and continuing with the rest of the function in the constant if case, let me know. Since it was failing later on with "compact_limbs not implemented for constants", I modified it to return Ok(()) before calling assert_limbs_equality and so on.
With this change, calling assert_is_equal with two constant elements will work correctly, and will NOT generate any constraints in the constraint system. I believe this is desirable behavior.
sub_op
to actually subtract constants (it was just adding them together before)mul
if the product result is not constant (this would fail because fold_limbs is not implemented for constants)assert_is_equal
in the constant case (this would fail because compact_limbs is not implemented for constants)@avras: If there is a reason why
assert_is_equal
was falling through and continuing with the rest of the function in the constant if case, let me know. Since it was failing later on with "compact_limbs not implemented for constants", I modified it to returnOk(())
before callingassert_limbs_equality
and so on.With this change, calling
assert_is_equal
with two constant elements will work correctly, and will NOT generate any constraints in the constraint system. I believe this is desirable behavior.