Commit Graph

22 Commits

Author SHA1 Message Date
François Garillot
4b077bcab1 Add Grumpkin cycle implementation (#181)
* bn256+grumpkin from halo2curves

* chore: Integrate halo2curves more extensively

- Extend existing tests with additional test cases using the new curve types

* fix: Assign correct orders to bn256 and grumpkin scalar fields

- Swap scalar orders between grumpkin and bn256 in `impl_traits!` implementation

* test: Finish improving test integration with halo2curves

- Enhances test coverage for `pasta_curves` and `halo2curves`
- Cleans up commented code in `test_ivc_nontrivial` and `test_ivc_nontrivial_with_compression` tests
- Updates relevant test cases in `src/lib.rs` to include new curve tests

* chore: Remove commented-out/uneeded code in bn254_grumpkin.rs

* test: reproduce test_from_label for bn254_grumpkin

- Implement the `from_label_serial` function in bn254_grumpkin provider
- Add a test to compare parallel and serial implementations of `from_label` function

* refactor: Clean up to_coordinate & summarize changes

* refactor: rename bn254_grumpkin -> bn256_grumpkin

* test: Expand testing for public params digest using bn256 and grumpkin

* chore: Update halo2curves dependency in Cargo.toml

- Updated the `halo2curves` dependency in `Cargo.toml` to the latest version `0.1.0` from a specific git branch.

* refactor: Refactor multi-exponentiation methods across providers

- Updated bn256_grumpkin.rs to use the cpu_best_multiexp function from pasta provider instead of its native function.
- Modified visibility of cpu_best_multiexp function in pasta.rs from private to crate level.

* chore: set up dependencies to import the correct getrandom feature on Wasm

---------

Co-authored-by: Leo Alt <leo@ethereum.org>
2023-07-05 16:10:05 -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
54f758eef3 [test-only] More genericity in tests (#171)
* refactor: make circuit tests generic wrt curves

- Improve modularity by introducing generic `test_recursive_circuit_with` function in `src/circuit.rs`
- Refactor `test_recursive_circuit` to utilize the new function
- Implement type constraints for `test_recursive_circuit_with` function

* refactor: make bellperson tests generic in type of group

- Introduce `test_alloc_bit_with` function utilizing generic types
- Adapt existing `test_alloc_bit` function to use the new `test_alloc_bit_with` function with correct types

* refactor: make the nifs test generic in the type of group

* refactor: make the ivc tests generic in the type of curve

* refactor: simplify generics in tests

* make the keccak tests generic

* make the poseidon tests generic

* make the spartan tests generic
2023-05-26 13:43:35 -07:00
Samuel Burnham
cddd707fad chore: update to ff/group 0.13 (#166)
* chore: update to ff/group 0.13 and associated dependencies

Updates:
- zkcrypto/ff, zkcrypto/group to 0.13,
- bellperson to 0.25,
- pasta_curves to 0.5.1, and removes the fil_pasta_curves fork
- pasta-msm should no longer need a fork (WIP)

Adapts source in function, mostly for const usage and API updates.

* expose the portable feature of pasta-MSM

* update pointer to pasta-msm

* Clippy

---------

Co-authored-by: François Garillot <francois@garillot.net>
2023-05-10 12:15:17 -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
b97786d291 move IPA-specific methods to the provider (#138) 2023-02-06 18:07:14 -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
23178ff54d A simplified version of the nonnative gadgets (#122) 2023-01-18 09:40:54 -08:00
Srinath Setty
6044aff625 Update crate versions (#119)
* update crate versions

* fix clippy issues

* cargo fmt
2022-11-21 10:42:11 -08:00
Srinath Setty
a56f823ace optimize the non-native arithmetic and hashing costs by using 4 limbs instead of 8 (#102) 2022-07-27 17:09:49 -07:00
Srinath Setty
e373f4633d edits to address clippy with the latest Rust (#90) 2022-07-13 14:46:13 -07:00
Srinath Setty
0863a732ff Add asserts for constraint count (#83)
* Add asserts for constraint count

* switch to Standard strength
2022-07-05 14:50:17 -07:00
Srinath Setty
c29030b2d7 Release Candidate (#82)
* update version and README

* move tests to bellperson adapter and remove tests folder; make bellperson adapter private
2022-07-01 16:03:19 -07:00
Srinath Setty
9a44d06aec PrimeField --> ff::PrimeField (#28)
* PrimeField --> ff::PrimeField

* cargo fmt
2022-04-14 07:48:55 -07:00
Srinath Setty
c20da2f58c Cleanup (#27)
* VerificationCircuit --> NIFSVerifierCircuit, for clarity

* InnerCircuit --> StepCircuit

* Rename

* cleanup imports

* additional cleanup in the test

* small cleanup
2022-04-13 17:29:48 -07:00
porcuquine
648eb0bb6e Fix CS::one() bug in solver. (#24)
* Test and fix solver CS::one() bug.

* Remove unused linear-combination evaluations.

* rustfmt

* Clippy.

Co-authored-by: porcuquine <porcuquine@users.noreply.github.com>
2022-04-08 06:30:52 -07:00
porcuquine
338fbff9ac Add missing doc comments. 2021-10-20 10:19:20 -07:00
Srinath Setty
8027bcf056 cargo fmt 2021-10-20 10:19:20 -07:00
Srinath Setty
ff885c4d5d fix bellperson path; address minor clippy-suggested edit 2021-10-20 10:19:20 -07:00
porcuquine
efb73ef325 Rename Prover and ProvingAssignment. 2021-10-20 10:19:20 -07:00
porcuquine
3b668e7ac6 Add support for using bellperson to generate R1CS. 2021-10-20 10:19:20 -07:00