41 lines
1.4 KiB
Rust
Raw Normal View History

use plonky2::iop::target::{BoolTarget, Target};
2024-12-06 09:12:02 +01:00
use plonky2::iop::witness::PartialWitness;
use plonky2::plonk::circuit_builder::CircuitBuilder;
2025-01-09 10:34:13 +01:00
use plonky2::plonk::circuit_data::CommonCircuitData;
2024-12-06 09:12:02 +01:00
use crate::recursion::params::{F,C,D};
/// InnerCircuit is the trait used to define the logic of the circuit and assign witnesses
/// to that circuit instance.
pub trait InnerCircuit<
// TODO: make it generic for F and D ?
> {
type Targets;
2025-01-09 10:34:13 +01:00
type Input:Clone;
2024-12-06 09:12:02 +01:00
/// build the circuit logic and return targets to be assigned later
fn build(
&self,
2024-12-06 09:12:02 +01:00
builder: &mut CircuitBuilder<F, D>,
) -> anyhow::Result<Self::Targets>;
/// assign the actual witness values for the current instance of the circuit.
fn assign_targets(
&self,
2024-12-06 09:12:02 +01:00
pw: &mut PartialWitness<F>,
targets: &Self::Targets,
input: &Self::Input,
) -> anyhow::Result<()>;
/// from the set of the targets, return only the targets which are public
/// TODO: this can probably be replaced with enum for Public/Private targets
fn get_pub_input_targets(
targets: &Self::Targets,
) -> anyhow::Result<(Vec<Target>)>;
2025-01-09 10:34:13 +01:00
/// from the set of the targets, return only the targets which are public
/// TODO: this can probably be replaced with enum for Public/Private targets
fn get_common_data(
&self
) -> anyhow::Result<(CommonCircuitData<F, D>)>;
2024-12-06 09:12:02 +01:00
}