Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions src/bellperson/r1cs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,7 @@ pub trait NovaShape<G: Group> {
fn r1cs_shape(&self) -> (R1CSShape<G>, CommitmentKey<G>);
}

impl<G: Group> NovaWitness<G> for SatisfyingAssignment<G>
where
G::Scalar: PrimeField,
{
impl<G: Group> NovaWitness<G> for SatisfyingAssignment<G> {
fn r1cs_instance_and_witness(
&self,
shape: &R1CSShape<G>,
Expand All @@ -48,10 +45,7 @@ where
}
}

impl<G: Group> NovaShape<G> for ShapeCS<G>
where
G::Scalar: PrimeField,
{
impl<G: Group> NovaShape<G> for ShapeCS<G> {
fn r1cs_shape(&self) -> (R1CSShape<G>, CommitmentKey<G>) {
let mut A: Vec<(usize, usize, G::Scalar)> = Vec::new();
let mut B: Vec<(usize, usize, G::Scalar)> = Vec::new();
Expand Down
20 changes: 4 additions & 16 deletions src/bellperson/shape_cs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,7 @@ impl Ord for OrderedVariable {

#[allow(clippy::upper_case_acronyms)]
/// `ShapeCS` is a `ConstraintSystem` for creating `R1CSShape`s for a circuit.
pub struct ShapeCS<G: Group>
where
G::Scalar: PrimeField + Field,
{
pub struct ShapeCS<G: Group> {
named_objects: HashMap<String, NamedObject>,
current_namespace: Vec<String>,
#[allow(clippy::type_complexity)]
Expand Down Expand Up @@ -92,10 +89,7 @@ fn proc_lc<Scalar: PrimeField>(
map
}

impl<G: Group> ShapeCS<G>
where
G::Scalar: PrimeField,
{
impl<G: Group> ShapeCS<G> {
/// Create a new, default `ShapeCS`,
pub fn new() -> Self {
ShapeCS::default()
Expand Down Expand Up @@ -216,10 +210,7 @@ where
}
}

impl<G: Group> Default for ShapeCS<G>
where
G::Scalar: PrimeField,
{
impl<G: Group> Default for ShapeCS<G> {
fn default() -> Self {
let mut map = HashMap::new();
map.insert("ONE".into(), NamedObject::Var(ShapeCS::<G>::one()));
Expand All @@ -233,10 +224,7 @@ where
}
}

impl<G: Group> ConstraintSystem<G::Scalar> for ShapeCS<G>
where
G::Scalar: PrimeField,
{
impl<G: Group> ConstraintSystem<G::Scalar> for ShapeCS<G> {
type Root = Self;

fn alloc<F, A, AR>(&mut self, annotation: A, _f: F) -> Result<Variable, SynthesisError>
Expand Down
17 changes: 4 additions & 13 deletions src/bellperson/solver.rs
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
//! Support for generating R1CS witness using bellperson.

use crate::traits::Group;
use ff::{Field, PrimeField};
use ff::Field;

use bellperson::{
multiexp::DensityTracker, ConstraintSystem, Index, LinearCombination, SynthesisError, Variable,
};

/// A `ConstraintSystem` which calculates witness values for a concrete instance of an R1CS circuit.
#[derive(PartialEq)]
pub struct SatisfyingAssignment<G: Group>
where
G::Scalar: PrimeField,
{
pub struct SatisfyingAssignment<G: Group> {
// Density of queries
a_aux_density: DensityTracker,
b_input_density: DensityTracker,
Expand All @@ -29,10 +26,7 @@ where
}
use std::fmt;

impl<G: Group> fmt::Debug for SatisfyingAssignment<G>
where
G::Scalar: PrimeField,
{
impl<G: Group> fmt::Debug for SatisfyingAssignment<G> {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt
.debug_struct("SatisfyingAssignment")
Expand Down Expand Up @@ -69,10 +63,7 @@ where
}
}

impl<G: Group> ConstraintSystem<G::Scalar> for SatisfyingAssignment<G>
where
G::Scalar: PrimeField,
{
impl<G: Group> ConstraintSystem<G::Scalar> for SatisfyingAssignment<G> {
type Root = Self;

fn new() -> Self {
Expand Down
3 changes: 1 addition & 2 deletions src/traits/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ pub trait Group:
+ for<'de> Deserialize<'de>;

/// A type representing an element of the scalar field of the group
type Scalar: PrimeField
+ PrimeFieldBits
type Scalar: PrimeFieldBits
+ PrimeFieldExt
+ Send
+ Sync
Expand Down