You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Tests are failing here, but on my local machine they look fine. By using NewStateLessHint when ToBinary is called on a constant, it only creates one constraint, while I've not handled the constant path in the function at all.
hey sorry we had a lot going on forgot about that one, thanks for the nudge.
I prefer to see hints (all of them) as stateless functions. but we have several examples where circuit-developers used them as ... a way to introduce new wires and/or put a "hook" in the solver.
--> so far the contract was "using a solver hint, you are introducing new wires and putting a placeholder for the solver to resolve these wires at solve time".
not sure we do need the "hint inputs are constants, let's optimized it out" a lot. If it's isolated in one or two places (like ToBinary) might be simpler to target the issue there for now. it is more conservative but maybe a couple of extra constraints on some edge cases is better than introducing subtle behavior / doubling APIs for hints (note that for the stateless one; the compiler has no way to actually check that the function is indeed stateless).
I see. So, If you don't like the idea of a generic solution, For now I'd recommend handling constant inputs in ToBinary explicitly. There are some practical examples that shows ToBinary may be called with a constant input, while the programmer cannot notice it. (the call is done inside another function) The current Implementation of ToBinary creates around 250 constraints for a constant input, while no constraints are needed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR provides a possible solution for issue #653.