gnark-whir: Dump CCS to file, read PK/VK from file, update Gnark to v0.13#129
Merged
Conversation
f5219e3 to
0ed68c9
Compare
Collaborator
Author
|
The RPi5 benchmark CI step is failing, but it doesn't seem to be my fault - the same step fails on main already. |
veljkovranic
approved these changes
Jul 8, 2025
Signed-off-by: Wojciech Zmuda <zmuda.w@gmail.com>
The program had a few possibly configurable paths hardcoded. Add command line flags with values defaulting to the hardcoded paths, so they're easily changable if needed. Signed-off-by: Wojciech Zmuda <zmuda.w@gmail.com>
Add an optional --ccs flag providing a path to a file where the constraint system object will be serialized. The serialized CCS object will be needed for the trusted setup ceremony initialization. Signed-off-by: Wojciech Zmuda <zmuda.w@gmail.com>
Creating keys with Setup() is unsafe, because the process is possibly deterministic which can lead to recovering keys by the attacker. While it is fine for tetsing purposes, production environments should use keys derived from a proper multi-party computation trusted setup ceremony. Add --pk and --vk flags to allow using such keys for verifying the proof. These flags are optional and not passing any of the keys results in a fallback to the previous behavior of unsafe keys generation. Signed-off-by: Wojciech Zmuda <zmuda.w@gmail.com>
Bump also gnark-skyscrapper. The new revision also bumps Gnark. The update is motivated by the fact that the MPC trusted setup ceremony tool will use Gnark v0.13 as well. Signed-off-by: Wojciech Zmuda <zmuda.w@gmail.com>
Add a readme file describing the usage of the project. Update the ProveKit readme file by removing the outdated information that gnark-whir is developed in an external repository, as it is now a part of ProveKit. Do the same to gnark-nimue, which is local since 6e408dd. Signed-off-by: Wojciech Zmuda <zmuda.w@gmail.com>
Collaborator
|
Looks good to me! |
batmendbar
approved these changes
Jul 10, 2025
dcbuild3r
pushed a commit
that referenced
this pull request
May 16, 2026
gnark-whir: Dump CCS to file, read PK/VK from file, update Gnark to v0.13
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
This PR is a part of the effort of creating a trusted setup ceremony tool. The tool will be universal (i.e. will work with all Gnark-based projects), but its first purpose will be providing a way to generate Proving and Verifying Keys in a trusted setup ceremony based on a multi-party computation.
This PR adds some required features to the gnark-whir project.
I suggest to review commit-by-commit, it should be easier than looking at diff for a handful of unrelated changes at once.
Changes
Command line interface
To allow adding more features to the project, implement a simple command line interface using the well known urfave/cli library.
The usage of the CLI is not mandatory - if there are any existing scripts relying on running the project with
go run .orgo build && ./whir-verifier-circuit, they will work as usual. This change does not break any existing compatibility.Run
go run . -hto see the help for the new interface:Flags
configandr1cscontrol which files are used by the already-exisitng features of the verifier program. Default values for the flags are the same paths that were already used in the program prior to this change. Therefore simplego run .before and after this PR will yield the same result.Flags
ccs,pk, andvkare new features described below.CCS serialization
Use the
ccsflag to provide a path to store the constraint system object generated in theCompile()step. The constraint system object is required for generating keys in the trusted setup ceremony.Using the flag is not mandatory. If not used, the CCS object will not be serialized.
Example usage:
Afterwards, the constraint system object is stored in
example-ccs.binand can be passed to the trusted ceremony tool.PK/VK deserialization
Afer the keys are generated in the trusted setup ceremony, they can be fed back to the verifier with
pkandvkflags and be used for generating proofs and verifying them.Using the flag is not mandatory. if not used, PK and VK will be generated with Gnark's
Setup()method, just like they were generated before this PR. In such case, the following warning will be printed:Example usage:
Gnark update
Update Gnark from v0.11 to v0.13. This change is motivated by the fact that, Gnark v0.11 has a bug in the MPC API used in the trusted setup ceremony tool. The bug is fixed in v0.13, which forces the tool to be based at least on this Gnark version, which, in turn, requires projects using this tool to be based on the same Gnark version, as Gnark does not guarantee binary compatibility for its serialized objects between subsequent releases of the library.
Verification
Correctness of these changes have been verified by using the deserialized CCS to perform the trusted setup ceremony. Keys generated in the ceremony were lated passed back to the verified and the proof was generated and proven successfully.
At the same time, when the CLI flags are not used, the program behaves in the same way as before this PR.