-
Notifications
You must be signed in to change notification settings - Fork 16
ACIR 0.4 #53
Comments
Thank you for writing this. My general comment after writing this is that these issues can be split into a few categories:
We should split this up and only focus on the changes that were introduced by 0.3 that should be put into 0.3.3 first. I was under the impression that we want to solve these issues first. There are also quite a few issues where you say we should do something without proper explanation, I have asked for clarification or a separate issue to flesh out the details.
|
This is not my point, my point is about what was previously the AND/XOR/SHA256/.. gates. I explain why they should not be blackboxfunction, and there is no issue open for this as far as I know.
Thank you, I will add my comment to the issue then.
You are saying that inputs to blackbox functions are integers represented by FieldElements with a number of bits. And I am saying that this is a bad. Function inputs should be more flexible.
Ok
I will create separate issues. |
Closing this as ACVM is a very different beast from the time of this issue. |
Problem
ACIR 0.3 has not been reviewed and introduced many controversial changes.
Solution
Change to a new version of ACIR 0.4 which resolve those points
Additional context
I list below the main points.
Removal of AND/XOR/SHA256/.. opcodes
These opcodes have been placed under the blackboxfunction opcode, which for instances means that the solver is not solving them anymore but rely on the solve_blackbox function implemented by every backends.
This does not make sense as AND/XOR/SHA256/.. are not blackbox at all. Everybody should knows what they mean and we can rely on a common solving method. They should not be backend specific. A backend could support them or not, but there is no point to have a special blackbox function code to identify them: AND/XOR/SHA256/.. are universal.
Another consequence of having them as a blackboxfunction is that they rely on FunctionInput which requires a num_bit value for every input witness. Our own Aztec proving system, is not even adapted to this interface, and I don't believe we want to change this. Consequently, using different num_bits for the inputs on ACIR will lead to errors, while this was not possible before as the ACIR specification would not make this possible.
Another example is the RANGE blackboxfunction which now has to return an error when used with more than one input.
Not only we now have to specify more data in ACIR, but it can also lead to more errors.
blackboxfunction opcode
The blackbox name does not make sense as everything is a blackbox, unless you know how each proving system is implementing them, but then this name should not depend on the knowledge of a particular person.
What make sense is to allow backends to define functions that are specific for them, which then require an additional identifier and a way for the backend to solve these functions. These are the features that blackboxfunction provides.
Besides FunctionInput defines the witness inputs for blackboxfunction, so the naming is not coherent there.
As a result, BlackBoxFunction should be renamed into Function (or AcirFunction, or CustomFunction, or GadgetCall, with similar name for the inputs)
FunctionInputs
A FunctionInput specify a num_bits for each input witness. This does not make sense because ACIR lives inside a finite field and does not handle bits.
However, any ACIR function (I mean by that a blackboxfunction) may require extra parameters but these are specific to each function.
So in order to supply parameters in a generic way, I suggest ACIR function define the following inputs:
Vec<Witness>
: the input witnessesVec<u32>
: the extra parameters. Note we do not need to use u32, we could use FieldElement, bytes,... but u32 is both versatile and easy to manipulate. If we use bytes, there is the question of big/little endianness, if we use FieldElement, there is the question of the field and its representation (although that should not be an issue at ACIR level)TODOs
There are many TODOs that should be removed and have issues created instead
Improvements
I noticed a bunch of small improvements which should be implemented:
The text was updated successfully, but these errors were encountered: