[api breaking changes]: added serialization for the witness #53
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.
This PR started as an effort to enable inter-process / languages calls to
gnark
APIs.Up until now,
groth16
Witness was amap[string]interface{}
. Usingstring
for variable IDs was quickly inconvenient in non-Go codebases, and not needed.For exposed APIs, here are the main changes:
backend/groth16
now takesfrontend.Witness
as input, which is an alias forfrontend.Circuit
, instead of an untyped interface (previously backed by afrontend.Circuit
ormap[string]interface{}
). It parses the circuit the same waysfrontend.Compile
does, guaranteeing the same order of the secret and public inputs.backend/witness
to serialize afrontend.Witness
into[]byte
(through aio.Writer
)For internal packages:
internal/backend/curveXXX/groth16
Prove
andVerify
takes[]fr.Element
as input .internal/backend/curveXXX/groth16.VerifyingKey
now that named inputs are out, matches bellman.VerifyingKey enablinggnark
to Verifybellman
generated proofs for free (see groth16.Verify should be able to verify bellman-generated proof #30 ). Note that pre-this PR serializations ofVerifyingKey
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.witness
orpublicWitness
in all the code base