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

Extend Circuit trait to take parameters in config #168

Merged
merged 4 commits into from
Apr 20, 2023

Commits on Apr 18, 2023

  1. Extend Circuit trait to take parameters in config

    The Circuit trait is extended with the following:
    ```
    pub trait Circuit<F: Field> {
        /// [...]
        type Params: Default;
    
        fn params(&self) -> Self::Params {
            Self::Params::default()
        }
    
        fn configure_with_params(meta: &mut ConstraintSystem<F>, params: &Self::Params) -> Self::Config {
            Self::configure(meta)
        }
    
        fn configure(meta: &mut ConstraintSystem<F>) -> Self::Config;
    }
    ```
    
    This allows runtime parametrization of the circuit configuration.  The extension to the Circuit trait has been designed to minimize the breaking change: existing circuits only need to define the associated `type Params`.
    
    Unfortunately "Associated type defaults" are unstable in Rust, otherwise this would be a non-breaking change.  See rust-lang/rust#29661
    ed255 committed Apr 18, 2023
    Configuration menu
    Copy the full SHA
    8c5fa2a View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    c6448d4 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    2cb2693 View commit details
    Browse the repository at this point in the history

Commits on Apr 19, 2023

  1. Fix doc test

    ed255 committed Apr 19, 2023
    Configuration menu
    Copy the full SHA
    091cf7c View commit details
    Browse the repository at this point in the history