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

Circuit::configure() forces you to know the circuit configuration at compile time #771

Open
georgwiese opened this issue Apr 26, 2023 · 1 comment

Comments

@georgwiese
Copy link

The Circuit trait requires me to implement the configure() function, defined as:

    /// The circuit is given an opportunity to describe the exact gate
    /// arrangement, column arrangement, etc.
    fn configure(meta: &mut ConstraintSystem<F>) -> Self::Config;

Because (unlike Circuit::synthesize()) I don't have access to &self here, I must know the configuration at compile time.

What's the reason for that? Is there a way around it?

In my case, I'm writing a tool that proves the inference of an ML model. The exact circuit depends on the model, which is dynamically loaded from a file. I understand the model needs to be available at key generation time, but why must I compile it into the program?

@georgwiese
Copy link
Author

So it turns out that this is fixed in the PSE fork by privacy-scaling-explorations#168: One can activate the circuit-params feature, which adds two functions to the Circuit trait:

    fn params(&self) -> Self::Params;

    fn configure_with_params(
        meta: &mut ConstraintSystem<F>,
        _params: Self::Params,
    ) -> Self::Config:

That way, you can access self indirectly because the prover will do:

let config = ConcreteCircuit::configure_with_params(&mut cs, circuit.params());

This solves the problem for me! However, I'll leave the issue open for now, as this repo doesn't seem to have an equivalent solution.

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

No branches or pull requests

1 participant