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

Chore/sync upstream #51

Merged
merged 11 commits into from
Aug 7, 2023
Merged

Chore/sync upstream #51

merged 11 commits into from
Aug 7, 2023

Conversation

oskarth
Copy link
Collaborator

@oskarth oskarth commented Aug 6, 2023

Sync upstream

huitseeker and others added 11 commits July 12, 2023 14:51
Allows generic programming on Nova curve cycles.
* feat; benchmark compressed SNARK with computational commitments

- labeled types for compressed SNARKs in benchmarks, both with and without computational commitments, enhancing the functionality.
- Extended benchmark testing to include compressed SNARK with computational commtiments

* fix: use flat sampling mode for computational commitments, reduce circuit sizes
- Used struct `PolynomialMultiplier` with a corresponding test
- Added `proptest` to dependencies for property-based testing
- Created property-based test to verify big number decomposition under various conditions
* refactor: Deleted a redundant `ScalarMul` helper trait

* refactor: Refactor `to_transcript_bytes`

* refactor: refactor R1CS Shape checking in Spartan checks

- Introduced a new function `check_regular_shape` in `r1cs.rs` to enforce regularity conditions necessary for Spartan-class SNARKs.

* refactor: Refactor sumcheck.rs prove_quad_* for readability

- Extracted the calculation of evaluation points to its new function `compute_eval_points`, enhancing code reusability within `prove_quad` and `prove_quad_batch` functions.
* refactor: Remove redundant PrimeField bound in various modules

* refactor: Refactor main Group trait to use group::Group

- the main Group trait now uses ::zkcrypto::group::Group
- Refactored the usage of generic type associated 'Scalar' across multiple files and functions from 'G::Scalar' to fully qualified '<G as Group>::Scalar'.
- No new features were added, functionality remained the same, changes were mostly aimed at improving type inference and handling.

* Revert "refactor: Refactor main Group trait to use group::Group"

This reverts commit 5ee0590.
* refactor: Refactor row/col vector construction for efficiency

- Optimized the creation of `row` and `col` in `R1CSShapeSparkRepr::new` using map and unzip methods.
- Updated `R1CSShapeSparkRepr::evaluation_oracles` to create `E_row` and `E_col` using the same logic for consistency.

* refactor: Refactor and optimize `R1CSShapeSparkRepr` initialization

- Updated method for zero padding in `val_B` and `val_C` using `std::iter::repeat`, to need one vector allocation instead of two
- Functionality and outputs remain unchanged.

* refactor: Refactor polynomial struct in SumCheck to use generic Scalar type

- Updated `CompressedUniPoly` and `UniPoly` structs in `sumcheck.rs` to use the generic `Scalar` type.
- Adapted all methods within these structs to accommodate the `Scalar` type instead of `G: Group` type.
- Modified the type of `cubic_polys` in `ppsnark.rs` to `CompressedUniPoly<G::Scalar>`.

* refactor: Eliminate most instances of resize

resize in Rust may cause reallocation of the memory, which is an expensive operation. This is particularly true when the vector is resized to a larger size.
* refactor: Eliminate a few unecessary allocations

- Simplified instances of into_par_iter
- Enhanced performance in `ppsnark.rs` by eliminating unnecessary cloning of `left_vec` and `right_vec`.

* refactor: Refactor evaluation point computations in Spartan

- Incorporated `compute_eval_points_cubic` in `ProductSumcheckInstance` and `OuterSumcheckInstance` to increase code efficiency.
- Renamed `compute_eval_points` as `compute_eval_points_quadratic` in `prove_quad` and `prove_quad_batch`.
- Streamlined the computation of evaluation points in `prove_cubic_with_additive_term` by creating a new function `compute_eval_points_cubic`.
- Enhanced the scope visibility of `compute_eval_points_quadratic` and `compute_eval_points_cubic` within the `crate::spartan`.
* refactor: Convert multiple methods to constant functions

Which should bring a minor boost in efficiency.

* chore: Move flate2 to dev dependencies

- Switched the `flate2` dependency from being a project-wide dependency to a development-specific dependency in the `Cargo.toml` file.

* refactor: Refactor `NovaAugmentedCircuit` to take circuit references for greater efficiency

- Implemented lifetime management for `NovaAugmentedCircuit` struct and its associated methods, which allows efficient reuse of `step_circuit` across different circuits.
- Updated initialization of `TrivialTestCircuit` in tests and ensured its usage via references instead of multiple instances.
- Streamlined the setup of public parameters across benchmark scripts by using references (`&c_primary` and `&c_secondary`) instead of cloning.
- Optimized `PublicParams::setup` method by minimizing cloning instances, improving efficiency across the codebase.
- Refactored the usage of `circuit_primary`, `circuit_secondary`, and `TrivialTestCircuit` to use references in setup methods and benchmarks.

* refactor: Optimize NovaAugmentedCircuit for parameter referencing

- Modified `NovaAugmentedCircuit` struct to accept a reference to `NovaAugmentedCircuitParams` instead of possessing it, preventing duplication.
- Refacted `new` method and test function in `circuit.rs` to match the updated structure and pass references.
- Removed unnecessary cloning of `augmented_circuit_params_primary` and `augmented_circuit_params_secondary` in `lib.rs` script to increase performance.
- Optimized the initialization of the `NovaAugmentedCircuit` by using direct references, improving software's efficiency.

* fixup! refactor: Optimize NovaAugmentedCircuit for parameter referencing
Copy link
Member

@CPerezz CPerezz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@CPerezz CPerezz merged commit a18afe0 into main Aug 7, 2023
1 check passed
@CPerezz CPerezz deleted the chore/sync-upstream branch August 7, 2023 13:38
hero78119 pushed a commit to hero78119/SuperNova that referenced this pull request Jan 3, 2024
…orations#51)

* -- wip --

* tracing adjustments

* more running claims API

* apply suggestions

* CircuitParams -> CircuitShape

* add and fix pp tests
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.

4 participants