-
Notifications
You must be signed in to change notification settings - Fork 134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conditional UInt64
subtraction bug
#895
Comments
I realized that I wasn't using the latest version of |
Thanks for reporting @Isaac-DeFrain! This isn't a bug. So, a safe subtraction of the smaller value from the larger one needs to be implemented differently. For example, you could first determine the min and max with 2 Circuit.ifs, and then do max.sub(min). What this definitely highlights is that we should improve the error message! |
If there's a way to report the line in the smart contract method where the error occurs, that would be like a 10x improvement! When running tests with jest, you only get the line in the test where the error occurs. |
This took me so long to pin down!
There seems to be a bug when evaluating conditional
UInt64
subtraction in SnarkyJS 0.9.8.Occurrences
Ordinary conditional (throws an error when condition is false)
Circuit
conditional (throws errors in both cases)Converting the condition
toBoolean()
fixes the ordinary conditionalbut not the
Circuit
conditionalThe text was updated successfully, but these errors were encountered: