Commit Graph

22 Commits

Author SHA1 Message Date
François Garillot
82ca5fe66b Benchmark computation commitments (#201)
* 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
2023-07-12 15:13:45 -07:00
Srinath Setty
e76e6bc0f8 Reorganize various Spartan SNARKs and make the direct interface more generic (#195)
* reorganize different variants of spartan and make direct snark more generic

* cargo fmt
2023-07-06 19:51:00 -07:00
François Garillot
905ec2d5a1 Add a Sha256 bench (#188)
* add sha256 bench

* feat: Refactor sha256 benchmark and update dependencies

- Refactored the `sha256.rs` benchmarking file by replacing the former `hex_literal::hex` usage with a newly created `decode_hex` function.
- Updated the "Test vectors" section to work with the new `decode_hex` function to compute digests in `Sha256Circuit` instances.
- adapted to new APIs for RecursiveSNARK
- Amended the `Cargo.toml` file to include the `sha2` package dependency, version `0.10.7`.
- added the bench target

* cargo fmt

---------

Co-authored-by: Srinath Setty <srinath@microsoft.com>
2023-06-28 16:18:07 -07:00
François Garillot
1e6bf942e2 [refactorings] Leftovers (pot-pourri?) (#184)
* test: compute_path

* refactor: path computation

- Improve path concatenation by utilizing built-in `join` method

* refactor: replace `PartialEq` with derived instance

- Derive `PartialEq` for `SatisfyingAssignment` struct
- Remove redundant manual implementation of `PartialEq`

Cargo-expand generates:
```
        #[automatically_derived]
        impl<G: ::core::cmp::PartialEq + Group> ::core::cmp::PartialEq
        for SatisfyingAssignment<G>
        where
            G::Scalar: PrimeField,
            G::Scalar: ::core::cmp::PartialEq,
            G::Scalar: ::core::cmp::PartialEq,
            G::Scalar: ::core::cmp::PartialEq,
            G::Scalar: ::core::cmp::PartialEq,
            G::Scalar: ::core::cmp::PartialEq,
        {
            #[inline]
            fn eq(&self, other: &SatisfyingAssignment<G>) -> bool {
                self.a_aux_density == other.a_aux_density
                    && self.b_input_density == other.b_input_density
                    && self.b_aux_density == other.b_aux_density && self.a == other.a
                    && self.b == other.b && self.c == other.c
                    && self.input_assignment == other.input_assignment
                    && self.aux_assignment == other.aux_assignment
            }
        }
```

* refactor: avoid default for PhantomData Unit type

* refactor: replace fold with sum where applicable

- Simplify code by replacing `fold` with `sum` in various instances

* refactor: decompression method in sumcheck.rs

* refactor: test functions to use slice instead of vector conversion

* refactor: use more references in functions

- Update parameter types to use references instead of owned values in various functions that do not need them
- Replace cloning instances with references
2023-06-19 16:11:42 -07:00
François Garillot
ff0370f506 Add the ability to profile the benchmarks w/ a flamegraph feature (#183)
* feat: Integrate flamegraph profiling in benchmarks

- Introduce "flamegraph" feature flag for optional profiling integration
- Add benchmark profiling support in `compressed_snark` and `recursive_snark` groups
- Update Cargo.toml with `pprof` and `cfg-if` dependencies

* ci: Build benches to make sure they don't bit-rot

- Integrate bench build step into GitHub Actions workflow
2023-06-19 15:52:39 -07:00
Chiro Hiro
af886d6ce7 Improve performance of recursive (#163)
* Improve performance of recursive

* Fix the test after rebase

* Fix CI/CD warnings

* Update benchmark to work with new interface of RecursiveSNARK

* Fix example to make sure step 1 is correct

* refactor: Removes unneeded pass-by value in verification

- Update function arguments to use borrowing instead of passing ownership

* Resolve the conflict with upstream branch

* refactor: Avoid extra input cloning in RecursiveSNARK::new

* Update criterion to 0.5.1 to prevent the panic with its plot

* Fix benchmark issue with new recursive_snark instance

* Fix CI/CD warning with

* refactor: Make mutation easier to observe

- Utilize mutable references to Points for better memory management

* chore: Downgrade clippy dependency for compatibility

---------

Co-authored-by: François Garillot <francois@garillot.net>
2023-06-19 12:52:57 -07:00
François Garillot
031738de51 Remove Zlib compression in public parameter computation (#182)
* test: add test for pp computation

* bench: add a digest computation bench

* refactor: Optimize digest computation and update tests

- Remove flate2 dependency from codebase
- Replace ZlibEncoder with bincode::serialize in compute_digest function
- Update test_pp_digest expected results to align with compute_digest changes

Bench results:
```
compute_digest          time:   [1.4451 s 1.4571 s 1.4689 s]
                        change: [-29.357% -27.854% -26.573%] (p = 0.00 < 0.05)
                        Performance has improved.
```
2023-06-12 16:46:02 -07:00
Srinath Setty
3b3ae70db3 A more optimal preprocessing SNARK (#158)
* a more optimal preprocessing SNARK

* update version

* cleanup; address clippy
2023-03-31 18:54:32 -07:00
Srinath Setty
7b1bb44e45 spark-based commitments to R1CS matrices (#152)
* spark-based commitments to R1CS matrices

* small fixes
2023-03-20 18:16:06 -07:00
Srinath Setty
1e4995274b Separate prover and verifier keys in CompressedSNARK (#145)
* checkpoint

* simplify further

* checkpoint

* gens --> ck

* update benches

* address clippy

* cleanup

* update version
2023-03-02 18:36:13 -08:00
Srinath Setty
603c1e2a85 traits for a vector commitment engine and a polynomial evaluation engine (#136)
make spartan generic over the evaluation engine

update version

disable Wasm CI check
2023-02-02 16:21:24 -08:00
Samuel Burnham
b2adab610a Clippy formatting (#131)
* Clippy with Rust 1.67

* Clippy/Rustfmt with Rust 1.66.1
2023-01-31 14:53:15 -08:00
Srinath Setty
d2844089ba update benches (#111) 2022-08-23 15:31:37 -07:00
Srinath Setty
ccc6ccd4c7 Support for arbitrary arity for step circuit's IO (#107)
* support for arbitrary arity for F

* revive MinRoot example

* revive tests

* revive ecdsa

* remove unused code

* use None instead of Some(1u32)

* revive benches

* fix clippy warning
2022-08-16 11:35:17 -07:00
Srinath Setty
3dc26fd7e4 Simplifications in Nova's RO (#98)
* rename methods for better clarity

* rename

* Bump version
2022-07-25 12:22:41 -07:00
Srinath Setty
c6fa4d44eb Fix benches so it varies the number of constraints in the augmented circuit in powers of 2 (#97)
* vary the number of constraints in the step circuit

* use a different starting state
2022-07-21 15:00:01 -07:00
Srinath Setty
5d5b9aa244 Fix bench name (#95)
* fix name

* Add 14
2022-07-20 16:05:43 -07:00
Srinath Setty
7d54d992a4 update benches (#94) 2022-07-20 14:31:24 -07:00
Srinath Setty
35cb03f977 reorganize traits into a module; cut boilerplate code (#91)
use a default implementation for step circuit
2022-07-14 16:15:45 -07:00
Srinath Setty
63f08c0e4a Support non-determinism with a minimal API (#85)
* support non-determinism with small changes to the interface

* update benches to use the new API

* add an example that exercises non-deterministic advice at each step of recursion

* tiny rename

* Address clippy; update version
2022-07-07 12:17:56 -07:00
Srinath Setty
0ff2e57bfa Spartan variant with an IPA-based polynomial commitment scheme for compressing IVC proofs (#80)
* cleanup code

* compiles

* additional plumbing

* add padding

* Add missing file

* integrate

* add a separate test

* cleanup

* cleanup

* add checks for outer sum-check

* sum-checks pass

* sum-checks pass

* sum-checks pass

* Add polycommit checks to the end

* switch to pasta_msm

* clippy

* remove int_log

* switch to pasta_curves

* clippy

* clippy

* add a special case for bases.len() = 1

* use naive MSM to avoid SIGFE error for smaller MSMs

* add rayon parallelism to naive MSM

* update comment since we already implement it

* address clippy

* cleanup map and reduce code

* add parallelism to final SNARK creation and verification

* add par

* add par

* add par

* add par

* store padded shapes in the parameters

* Address clippy

* pass padded shape in params

* pass padded shape in params

* cargo fmt

* add par

* add par

* Add par

* cleanup with a reorg

* factor out spartan-based snark into a separate module

* create traits for RelaxedR1CSSNARK

* make CompressedSNARK parameterized by a SNARK satisfying our new trait

* fix benches

* cleanup code

* remove unused

* move code to Spartan-based SNARK

* make unused function private

* rename IPA types for clarity

* cleanup

* return error types; rename r_j to r_i

* fix duplicate code
2022-07-01 15:53:00 -07:00
iontzialla
81b12232fe Add benches (#79)
* add benches

* fix error

* put snark in a black_box when benchmarking verification time

* fix error in benches
2022-06-14 12:32:44 -07:00