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
Max limit on big.Int
input to circuit?
#204
Comments
Thanks @vck3000 for the feedback. This is currently a limitation in gnark -- all arithmetic is done on the scalars of the underlying elliptic curve group. If a value is larger than the modulus of the scalars, then it will be reduced by the modulus. We are quite aware of this and the solution would be to implement integer arithmetic on top of the scalar field. I can not right now give you specific timeline when it will happen. But it will probably happen in mid-/long-term future as we develop the standard gadget library. |
Cool, no worries. I will try to get around this by splitting my input into 32 byte chunks and passing them in. |
Hi how do you splitting your input? I got error |
@ZhAnGeek, can you provide example code and error? |
thanks, actually I and writing []frontend.Variable in a Circuit, and I found out that the length of this array should be fixed, and the amount of it is examined while frontend has compiled.
can such array being not fixed long, for example I need the MSG to be expanded? thx. |
The circuits are fixed after compiling, meaning that the all variables, coefficients, constants etc. are embedded in the circuit. It won't be possible to add variables (comparable to increasing the slices) in-circuit. Most notably, it won't be possible to write loops where the bounding condition is a variable (i.e. the number of iterations in a loop varies depending on the variable value). Anyway, I think that your question is unrelated to the current issue. Maybe you can start a new discussion at https://github.com/ConsenSys/gnark/discussions and quote me? Please post your full working example including the circuit definition. |
Hi @ZhAnGeek, I did something like the following:
To test:
At the end of the day, the circuit is still compile-time deterministic. |
See non-native arithmetic gadget in |
Hi there,
I'm doing some work with large inputs, and seem to have bumped into a limit on the input size.
I can't seem to pass in inputs larger than 32 bytes through the circuit witness and get it to show up correctly.
Minimal reproducible code:
Output with 33 bytes:
Output with 32 bytes:
Any ideas on how I can get around this limit?
The text was updated successfully, but these errors were encountered: