Replies: 2 comments 2 replies
-
It may be indeed, we have optimized some defaults so that the circuit compilation wouldn't take that much memory, but for large circuits you would need tens of GB of memory. Do you have an example circuit? What are the parameters of the machine you are compiling the circuits on? |
Beta Was this translation helpful? Give feedback.
-
Hi! I'm working on this circuit: https://github.com/drakstik/PhotoGnark_V0/blob/main/src/circuits/cropCirctuit.go You can run main.go to test it out. Essentially, we have an original, secret 2D array of pixels N*N, which is an image, represented as a 1D array of pixels. In the circuit, I crop the original image according to some cropping parameters and move the remaining pixels to the top left, then assert that a given other image is a cropped version of the secret original image. You can change the N global variable to see what I'm talking about (see the N global variable here: https://github.com/drakstik/PhotoGnark_V0/blob/main/src/image/image.go). When N is low, the circuit works, when it is higher (for me it maxes out at 14) then eventually you get a Terminated message. I am running 32GB RAM. Thank you for your help! |
Beta Was this translation helpful? Give feedback.
-
Context
Hi!
I've noticed that with enough API calls, we receive a
Terminated
message at some point. I'm assuming this happens because in my circuit definition I have a couple of loops that have API calls in them, and as I increase the number of times the loop iterates, I get aTerminated
message.My Question
How can one go about "optimizing" their circuit in order to avoid the
Terminated
message?ChatGPT suggests I should create "subcircuits" so the API calls are distributed across more circuits, but I'm not sure if ChatGPT is correct here. In my previous question about a small modulo function #1362, the answer uses the test package (https://pkg.go.dev/github.com/consensys/gnark/test) to run small modulo as its own circuit, should I be doing this same thing inside my circuit using the WithValidAssignment option? But then how can I get the quotient and remainder as frontend.Variable, since I need them later? I have to assign the subcircuits on the fly and get a result from them. At the very least I should receive a Boolean from the subcircuit because at the end of the forloop I use the api.Select() function.
Thank you and I hope my question makes sense, I'm still getting used to the language of coding with zk-SNARK circuits.
Beta Was this translation helpful? Give feedback.
All reactions