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

feat: consistant support of cs.Println and debugInfo #142

Merged
merged 15 commits into from
Sep 20, 2021

Conversation

gbotrel
Copy link
Collaborator

@gbotrel gbotrel commented Sep 17, 2021

Circuits compiled with backend.GROTH16 or backend.PLONK both supportes cs.Println and debug info (stack trace) when a constraint is not satisfied at solving time.

Breaking changes

  • encoding of R1CS and SparseR1CS now uses cbor.CoreDetEncOptions() to enable deterministic encoding of maps
  • cs.Println has no more side effect on the number of constraint
  • groth16.Prove and plonk.Prove APIs now takes a list of backend.ProverOption options, instead of a list of optional arguments.

Example usage

groth16.Prove(cs, pk, witness, backend.WithOutput(&buf), backend.IgnoreSolverError, backend.WithHints(...))

Internal changes

  • frontend.ConstraintSystem: assertions are merged with constraints
  • compiled/: R1CS and SparseR1CS share a common data structure, the only difference is the list of coefficient (R1C& SparseR1C)
  • frontend: added addDebugInfo helper -->
debug := cs.addDebugInfo("div", v1, "/", v2, " == ", res)
cs.addConstraint(newR1C(v2, res, v1), debug)

TODO:

  • cs.Println doesn't recurse it's inputs as before to look for variables. Need to allow at least one level of recursion to print data structs containing variables.

@gbotrel gbotrel added this to the v0.6.0 milestone Sep 17, 2021
@gbotrel gbotrel merged commit 35e8704 into develop Sep 20, 2021
@gbotrel gbotrel deleted the frontend-println-tests branch September 20, 2021 16:34
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.

1 participant