-
Notifications
You must be signed in to change notification settings - Fork 129
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
Explore the inclusion of &self
as a parameter for Circuit::configure()
#106
Comments
Candidate to be discussed in the Halo2-call/Office hours |
I would like to recover this discussion! I think we can benefit greatly from having runtime configurable circuits; not only for the zkevm project (which will allow removing many generic const) but to have a better split between frontend and backend in halo2 which allows building circuits with new APIs, DSLs and languages. Adding self to configure looks would like this: pub trait Circuit<F: Field> {
/// [...]
fn configure(&self, meta: &mut ConstraintSystem<F>) -> Self::Config;
} This is the approach I took with Plaf to support halo2 backend: https://github.com/Dhole/polyexen/blob/master/src/plaf/backends/halo2.rs Pros:
Alternatives:
pub trait Circuit<F: Field> {
/// [...]
fn configure_with_self(&self, meta: &mut ConstraintSystem<F>) -> Self::Config {
Self::configure(meta)
}
fn configure(meta: &mut ConstraintSystem<F>) -> Self::Config;
}
pub trait Circuit<F: Field> {
/// [...]
type Params: Default;
fn params(&self) -> Self::Params {
Self::Params::default()
}
fn configure_with_params(params: Self::Params, meta: &mut ConstraintSystem<F>) -> Self::Config {
Self::configure(meta)
}
fn configure(meta: &mut ConstraintSystem<F>) -> Self::Config; Please share your thoughts on which option you think is best! It would be nice to agree on one option and introduce it in our fork :D |
I love the second option!!! 👏 I also like a lot the default impl for Could you elaborate a bit more on the insights about why this will help to split halo2 into front and backend? And also on why does it provide so that DSLs are easier/possible to be implemented? |
To use Just note we might also change other APIs like:
Because they don't take |
The interface that halo2 uses for the backend is the Here's an example for Plaf, which uses the Without access to |
…-hk/dev-fix/ipa-verifier-benchmarks Add verifier and decider into the benchmarks
See this thread in halo2/zkevm-circuits: privacy-scaling-explorations/zkevm-circuits#948 (comment)
There is discussed the fact that it's really painful to pass a lot of const-generics or the need to edit the
Config
type to tuples or similar stuff when you're implementing theCircuit
trait simply because it doesn't have&self
as parameter.Would be nice to explore a bit how that would feel and if we encounter any unexpected issues with it.
The text was updated successfully, but these errors were encountered: