Skip to content
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

[api breaking changes]: added serialization for the witness #53

Merged
merged 13 commits into from Jan 19, 2021

Conversation

gbotrel
Copy link
Collaborator

@gbotrel gbotrel commented Jan 19, 2021

This PR started as an effort to enable inter-process / languages calls to gnark APIs.

Up until now, groth16 Witness was a map[string]interface{}. Using string for variable IDs was quickly inconvenient in non-Go codebases, and not needed.

For exposed APIs, here are the main changes:

  • backend/groth16 now takes frontend.Witness as input, which is an alias for frontend.Circuit, instead of an untyped interface (previously backed by a frontend.Circuit or map[string]interface{}). It parses the circuit the same ways frontend.Compile does, guaranteeing the same order of the secret and public inputs.
  • added backend/witness to serialize a frontend.Witness into []byte (through a io.Writer)

For internal packages:

  • internal/backend/curveXXX/groth16 Prove and Verify takes []fr.Element as input .
  • internal/backend/curveXXX/groth16.VerifyingKey now that named inputs are out, matches bellman.VerifyingKey enabling gnark to Verify bellman generated proofs for free (see groth16.Verify should be able to verify bellman-generated proof  #30 ). Note that pre-this PR serializations of VerifyingKey are not compatible with new serialization protocol / order.
  • internal/backend/curveXXX/witness implements witness [de]serialization logic, ([]byte, frontend.Witness, []fr.Element)
  • frontend/ all code related to input name management is gone.
  • renamed "solution", "input", "assignment" to witness or publicWitness in all the code base

@ThomasPiellard ThomasPiellard merged commit 2297162 into develop Jan 19, 2021
@ThomasPiellard ThomasPiellard deleted the serialization/witness branch January 19, 2021 09:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants