Simplify hints declaration and make frontend responsible for number of outputs, not hint / backend #270
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.
Creating this one as draft before cleaning it as it opens a discussion. It reverts some changes introduced by #183 #175 (cc @ivokub ).
Essentially, this PR proposes to remove
nbInputs
andnbOutputs
set inStaticHintFunction
and theNbOutputs()
function in theHint
interface.Trying to implement multi-outputs (with variable length) hints for binary operation, this declarative way is really not helping;
The circuit developer will provide a list of inputs to the hint function (example;
api.NewHint(myHint, input0, input1, ...)
. IF (and I don't think we need to) we want to check that the number of inputs matches what the hints can process, it's up to the hint to perform the check (ie if len(inputs) > ... --> error). Currently this was encapsulated in aCall
function.Similarly, the circuit developer knows how many outputs it expects from a hint. He should set it like so
bits := api.NewHint(BitsHint, 220, value)
would return the first 220 bits for example in[]bits
. Previously this was done declaratively at hint definition, throughNbOutputs()
method, which was called both in the frontend and the backend at solving time. --> it makes no sense as the backend will not decide the number of outputs, the frontend did at compile time and created the exact number of wires needed.@ivokub did you have specific future scenario in mind when doing this pattern?