-
Notifications
You must be signed in to change notification settings - Fork 27
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 a switch to enable/disable instance hashing #357
Comments
That'd be nice to find a reasonable approach to keep support for "standalone" Zeth while supporting aggregation via Zecale (in the current state of the code base, we don't support "standalone" Zeth anymore as we baked the Zecale integration to the code without "switches") So here's an initial list of what's needed - but let's discuss further:
Note: if we want two entry points to the same Zeth contract on-chain for the "standalone" and the "aggregated" mode (which is desirable as it keeps 1 unique anonymity set), we also need to be able to verify proofs with 2 vks since the zeth statement is modified to integrate with Zecale. Hence we also need to modify the storage variables of the Mixer (to have a @dtebbs - thoughts? |
If I've uderstood the issue here, the switch would only control whether to use the GGPR trick so that verification uses a single scalar multiplication, or requires a multiplication per public element. The "standalone" terminology (which just implies operation outside of zecale) vs "aggregated" (implying operating via some batching mechanism) may be confusing (for example, we currently support "standalone" mode, we just use GGPR to make verifcation more efficient). I may have forgotten / missed something, but given the extra complexity involved, it's not obvious to me where the need to support standalone without GGPR comes from. (Note that zeth always works in standalone mode, with other flags that enable/disable the delegated verifier.) Supporting both modes (with and without the GGPR trick) side-by-side seems especially like it would involve even further complexity which may be diffcult to justify (multiple circuits in the prover, multiple request / response types, keeping multiple keys in the contract). AFAICT (and this is where I'm probably missing something) the only benefit is a small constraint saving in the circuit. We could do the measurement (in fact, it should be straightforward to calculate), but would this alone justify the increase in gas cost and complexity? |
Sure, we can definitely revise the terminology - what I mean here is "standalone Zeth = Zeth used without Zecale" and "aggregated Zeth = Zeth with Zecale" :)
Sure, we can still use the instance hashing to use Zeth "standalone" - but the reason this was introduced is mostly because of Zecale (to break the linear complexity of the verifier). Of course, it may still be viable to keep this instance hashing if Zeth is used without Zecale, but you're right when you say:
Definitely. To properly spot the costs and make the appropriate tradeoffs, we should measure the overhead of the instance hashing (if any) to see if we would like to remove it for the "standalone mode" or if it makes sense to remove it (e.g. we save scalar mults on the verifier but we pay extra hashing cost in the circuit + pay extra for the additional instance hash to pass to the CALLDATA, the hash check on the contract etc) |
Recently, Zeth has been updated to support hashing the instance - which allows to break the linear complexity of the Snark verifier, which is ultimately required to improve the "generic" aspect of Zecale. However, the associated extra operations (on the C++ side and on the Solidity side) are not necessarily desired if Zeth is used in a standalone way. Hence, it would be nice to decide which variant to use at compile time in order to produce the appropriate binary (for use via Zecale, or in a standalone way).
The text was updated successfully, but these errors were encountered: