Trait darkfi::zk::halo2::plonk::Circuit

pub trait Circuit<F>
where F: Field,
{ type Config: Clone; type FloorPlanner: FloorPlanner; type Params: Default; // Required methods fn without_witnesses(&self) -> Self; fn configure(meta: &mut ConstraintSystem<F>) -> Self::Config; fn synthesize( &self, config: Self::Config, layouter: impl Layouter<F> ) -> Result<(), Error>; // Provided methods fn params(&self) -> Self::Params { ... } fn configure_with_params( meta: &mut ConstraintSystem<F>, _params: Self::Params ) -> Self::Config { ... } }
Expand description

This is a trait that circuits provide implementations for so that the backend prover can ask the circuit to synthesize using some given ConstraintSystem implementation.

Required Associated Types§

type Config: Clone

This is a configuration object that stores things like columns.

type FloorPlanner: FloorPlanner

The floor planner used for this circuit. This is an associated type of the Circuit trait because its behaviour is circuit-critical.

type Params: Default

Optional circuit configuration parameters. Requires the circuit-params feature.

Required Methods§

fn without_witnesses(&self) -> Self

Returns a copy of this circuit with no witness values (i.e. all witnesses set to None). For most circuits, this will be equal to Self::default().

fn configure(meta: &mut ConstraintSystem<F>) -> Self::Config

The circuit is given an opportunity to describe the exact gate arrangement, column arrangement, etc.

fn synthesize( &self, config: Self::Config, layouter: impl Layouter<F> ) -> Result<(), Error>

Given the provided cs, synthesize the circuit. The concrete type of the caller will be different depending on the context, and they may or may not expect to have a witness present.

Provided Methods§

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

Returns a reference to the parameters that should be used to configure the circuit. Requires the circuit-params feature.

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

The circuit is given an opportunity to describe the exact gate arrangement, column arrangement, etc. Takes a runtime parameter. The default implementation calls configure ignoring the _params argument in order to easily support circuits that don’t use configuration parameters.

Object Safety§

This trait is not object safe.

Implementors§