-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: Remove MultiFrameTrait (#1026)
* refactor: Simplify `Prover` trait in `proof` module - Deleted the `outer_synthesize` method from the `Prover` trait. - Removed unused import and unused type alias from `src/proof/mod.rs` * refactor: Refactor generic parameters in proof evaluation traits - Refactor multiple traits including CEKState, FrameLike, and EvaluationStore among others, reducing the number of generic parameters from two to one. - Unify all pointer types to `Ptr`, eliminating separation between `ExprPtr` and `ContPtr`, resulting in simplified function signatures and traits. - Update all references of `ContPtr` to the new unified `Ptr` type throughout the code base for consistency. - Update test functions in `src/proof/tests/mod.rs` to expect the new `Ptr` type instead of `ContPtr`. - Adjust the function definitions in `MultiFrameTrait` to align with the new unified `Ptr` generic parameter. * refactor: Refactor proof module to directly use `Store<F>`, `Ptr`, `Frame` - Refactored `MultiFrameTrait` related methods in `src/proof/mod.rs` to use `Store<F>`, `Ptr` and `Frame` directly instead of associated types. - Updated `prove_recursively` method in `RecursiveSNARKTrait` and Prover methods to reflect these changes. - Incorporated the usage of `Store<F>` in place of `<M>::Store` in `src/proof/supernova.rs` and `src/proof/tests/mod.rs`, leading to adjustments across various function definitions. - Implemented the option to switch between parallel and sequential computation in the recursive SNARK proofing in `src/proof/nova.rs`. - In `src/lem/multiframe.rs`, simplified type specifications across various methods to directly use existing types like `Store<F>`, `Frame` and `Ptr`. - Updated `cache_witness()` function to handle errors more efficiently and carried out general code refactoring and simplification for overall improvement. * refactor: Refactor proof structures, removing MultiFrame usage - Removed dependency on `MultiFrameTrait` and `StepCircuit`, `SuperStepCircuit` from various sections, simplifying the imports. - Simplified the `LurkProof` data structure by removing the `M: MultiFrameTrait` parameter. - Adapted the `prover` variable type to be more generic across various files and functions such as `end2end_benchmark` and `prove_benchmark`. - Updated `NovaProver` struct and instantiation, removing `MultiFrameTrait` application. Replaced `MultiFrameTrait` usage with `C1LEM`. - Refactored proof structures in code, including modifications to function calls, assertions, proof verification and synthesis, shifting towards a simpler or more direct format. - The changes do not seem to alter the program's fundamental logic, but rather its structuring and instantiation. * refactor: Refactor SupernovaProver to use C1LEM instead of MultiFrameTrait - Overhauled the `supernova.rs` code, replacing `MultiFrameTrait` with `nova::C1LEM` - Removed usage of `MultiFrameTrait` in `SuperNovaProver`, further refining its scope and purpose - Updated `Prover` code to reflect the change in usage from `MultiFrameTrait` to `C1LEM` - Enhanced `sha256_nivc.rs` example by directly implementing `SuperNovaProver` without `MultiFrame`, and adding proof size output and verification functionality. * refactor: Replace MultiFrameTrait with C1LEM across codebase - Replaced the `MultiFrameTrait` with `C1LEM` across various functions in different files which made `circuit_cache_key` method and other related methods non-generic. - Updated method calls reflecting changes of generic parameters to use `C1LEM` in place of `MultiFrameTrait` and also in cache handling methods in `supernova.rs` file. - Removed `MultiFrame` usage in several benchmark methods - namely `end2end_benchmark`, `prove_benchmark`, `prove_compressed_benchmark`, `verify_benchmark`, and `verify_compressed_benchmark`. - Updated `public_params` function and its related functions to work with changes of replacing `MultiFrameTrait` with `C1LEM`, this included adjusting the return type of `public_params` and modifications in `DiskCache` struct in `public_parameters/mod.rs` file. - Examples and benchmarks using `public_params` function refactored to no longer require `MultiFrame` as a generic argument, this occurred in `examples/circom.rs`, `benches/fibonacci.rs`, and `benches/sha256.rs` files. - `DiskCache` struct heavily refactored with the replacement of `MultiFrameTrait` with `C1LEM`, impacting `read` and `write` methods return types in `public_parameters/disk_cache.rs` file. - The usage of `get_from_disk_cache_or_update_with` and `get_from_mem_cache_or_update_with` functions in `public_parameters/mem_cache.rs` file changed with the adoption of `C1LEM`. - The `Instance` struct in the `src/public_parameters/instance.rs` was simplified and restructured to no longer depend on `MultiFrameTrait` and its associated methods and return types updated accordingly. * refactor: Refactor generic functions to specific C1LEM use - Refactored code, replacing the use of the `M: StepCircuit<F> + MultiFrameTrait<'a, F, C>` generic with the more specific `C1LEM<'a, F, C>` struct. - Redesigned the `public_params` and `circuits` function outputs to return `C1LEM<'a, F, C>` instead of `M`. - Observed substantial edits within code used for proof checking, compressed proof verification, and result checking. - Eliminated usage of `MultiFrameTrait<'a, F, C>` and `MultiFrame` import from function parameters and file imports respectively across a number of files. - Updated various function calls to accommodate the `C1LEM<'a, F, C>` struct instead of `M`. - Altered the `public_params` function in `supernova.rs` by updating the return type and modifying setup for non-uniform circuit and public params. * refactor: Refactor and remove `MultiFrameTrait` across modules - Removed `MultiFrameTrait` from various files due to its deprecation and switched to direct use of 'MultiFrame' methods. - Updated 'Provable' and 'Prover' traits to accommodate removal of `MultiFrameTrait`, with relevant modifications in methods `proof` and `evaluate_and_prove`. - Renamed 'io_to_scalar_vector' function to 'to_scalar_vector' and applied this change in the trait methods. - Introduced debugging and verification of the circuit's constraint system in 'prove_recursively' function in `nova.rs`. - The 'MultiFrame' struct underwent significant reorganization to replace 'MultiFrameTrait', including new getter methods, building methods and potential performance improvements in synthesizing frames. - Reorganized Frame allocation and handling in the `MultiFrame` instances for more effective synthesization. * chore: clippy
- Loading branch information
1 parent
dae844a
commit 2542602
Showing
24 changed files
with
922 additions
and
1,188 deletions.
There are no files selected for viewing
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
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
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
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
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
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
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
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
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
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
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
Oops, something went wrong.
2542602
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.
Benchmarks
Table of Contents
Overview
This benchmark report shows the Fibonacci GPU benchmark.
NVIDIA L4
Intel(R) Xeon(R) CPU @ 2.20GHz
125.78 GB RAM
Workflow run: https://github.com/lurk-lab/lurk-rs/actions/runs/7465643864
Benchmark Results
LEM Fibonacci Prove - rc = 100
fib-ref=dae844aa2890db7f2d71c897ab4fd3a9d5f1acc0
fib-ref=25426023dfbfc68020a6db99f543a6d2cae69114
num-100
1.73 s
(✅ 1.00x)1.73 s
(✅ 1.00x faster)num-200
3.33 s
(✅ 1.00x)3.32 s
(✅ 1.00x faster)LEM Fibonacci Prove - rc = 600
fib-ref=dae844aa2890db7f2d71c897ab4fd3a9d5f1acc0
fib-ref=25426023dfbfc68020a6db99f543a6d2cae69114
num-100
1.95 s
(✅ 1.00x)1.94 s
(✅ 1.01x faster)num-200
3.34 s
(✅ 1.00x)3.33 s
(✅ 1.00x faster)Made with criterion-table