Skip to content

feat: Allow skipping of constraint generation during proving #399

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

VolodymyrBg
Copy link

@VolodymyrBg VolodymyrBg commented Apr 18, 2025

Description

This PR implements a mechanism to skip constraint generation during proving by storing a mapping between unoptimized and optimized witnesses. When the prover runs with construct_matrices=false, it can use this mapping to directly evaluate linear combinations without reconstructing the full constraint matrices, significantly improving proving performance.
The implementation adds a new witness_mapping field to the ConstraintSystem structure, updates the enforce_constraint method to use this mapping when appropriate, and adds methods to get/set the mapping through both ConstraintSystem and ConstraintSystemRef. A benchmark example is also updated to demonstrate the performance improvement.

closes: #328


Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.

  • Targeted PR against correct branch (master)
  • Linked to Github issue with discussion and accepted design OR have an explanation in the PR that describes this work.
  • Wrote unit tests
  • Updated relevant documentation in the code
  • Added a relevant changelog entry to the Pending section in CHANGELOG.md
  • Re-reviewed Files changed in the Github PR explorer

Add witness_mapping field to ConstraintSystem struct
Initialize the field in new() method
Modifies the benchmark example to demonstrate the constraint generation skipping functionality. Runs the example twice: first to generate constraints and create the witness mapping, and second to use the mapping to skip constraint generation, showing the performance improvement.
Adds wrapper methods to ConstraintSystemRef for accessing and modifying the witness mapping functionality in the underlying ConstraintSystem. Enables users to access the mapping through the reference type without direct access to the constraint system.
@VolodymyrBg VolodymyrBg changed the title Bgg feat: Allow skipping of constraint generation during proving Apr 19, 2025
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.

Allow skipping of constraint generation during proving
1 participant