[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
This commit is contained in:
François Garillot
2023-06-19 19:11:42 -04:00
committed by GitHub
parent ff0370f506
commit 1e6bf942e2
15 changed files with 110 additions and 124 deletions

View File

@@ -938,8 +938,8 @@ mod tests {
let res = recursive_snark.verify(
&pp,
num_steps,
&vec![<G1 as Group>::Scalar::ZERO][..],
&vec![<G2 as Group>::Scalar::ZERO][..],
&[<G1 as Group>::Scalar::ZERO],
&[<G2 as Group>::Scalar::ZERO],
);
assert!(res.is_ok());
}
@@ -997,8 +997,8 @@ mod tests {
let res = recursive_snark.verify(
&pp,
i + 1,
&vec![<G1 as Group>::Scalar::ONE][..],
&vec![<G2 as Group>::Scalar::ZERO][..],
&[<G1 as Group>::Scalar::ONE],
&[<G2 as Group>::Scalar::ZERO],
);
assert!(res.is_ok());
}
@@ -1007,8 +1007,8 @@ mod tests {
let res = recursive_snark.verify(
&pp,
num_steps,
&vec![<G1 as Group>::Scalar::ONE][..],
&vec![<G2 as Group>::Scalar::ZERO][..],
&[<G1 as Group>::Scalar::ONE],
&[<G2 as Group>::Scalar::ZERO],
);
assert!(res.is_ok());
@@ -1084,8 +1084,8 @@ mod tests {
let res = recursive_snark.verify(
&pp,
num_steps,
&vec![<G1 as Group>::Scalar::ONE][..],
&vec![<G2 as Group>::Scalar::ZERO][..],
&[<G1 as Group>::Scalar::ONE],
&[<G2 as Group>::Scalar::ZERO],
);
assert!(res.is_ok());
@@ -1178,8 +1178,8 @@ mod tests {
let res = recursive_snark.verify(
&pp,
num_steps,
&vec![<G1 as Group>::Scalar::ONE][..],
&vec![<G2 as Group>::Scalar::ZERO][..],
&[<G1 as Group>::Scalar::ONE],
&[<G2 as Group>::Scalar::ZERO],
);
assert!(res.is_ok());
@@ -1426,8 +1426,8 @@ mod tests {
let res = recursive_snark.verify(
&pp,
num_steps,
&vec![<G1 as Group>::Scalar::ONE][..],
&vec![<G2 as Group>::Scalar::ZERO][..],
&[<G1 as Group>::Scalar::ONE],
&[<G2 as Group>::Scalar::ZERO],
);
assert!(res.is_ok());