-
Notifications
You must be signed in to change notification settings - Fork 21
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
refactor(nifs): remaster permutation in PlonkStructure
#351
Merged
Conversation
This file contains 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
Base automatically changed from
316-refactor-relaxed-plonk-instance
to
main
September 25, 2024 05:11
**Motivation** As part of #316, we will need to remove some copy constraints before checking for correctness. To achieve this, I saved the information needed to build the matrix and built it on demand. Следующий PR добавит вырезание copy constraint **Overview** This PR refactors the `PlonkStructure` by introducing the `PermutationData` struct to manage permutation matrix data. It replaces direct usage of `SparseMatrix` with a method to construct the permutation matrix on demand.
255876a
to
143fd38
Compare
**Motivation** Since the path chosen under #316 is to translate the copy constraint on the instance column of the step-circuit to a private input (by additional copy-constraint), we also need to cut the original copy constraints before checking permutation, which is what this PR does **Overview** This PR makes significant changes to how copy constraints are handled within the step-circuit and their impact on permutation checks in our proof system: 1. **Removal of Original Copy Constraints**: - Introduced a mechanism to remove copy constraints on instance columns before permutation checks. - Added the function `rm_copy_constraints` to the `PermutationData` structure to filter out specific instance columns from permutation mappings. 2. **Adjusted Permutation Data Handling**: - Added the function `permutation_data_without_step_circuit_instances` to manage permutation data, ensuring non-essential instance columns are excluded from permutations. - This ensures that only the consistency markers instance column are considered during the permutation checks. 3. **Instance Column Accumulation**: - Updated the `iter_flat_instances_with_padding` function to handle the accumulation of instance columns correctly. - Ensures that instance columns are aligned correctly, padding as necessary based on the structure’s configuration. 4. **Algorithm for Copy Constraint Removal**: - Implemented a detailed algorithm to remove copy constraints from the permutation mapping, preserving the integrity of remaining columns. - Ensures that permutation cycles are correctly maintained even after certain instance columns have been excluded. These changes are hand-tested due to current constraints on the number of instance columns within the step-circuit. Further adjustments and instance accumulation will be addressed in future updates. NOTE: Please pay special attention to the algorithm for cutting non-target copy-constraint. I am currently writing a test to double-check by phasing the data, but it is better to make sure that the algorithm is correct by hand too
chaosma
reviewed
Sep 26, 2024
chaosma
approved these changes
Sep 26, 2024
**Motivation** As part of #316, we need to accumulate `instance`, using a poseidon hash. This PR should provide a consistent way to do this {on,off}-circuit within nifs::vanilla **Overview** - New Module - Added `instances_accumulator_computation.rs` to handle the accumulation of `instances` using the Poseidon hash function. - Functions: - `fold_step_circuit_instances_hash_accumulator` for off-circuit hash accumulation. - `fold_assign_step_circuit_instances_hash_accumulator` for on-circuit hash accumulation - Testing: - Added comprehensive unit tests to verify the consistency of the accumulator computation.
**Motivation** As part of #316, we will need to remove some copy constraints before checking for correctness. To achieve this, I saved the information needed to build the matrix and built it on demand. Следующий PR добавит вырезание copy constraint **Overview** This PR refactors the `PlonkStructure` by introducing the `PermutationData` struct to manage permutation matrix data. It replaces direct usage of `SparseMatrix` with a method to construct the permutation matrix on demand.
172c7e0
to
475e9a8
Compare
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.
Motivation
As part of #316, we will need to remove some copy constraints before checking for correctness. To achieve this, I saved the information needed to build the matrix and built it on demand.
Next PR will add copy constraint cutout
Overview
This PR refactors the
PlonkStructure
by introducing thePermutationData
struct to manage permutation matrix data. It replaces direct usage ofSparseMatrix
with a method to construct the permutation matrix on demand.