Browse Source

remove unused where (#38)

main
Srinath Setty 2 years ago
committed by GitHub
parent
commit
fd0b0b787b
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 30 deletions
  1. +7
    -20
      src/circuit.rs
  2. +1
    -7
      src/gadgets/r1cs.rs
  3. +3
    -3
      src/traits.rs

+ 7
- 20
src/circuit.rs

@ -26,7 +26,7 @@ use bellperson::{
},
Circuit, ConstraintSystem, SynthesisError,
};
use ff::{Field, PrimeField, PrimeFieldBits};
use ff::Field;
#[derive(Debug, Clone)]
pub struct NIFSVerifierCircuitParams {
@ -44,10 +44,7 @@ impl NIFSVerifierCircuitParams {
}
}
pub struct NIFSVerifierCircuitInputs<G>
where
G: Group,
{
pub struct NIFSVerifierCircuitInputs<G: Group> {
params: G::Base, // Hash(Shape of u2, Gens for u2). Needed for computing the challenge.
i: G::Base,
z0: G::Base,
@ -85,10 +82,9 @@ where
}
/// Circuit that encodes only the folding verifier
pub struct NIFSVerifierCircuit<G, SC>
pub struct NIFSVerifierCircuit<G: Group, SC>
where
G: Group,
<G as Group>::Base: ff::PrimeField,
SC: StepCircuit<G::Base>,
{
params: NIFSVerifierCircuitParams,
@ -100,8 +96,6 @@ where
impl<G, SC> NIFSVerifierCircuit<G, SC>
where
G: Group,
<G as Group>::Base: PrimeField + PrimeFieldBits,
<G as Group>::Scalar: PrimeField + PrimeFieldBits,
SC: StepCircuit<G::Base>,
{
/// Create a new verification circuit for the input relaxed r1cs instances
@ -111,10 +105,7 @@ where
inputs: Option<NIFSVerifierCircuitInputs<G>>,
step_circuit: SC,
poseidon_constants: NovaPoseidonConstants<G::Base>,
) -> Self
where
<G as Group>::Base: ff::PrimeField,
{
) -> Self {
Self {
params,
inputs,
@ -243,8 +234,6 @@ where
impl<G, SC> Circuit<<G as Group>::Base> for NIFSVerifierCircuit<G, SC>
where
G: Group,
<G as Group>::Base: PrimeField + PrimeFieldBits,
<G as Group>::Scalar: PrimeFieldBits,
SC: StepCircuit<G::Base>,
{
fn synthesize<CS: ConstraintSystem<<G as Group>::Base>>(
@ -347,18 +336,16 @@ mod tests {
bellperson::r1cs::{NovaShape, NovaWitness},
commitments::CommitTrait,
};
use ff::PrimeField;
use std::marker::PhantomData;
struct TestCircuit<F>
where
F: PrimeField + ff::PrimeField,
{
struct TestCircuit<F: PrimeField> {
_p: PhantomData<F>,
}
impl<F> StepCircuit<F> for TestCircuit<F>
where
F: PrimeField + ff::PrimeField,
F: PrimeField,
{
fn synthesize<CS: ConstraintSystem<F>>(
&self,

+ 1
- 7
src/gadgets/r1cs.rs

@ -18,7 +18,7 @@ use bellperson_nonnative::{
mp::bignat::BigNat,
util::{convert::f_to_nat, num::Num},
};
use ff::{Field, PrimeField, PrimeFieldBits};
use ff::Field;
/// An Allocated R1CS Instance
#[derive(Clone)]
@ -34,8 +34,6 @@ where
impl<G> AllocatedR1CSInstance<G>
where
G: Group,
<G as Group>::Base: PrimeField + PrimeFieldBits,
<G as Group>::Scalar: PrimeFieldBits,
{
/// Takes the r1cs instance and creates a new allocated r1cs instance
pub fn alloc<CS: ConstraintSystem<<G as Group>::Base>>(
@ -74,8 +72,6 @@ where
pub struct AllocatedRelaxedR1CSInstance<G>
where
G: Group,
<G as Group>::Base: PrimeField + PrimeFieldBits,
<G as Group>::Scalar: PrimeFieldBits,
{
pub(crate) W: AllocatedPoint<G::Base>,
pub(crate) E: AllocatedPoint<G::Base>,
@ -87,8 +83,6 @@ where
impl<G> AllocatedRelaxedR1CSInstance<G>
where
G: Group,
<G as Group>::Base: PrimeField + PrimeFieldBits,
<G as Group>::Scalar: PrimeFieldBits,
{
/// Allocates the given RelaxedR1CSInstance as a witness of the circuit
pub fn alloc<CS: ConstraintSystem<<G as Group>::Base>>(

+ 3
- 3
src/traits.rs

@ -5,7 +5,7 @@ use core::{
fmt::Debug,
ops::{Add, AddAssign, Mul, MulAssign, Sub, SubAssign},
};
use ff::PrimeField;
use ff::{PrimeField, PrimeFieldBits};
use merlin::Transcript;
use rug::Integer;
@ -22,10 +22,10 @@ pub trait Group:
+ ScalarMulOwned<<Self as Group>::Scalar>
{
/// A type representing an element of the base field of the group
type Base: PrimeField;
type Base: PrimeField + PrimeFieldBits;
/// A type representing an element of the scalar field of the group
type Scalar: PrimeField + ChallengeTrait;
type Scalar: PrimeField + PrimeFieldBits + ChallengeTrait;
/// A type representing the compressed version of the group element
type CompressedGroupElement: CompressedGroup<GroupElement = Self>;

Loading…
Cancel
Save