mirror of
https://github.com/privacy-scaling-explorations/chiquito.git
synced 2026-01-10 06:28:06 -05:00
Update Debug trait for ast and ir
This commit is contained in:
@@ -3,10 +3,12 @@ use halo2curves::bn256::Fr;
|
||||
|
||||
use chiquito::{
|
||||
ast::ToField,
|
||||
backend::halo2::{chiquito2Halo2, ChiquitoHalo2Circuit},
|
||||
circuit,
|
||||
compiler::{cell_manager::SingleRowCellManager, step_selector::SimpleStepSelectorBuilder},
|
||||
ir::{assignments::AssignmentGenerator, Circuit},
|
||||
plonkish::{
|
||||
backend::halo2::{chiquito2Halo2, ChiquitoHalo2Circuit},
|
||||
compiler::{cell_manager::SingleRowCellManager, step_selector::SimpleStepSelectorBuilder},
|
||||
ir::{assignments::AssignmentGenerator, Circuit},
|
||||
},
|
||||
};
|
||||
|
||||
fn fibo_circuit() -> (Circuit<Fr>, Option<AssignmentGenerator<Fr, ()>>) {
|
||||
@@ -51,8 +53,8 @@ fn fibo_circuit() -> (Circuit<Fr>, Option<AssignmentGenerator<Fr, ()>>) {
|
||||
|
||||
println!("=== AST ===\n{:#?}", fibo);
|
||||
|
||||
chiquito::compiler::compile(
|
||||
chiquito::compiler::config(SingleRowCellManager {}, SimpleStepSelectorBuilder {}),
|
||||
chiquito::plonkish::compiler::compile(
|
||||
chiquito::plonkish::compiler::config(SingleRowCellManager {}, SimpleStepSelectorBuilder {}),
|
||||
&fibo,
|
||||
)
|
||||
}
|
||||
|
||||
@@ -31,9 +31,10 @@ pub struct Circuit<F, TraceArgs> {
|
||||
pub trace: Option<Rc<Trace<F, TraceArgs>>>,
|
||||
pub fixed_gen: Option<Rc<FixedGen<F>>>,
|
||||
|
||||
pub num_steps: usize,
|
||||
|
||||
pub first_step: Option<StepTypeUUID>,
|
||||
pub last_step: Option<StepTypeUUID>,
|
||||
pub num_steps: usize,
|
||||
pub q_enable: bool,
|
||||
|
||||
pub id: UUID,
|
||||
@@ -43,8 +44,16 @@ impl<F: Debug, TraceArgs: Debug> Debug for Circuit<F, TraceArgs> {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
f.debug_struct("Circuit")
|
||||
.field("forward_signals", &self.forward_signals)
|
||||
.field("shared_signals", &self.shared_signals)
|
||||
.field("fixed_signals", &self.fixed_signals)
|
||||
.field("halo2_advice", &self.halo2_advice)
|
||||
.field("halo2_fixed", &self.halo2_fixed)
|
||||
.field("exposed", &self.exposed)
|
||||
.field("step_types", &self.step_types)
|
||||
.field("num_steps", &self.num_steps)
|
||||
.field("first_step", &self.first_step)
|
||||
.field("last_step", &self.last_step)
|
||||
.field("q_enable", &self.q_enable)
|
||||
.field("annotations", &self.annotations)
|
||||
.finish()
|
||||
}
|
||||
@@ -450,7 +459,7 @@ impl FixedSignal {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy)]
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
pub enum ExposeOffset {
|
||||
First,
|
||||
Last,
|
||||
|
||||
@@ -3,7 +3,7 @@ macro_rules! circuit {
|
||||
($id:ident, $content:block) => {{
|
||||
use halo2_proofs::halo2curves::bn256::Fr;
|
||||
|
||||
chiquito::dsl::circuit::<Fr, (), _>(stringify!($id), |ctx| {
|
||||
chiquito::frontend::dsl::circuit::<Fr, (), _>(stringify!($id), |ctx| {
|
||||
use $crate::circuit_context;
|
||||
circuit_context!(ctx);
|
||||
|
||||
@@ -102,11 +102,11 @@ macro_rules! step_type_setup_context {
|
||||
($ctx: expr) => {
|
||||
macro_rules! require {
|
||||
($lhs:expr => $rhs:expr) => {{
|
||||
$ctx.constr($crate::dsl::cb::eq($lhs, $rhs));
|
||||
$ctx.constr($crate::frontend::dsl::cb::eq($lhs, $rhs));
|
||||
}};
|
||||
|
||||
(transition $lhs:expr => $rhs:expr) => {{
|
||||
$ctx.transition($crate::dsl::cb::eq($lhs, $rhs));
|
||||
$ctx.transition($crate::frontend::dsl::cb::eq($lhs, $rhs));
|
||||
}};
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
pub mod ast;
|
||||
pub mod backend;
|
||||
pub mod compiler;
|
||||
#[macro_use]
|
||||
pub mod frontend;
|
||||
pub mod plonkish;
|
||||
|
||||
@@ -12,7 +12,7 @@ use self::assignments::Assignments;
|
||||
pub mod assignments;
|
||||
pub mod sc;
|
||||
|
||||
#[derive(Clone, Default)]
|
||||
#[derive(Debug, Clone, Default)]
|
||||
pub struct Circuit<F> {
|
||||
pub columns: Vec<Column>,
|
||||
pub exposed: Vec<(Column, i32)>,
|
||||
@@ -26,16 +26,6 @@ pub struct Circuit<F> {
|
||||
pub ast_id: UUID,
|
||||
}
|
||||
|
||||
impl<F: Debug> Debug for Circuit<F> {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
f.debug_struct("Circuit")
|
||||
.field("columns", &self.columns)
|
||||
.field("polys", &self.polys)
|
||||
.field("lookups", &self.lookups)
|
||||
.finish()
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Hash)]
|
||||
pub enum ColumnType {
|
||||
Advice,
|
||||
|
||||
Reference in New Issue
Block a user