-
Notifications
You must be signed in to change notification settings - Fork 16
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
No need for range check #8
Comments
Hey @enricobottazzi Thanks for this! |
@enricobottazzi, @BlakeMScurr created a repo to test this case normally, you can find it here https://github.com/BlakeMScurr/comparator-overflow |
Thanks for the material provided. The context is clearer now, and the implementation you applied seems correct. Wondering if you and @BlakeMScurr have any suggestions on how to fix this at the circomlib level |
@enricobottazzi well the algorithm is still sound for numbers in the right range, and it's probably pretty optimal, so I wouldn't change it. Maybe I'd just rename it to That way:
What do you think? |
@enricobottazzi by the way, while we're discussing
instead of
I think that's right. Might try a PR some time. Although, the constraint count might end up being the same due to compile time optimisations. |
The range check performed here on
sourceValue
andclaimedValue
is not necessary in my opinion.This range check would only fail if:
sourceValue
< pclaimedValue
< pAnd these are not actually cases of overflow.
I performed the test included in the library after having removed these 4 lines and they all pass successfully.
You can check these 2 gists here (circuit and test) to test out my hypotheses.
It would be interesting to understand if the
LessOrEqual
operation is sufficient to prevent any overflowThe text was updated successfully, but these errors were encountered: