Skip to content

Commit

Permalink
fix(exm): rm Circuit impl
Browse files Browse the repository at this point in the history
- Incorrect associated type was used
- The original impl on Circuit is now unnecessary
  • Loading branch information
cyphersnake committed Oct 10, 2023
1 parent 2458cc7 commit 26962ff
Showing 1 changed file with 8 additions and 35 deletions.
43 changes: 8 additions & 35 deletions examples/sha256/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ use std::iter;
use ff::PrimeField;
use halo2_gadgets::sha256::BLOCK_SIZE;
use halo2_proofs::{
circuit::{AssignedCell, Layouter, SimpleFloorPlanner, Value},
plonk::{Circuit, ConstraintSystem, Error},
circuit::{AssignedCell, Layouter, Value},
plonk::ConstraintSystem,
};

use halo2curves::pasta::pallas;
Expand Down Expand Up @@ -249,30 +249,9 @@ pub mod sha256 {

pub use sha256::{BlockWord, Sha256, Table16Chip, Table16Config};

#[derive(Default)]
#[derive(Default, Debug)]
struct TestSha256Circuit {}

impl Circuit<pallas::Base> for TestSha256Circuit {
type Config = Table16Config;
type FloorPlanner = SimpleFloorPlanner;

fn without_witnesses(&self) -> Self {
Self::default()
}

fn configure(meta: &mut ConstraintSystem<pallas::Base>) -> Self::Config {
Table16Chip::configure(meta)
}

fn synthesize(
&self,
_config: Self::Config,
_layouter: impl Layouter<pallas::Base>,
) -> Result<(), Error> {
todo!()
}
}

type B = pallas::Base;
// TODO
const ARITY: usize = BLOCK_SIZE / 2;
Expand All @@ -286,7 +265,7 @@ impl StepCircuit<ARITY, B> for TestSha256Circuit {

fn synthesize(
&self,
config: Self::Config,
config: Self::StepConfig,
layouter: &mut impl Layouter<B>,
z_in: &[AssignedCell<B, B>; ARITY],
) -> Result<[AssignedCell<B, B>; ARITY], SynthesisError> {
Expand Down Expand Up @@ -318,14 +297,8 @@ impl StepCircuit<ARITY, B> for TestSha256Circuit {
}

fn main() {
use halo2_proofs::dev::MockProver;

const K: u32 = 17;

let prover = match MockProver::run(K, &TestSha256Circuit {}, vec![]) {
Ok(prover) => prover,
Err(err) => panic!("{err:#?}"),
};

assert_eq!(prover.verify(), Ok(()));
todo!(
"Waiting for IVC Circuit for test {:?}",
TestSha256Circuit {}
);
}

0 comments on commit 26962ff

Please sign in to comment.