diff --git a/src/interpreter/mod.rs b/src/interpreter/mod.rs index 0643c941..e6177239 100644 --- a/src/interpreter/mod.rs +++ b/src/interpreter/mod.rs @@ -326,8 +326,11 @@ fn get_block_stmts(stmt: &Statement) -> Vec(code, Config::default(), &DebugSymRefFactory::new("", code)) + .unwrap(); + + let plonkish = chiquito.plonkish(config( + SingleRowCellManager {}, + SimpleStepSelectorBuilder {}, + )); + + let compiled = chiquito2Halo2(plonkish.circuit); + + let circuit = ChiquitoHalo2Circuit::new( + compiled, + plonkish + .assignment_generator + .map(|g| g.generate(HashMap::from([("n".to_string(), Fr::from(12))]))), + ); + + let prover = MockProver::::run(10, &circuit, circuit.instance()).unwrap(); + + let result = prover.verify(); + + assert!(result.is_ok()); + } + + #[test] + fn test_run_halo2_middleware_prover() { let code = " machine fibo(signal n) (signal b: field) { // n and be are created automatically as shared diff --git a/src/parser/ast/mod.rs b/src/parser/ast/mod.rs index 9a855436..c64e2665 100644 --- a/src/parser/ast/mod.rs +++ b/src/parser/ast/mod.rs @@ -142,7 +142,14 @@ impl PartialEq for DebugSymRef { } #[derive(Clone, PartialEq, Eq)] -pub struct Identifier(pub String, pub i32, pub DebugSymRef); +pub struct Identifier( + /// Name + pub String, + /// Rotation + pub i32, + /// Debug symbol reference + pub DebugSymRef, +); impl Identifier { pub(crate) fn new>(value: S, dsym: DebugSymRef) -> Self { let value_str = value.as_ref(); @@ -153,6 +160,7 @@ impl Identifier { self.2.clone() } + /// Increase the rotation by one pub(crate) fn next(&self) -> Self { Self(self.0.clone(), self.1 + 1, self.2.clone()) } diff --git a/src/plonkish/compiler/mod.rs b/src/plonkish/compiler/mod.rs index 5646728f..2e062764 100644 --- a/src/plonkish/compiler/mod.rs +++ b/src/plonkish/compiler/mod.rs @@ -5,7 +5,9 @@ use crate::{ Circuit, Column, Poly, PolyExpr, PolyLookup, }, poly::Expr, - sbpir::{query::Queriable, ExposeOffset, StepType, StepTypeUUID, PIR, SBPIRLegacy as astCircuit}, + sbpir::{ + query::Queriable, ExposeOffset, SBPIRLegacy as astCircuit, StepType, StepTypeUUID, PIR, + }, wit_gen::{AutoTraceGenerator, FixedAssignment, TraceGenerator}, }; use std::hash::Hash;