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
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 a Terminated 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.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
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