Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove constraint system trait from constrained program type #59

Closed
collinc97 opened this issue Jun 15, 2020 · 0 comments · Fixed by #60
Closed

Remove constraint system trait from constrained program type #59

collinc97 opened this issue Jun 15, 2020 · 0 comments · Fixed by #60
Assignees

Comments

@collinc97
Copy link
Collaborator

Overview

Currently ConstraintSystem is a parameter for ConstrainedProgram. ConstraintSystem is used in some but not all methods and is not used by ConstrainedProgram directly. This should be changed so that ConstraintSystem is only passed into methods that need it.

The current ConstrainedProgram struct:

pub struct ConstrainedProgram<F: Field + PrimeField, G: GroupType<F>, CS: ConstraintSystem<F>> {
    pub identifiers: HashMap<String, ConstrainedValue<F, G>>,
    pub _cs: PhantomData<CS>,
}

The new struct:

pub struct ConstrainedProgram<F: Field + PrimeField, G: GroupType<F>> {
    pub identifiers: HashMap<String, ConstrainedValue<F, G>>,
}

The current enforce_add_expression() method:

fn enforce_add_expression(
        &mut self,
        cs: &mut CS,
        left: ConstrainedValue<F, G>,
        right: ConstrainedValue<F, G>,
    ) -> Result<ConstrainedValue<F, G>, ExpressionError>

The new method:

fn enforce_add_expression<CS: ConstraintSystem<F>>(
        &mut self,
        cs: &mut CS,
        left: ConstrainedValue<F, G>,
        right: ConstrainedValue<F, G>,
    ) -> Result<ConstrainedValue<F, G>, ExpressionError>
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant