-
Notifications
You must be signed in to change notification settings - Fork 112
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
Public input permutation #62
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
adr1anh
force-pushed
the
ah/perm
branch
2 times, most recently
from
January 20, 2023 13:06
4413a8b
to
e3e1dc6
Compare
adr1anh
commented
Jan 20, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Explanations for some changes
Rumata888
approved these changes
Jan 23, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything seems great
cpp/src/aztec/honk/composer/composer_helper/composer_helper.cpp
Outdated
Show resolved
Hide resolved
cpp/src/aztec/honk/composer/composer_helper/permutation_helper.hpp
Outdated
Show resolved
Hide resolved
dbanks12
pushed a commit
that referenced
this pull request
Jan 26, 2023
## Clang-tidy related There are many changes that silence warnings from `clang-tidy`. - Initializing class members when possible - Explicitly deleting copy constructors/assignment operators for non-copyable classes - Using `= default` for trivial destructors - Adding `noexcept` to move constructors/assignment - Using `auto` after `static_cast` to avoid duplication. - Using `std::move` when copying an argument like a `string` or `vector` to help the compiler (references may alias, so passing by value tells the compiler that this value is really constant) - Removing unused headers, and adding `#pragma once` to prevent import clashes. - Reorder some imports, and use the module-relative paths - Replace some `typedef` with `using` - Use `const auto& element : container` to prevent unnecessary copies. ## Circuit Constructor - Replace `n` by `num_gates` to prevent clashes with `n` we use to refer to the `subgroup_size` - Added comments about things that seemed fishy, (all marked with `TODO(Adrian)` - Removed `NUM_RESERVED_GATES` and `WireType` since they are not used/duplicated - Simplified `set_public_input`, though not sure if the removal of the `ASSERT` is correct. ## Composer - Refactor `compute_proving_key_base` - Take the `CircuitConstructor` by `const` reference and modify the behavior so we only modify the `proving_key`. We no longer add any padding or dummy gates to the constructor, and instead do the padding entirely over the polynomials. - Remove unnecessary zero-ing out of selector values by using the fact that polynomials are initialized to 0. - Explicitly state where the public inputs are stored. - Refactor `compute_witness_base` - Use explicit types when referencing the `circuit_constructor` and ensure we only get objects that we don't modify. - Create `array` of wires to handle the `program_width` more generally. - No longer modify the `circuit_constructor` wires to add padding, and instead add 0-padding to the wire polynomials. - Remove `fr::__copy` - Ensure all calls to `circuit_constructor` are `const` - PermutationHelper: Big refactor to clarify handling of public inputs. - Simplify `cycle_node` behavior, and more generically handle different number of columns, and remove confusing `WireType` enum. - Make `compute_wire_copy_cycles` return a vector of `CyclicPermutation` for clarity. - Remove `resize` by noting that the number of cycles is equal to the number of `variables` - Reverse the order in which we were applying each `CyclicPermutation` to the `sigma` polynomials. Now, each `cycle_node` will map to the next one in the list. - Add comments to explain what parts of the function are necessary for our public input handling. - Changed the `composer_test` to also test for public inputs. - Add many more tests to ensure the permutation polynomials that we create have the expected form. - Compare results with the `public_input_delta` ## Prover & Verifier - Comment-out the `work_queue` related members. - Restore `gamma` challenge that was removed due to a misunderstanding - Remove default argument `beta = 1` for the `grand_product` computation. ## Sumcheck - Add `#pragma once` to headers - Modify the `GrandProductComputationRelation` to work with `Z_perm` that has the first coefficient equal to 0. - Handle `public_input_delta` in `GrandProductComputationRelation` - Modify `GrandProductInitializationRelation` to instead check that the last "real" value of `Z_perm_shift` is 0. In the current ZK-less situation, this is not necessary since it will be guaranteed by Gemini shift opening. But leaving it here for later. - Renamed `LAGRANGE_1` to `LAGRANGE_FIRST` to be consistent with other parts of the code.
dbanks12
pushed a commit
that referenced
this pull request
Jan 27, 2023
## Clang-tidy related There are many changes that silence warnings from `clang-tidy`. - Initializing class members when possible - Explicitly deleting copy constructors/assignment operators for non-copyable classes - Using `= default` for trivial destructors - Adding `noexcept` to move constructors/assignment - Using `auto` after `static_cast` to avoid duplication. - Using `std::move` when copying an argument like a `string` or `vector` to help the compiler (references may alias, so passing by value tells the compiler that this value is really constant) - Removing unused headers, and adding `#pragma once` to prevent import clashes. - Reorder some imports, and use the module-relative paths - Replace some `typedef` with `using` - Use `const auto& element : container` to prevent unnecessary copies. ## Circuit Constructor - Replace `n` by `num_gates` to prevent clashes with `n` we use to refer to the `subgroup_size` - Added comments about things that seemed fishy, (all marked with `TODO(Adrian)` - Removed `NUM_RESERVED_GATES` and `WireType` since they are not used/duplicated - Simplified `set_public_input`, though not sure if the removal of the `ASSERT` is correct. ## Composer - Refactor `compute_proving_key_base` - Take the `CircuitConstructor` by `const` reference and modify the behavior so we only modify the `proving_key`. We no longer add any padding or dummy gates to the constructor, and instead do the padding entirely over the polynomials. - Remove unnecessary zero-ing out of selector values by using the fact that polynomials are initialized to 0. - Explicitly state where the public inputs are stored. - Refactor `compute_witness_base` - Use explicit types when referencing the `circuit_constructor` and ensure we only get objects that we don't modify. - Create `array` of wires to handle the `program_width` more generally. - No longer modify the `circuit_constructor` wires to add padding, and instead add 0-padding to the wire polynomials. - Remove `fr::__copy` - Ensure all calls to `circuit_constructor` are `const` - PermutationHelper: Big refactor to clarify handling of public inputs. - Simplify `cycle_node` behavior, and more generically handle different number of columns, and remove confusing `WireType` enum. - Make `compute_wire_copy_cycles` return a vector of `CyclicPermutation` for clarity. - Remove `resize` by noting that the number of cycles is equal to the number of `variables` - Reverse the order in which we were applying each `CyclicPermutation` to the `sigma` polynomials. Now, each `cycle_node` will map to the next one in the list. - Add comments to explain what parts of the function are necessary for our public input handling. - Changed the `composer_test` to also test for public inputs. - Add many more tests to ensure the permutation polynomials that we create have the expected form. - Compare results with the `public_input_delta` ## Prover & Verifier - Comment-out the `work_queue` related members. - Restore `gamma` challenge that was removed due to a misunderstanding - Remove default argument `beta = 1` for the `grand_product` computation. ## Sumcheck - Add `#pragma once` to headers - Modify the `GrandProductComputationRelation` to work with `Z_perm` that has the first coefficient equal to 0. - Handle `public_input_delta` in `GrandProductComputationRelation` - Modify `GrandProductInitializationRelation` to instead check that the last "real" value of `Z_perm_shift` is 0. In the current ZK-less situation, this is not necessary since it will be guaranteed by Gemini shift opening. But leaving it here for later. - Renamed `LAGRANGE_1` to `LAGRANGE_FIRST` to be consistent with other parts of the code.
ludamad
pushed a commit
to AztecProtocol/aztec-packages
that referenced
this pull request
Jul 22, 2023
## Clang-tidy related There are many changes that silence warnings from `clang-tidy`. - Initializing class members when possible - Explicitly deleting copy constructors/assignment operators for non-copyable classes - Using `= default` for trivial destructors - Adding `noexcept` to move constructors/assignment - Using `auto` after `static_cast` to avoid duplication. - Using `std::move` when copying an argument like a `string` or `vector` to help the compiler (references may alias, so passing by value tells the compiler that this value is really constant) - Removing unused headers, and adding `#pragma once` to prevent import clashes. - Reorder some imports, and use the module-relative paths - Replace some `typedef` with `using` - Use `const auto& element : container` to prevent unnecessary copies. ## Circuit Constructor - Replace `n` by `num_gates` to prevent clashes with `n` we use to refer to the `subgroup_size` - Added comments about things that seemed fishy, (all marked with `TODO(Adrian)` - Removed `NUM_RESERVED_GATES` and `WireType` since they are not used/duplicated - Simplified `set_public_input`, though not sure if the removal of the `ASSERT` is correct. ## Composer - Refactor `compute_proving_key_base` - Take the `CircuitConstructor` by `const` reference and modify the behavior so we only modify the `proving_key`. We no longer add any padding or dummy gates to the constructor, and instead do the padding entirely over the polynomials. - Remove unnecessary zero-ing out of selector values by using the fact that polynomials are initialized to 0. - Explicitly state where the public inputs are stored. - Refactor `compute_witness_base` - Use explicit types when referencing the `circuit_constructor` and ensure we only get objects that we don't modify. - Create `array` of wires to handle the `program_width` more generally. - No longer modify the `circuit_constructor` wires to add padding, and instead add 0-padding to the wire polynomials. - Remove `fr::__copy` - Ensure all calls to `circuit_constructor` are `const` - PermutationHelper: Big refactor to clarify handling of public inputs. - Simplify `cycle_node` behavior, and more generically handle different number of columns, and remove confusing `WireType` enum. - Make `compute_wire_copy_cycles` return a vector of `CyclicPermutation` for clarity. - Remove `resize` by noting that the number of cycles is equal to the number of `variables` - Reverse the order in which we were applying each `CyclicPermutation` to the `sigma` polynomials. Now, each `cycle_node` will map to the next one in the list. - Add comments to explain what parts of the function are necessary for our public input handling. - Changed the `composer_test` to also test for public inputs. - Add many more tests to ensure the permutation polynomials that we create have the expected form. - Compare results with the `public_input_delta` ## Prover & Verifier - Comment-out the `work_queue` related members. - Restore `gamma` challenge that was removed due to a misunderstanding - Remove default argument `beta = 1` for the `grand_product` computation. ## Sumcheck - Add `#pragma once` to headers - Modify the `GrandProductComputationRelation` to work with `Z_perm` that has the first coefficient equal to 0. - Handle `public_input_delta` in `GrandProductComputationRelation` - Modify `GrandProductInitializationRelation` to instead check that the last "real" value of `Z_perm_shift` is 0. In the current ZK-less situation, this is not necessary since it will be guaranteed by Gemini shift opening. But leaving it here for later. - Renamed `LAGRANGE_1` to `LAGRANGE_FIRST` to be consistent with other parts of the code.
ludamad
pushed a commit
to AztecProtocol/aztec-packages
that referenced
this pull request
Jul 24, 2023
## Clang-tidy related There are many changes that silence warnings from `clang-tidy`. - Initializing class members when possible - Explicitly deleting copy constructors/assignment operators for non-copyable classes - Using `= default` for trivial destructors - Adding `noexcept` to move constructors/assignment - Using `auto` after `static_cast` to avoid duplication. - Using `std::move` when copying an argument like a `string` or `vector` to help the compiler (references may alias, so passing by value tells the compiler that this value is really constant) - Removing unused headers, and adding `#pragma once` to prevent import clashes. - Reorder some imports, and use the module-relative paths - Replace some `typedef` with `using` - Use `const auto& element : container` to prevent unnecessary copies. ## Circuit Constructor - Replace `n` by `num_gates` to prevent clashes with `n` we use to refer to the `subgroup_size` - Added comments about things that seemed fishy, (all marked with `TODO(Adrian)` - Removed `NUM_RESERVED_GATES` and `WireType` since they are not used/duplicated - Simplified `set_public_input`, though not sure if the removal of the `ASSERT` is correct. ## Composer - Refactor `compute_proving_key_base` - Take the `CircuitConstructor` by `const` reference and modify the behavior so we only modify the `proving_key`. We no longer add any padding or dummy gates to the constructor, and instead do the padding entirely over the polynomials. - Remove unnecessary zero-ing out of selector values by using the fact that polynomials are initialized to 0. - Explicitly state where the public inputs are stored. - Refactor `compute_witness_base` - Use explicit types when referencing the `circuit_constructor` and ensure we only get objects that we don't modify. - Create `array` of wires to handle the `program_width` more generally. - No longer modify the `circuit_constructor` wires to add padding, and instead add 0-padding to the wire polynomials. - Remove `fr::__copy` - Ensure all calls to `circuit_constructor` are `const` - PermutationHelper: Big refactor to clarify handling of public inputs. - Simplify `cycle_node` behavior, and more generically handle different number of columns, and remove confusing `WireType` enum. - Make `compute_wire_copy_cycles` return a vector of `CyclicPermutation` for clarity. - Remove `resize` by noting that the number of cycles is equal to the number of `variables` - Reverse the order in which we were applying each `CyclicPermutation` to the `sigma` polynomials. Now, each `cycle_node` will map to the next one in the list. - Add comments to explain what parts of the function are necessary for our public input handling. - Changed the `composer_test` to also test for public inputs. - Add many more tests to ensure the permutation polynomials that we create have the expected form. - Compare results with the `public_input_delta` ## Prover & Verifier - Comment-out the `work_queue` related members. - Restore `gamma` challenge that was removed due to a misunderstanding - Remove default argument `beta = 1` for the `grand_product` computation. ## Sumcheck - Add `#pragma once` to headers - Modify the `GrandProductComputationRelation` to work with `Z_perm` that has the first coefficient equal to 0. - Handle `public_input_delta` in `GrandProductComputationRelation` - Modify `GrandProductInitializationRelation` to instead check that the last "real" value of `Z_perm_shift` is 0. In the current ZK-less situation, this is not necessary since it will be guaranteed by Gemini shift opening. But leaving it here for later. - Renamed `LAGRANGE_1` to `LAGRANGE_FIRST` to be consistent with other parts of the code.
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.
Fixes #28, #22
Clang-tidy related
There are many changes that silence warnings from
clang-tidy
.= default
for trivial destructorsnoexcept
to move constructors/assignmentauto
afterstatic_cast
to avoid duplication.std::move
when copying an argument like astring
orvector
to help the compiler (references may alias, so passing by value tells the compiler that this value is really constant)#pragma once
to prevent import clashes.typedef
withusing
const auto& element : container
to prevent unnecessary copies.Circuit Constructor
n
bynum_gates
to prevent clashes withn
we use to refer to thesubgroup_size
TODO(Adrian)
NUM_RESERVED_GATES
andWireType
since they are not used/duplicatedset_public_input
, though not sure if the removal of theASSERT
is correct.Composer
compute_proving_key_base
CircuitConstructor
byconst
reference and modify the behavior so we only modify theproving_key
. We no longer add any padding or dummy gates to the constructor, and instead do the padding entirely over the polynomials.compute_witness_base
circuit_constructor
and ensure we only get objects that we don't modify.array
of wires to handle theprogram_width
more generally.circuit_constructor
wires to add padding, and instead add 0-padding to the wire polynomials.fr::__copy
circuit_constructor
areconst
cycle_node
behavior, and more generically handle different number of columns, and remove confusingWireType
enum.compute_wire_copy_cycles
return a vector ofCyclicPermutation
for clarity.resize
by noting that the number of cycles is equal to the number ofvariables
CyclicPermutation
to thesigma
polynomials. Now, eachcycle_node
will map to the next one in the list.composer_test
to also test for public inputs.public_input_delta
Prover & Verifier
work_queue
related members.gamma
challenge that was removed due to a misunderstandingbeta = 1
for thegrand_product
computation.Sumcheck
#pragma once
to headersGrandProductComputationRelation
to work withZ_perm
that has the first coefficient equal to 0.public_input_delta
inGrandProductComputationRelation
GrandProductInitializationRelation
to instead check that the last "real" value ofZ_perm_shift
is 0. In the current ZK-less situation, this is not necessary since it will be guaranteed by Gemini shift opening. But leaving it here for later.LAGRANGE_1
toLAGRANGE_FIRST
to be consistent with other parts of the code.