-
Notifications
You must be signed in to change notification settings - Fork 413
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
Add hint registry #183
Add hint registry #183
Conversation
One thought, currently, nothing prevents the following workflow;
in another binary, |
I do not follow completely - wouldn't witness import |
Not necessary; if it's done in a Go codebase yes. But, say, random example ( :) ) a zkRollum built in Rust, can build a serialize a witness in rust, and have a Go micro service call That being said, the current pattern where we have to explicitly set the |
I see - if the both CCS and witness are both obtained by deserializing some input, then they do not import the gadgets and the hints are not registered. If serializing the proofs which use hints, then are the hint variables also serialized, or are they created only in runtime? I do not see right now how it could be improved - for me it seems that hint functions are specific to particular implementation. I guess the hint variables should also be serialized to be implementation-independent? |
What do you mean by "hint variables"?
What happens is
|
Yes, I was thinking about internal variables. But at least for me there is a small difference compared to other (non-hint) internal variables as it is necessary to additionally constraint the internal variables.
I see. Definitely, when the user circuit needs a hint, then right now the binary needs to be recompiled to have the corresponding hint as a prover option. There may be ways around it (e.g. maybe the prover service can accept the hint function as an executable script etc.), but I do not quickly see a nice way around it. Slightly going off-topic - I realized that allowing hints in the user-defined circuits may have security implications. See https://gist.github.com/ivokub/99ec89246f251e9b53f3803135bf316a. Here - the keys are set up for GoodCircuit. However, the malicious prover constructs proof for another circuit BadCircuit (using a different hint function). From verifier point of view - the proof verification succeeds for GoodCircuit and the public witness, but the prover actually didn't have the secret witness for it. Maybe I do not yet fully understand the security model and this is not a problem? |
329bed2
to
3b94d4d
Compare
Behavior of hints is a bit subtle; it's not a constraint, but a "off-circuit" computation. So in this example:
The only constraint on |
Added hint registry for registering hint functions used in gadgets. Improved the documentation to help explain the usage of hints.
Todo: