-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
156 additions
and
3 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
crates/zkwasm/src/circuits/post_image_table/continuation/mod.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
use halo2_proofs::arithmetic::FieldExt; | ||
use halo2_proofs::circuit::Cell; | ||
use halo2_proofs::circuit::Layouter; | ||
use halo2_proofs::plonk::Error; | ||
|
||
use crate::circuits::image_table::ImageTableChip; | ||
use crate::circuits::image_table::ImageTableConfig; | ||
use crate::circuits::image_table::ImageTableLayouter; | ||
|
||
use super::PostImageTableChipTrait; | ||
use super::PostImageTableConfigTrait; | ||
|
||
#[derive(Clone)] | ||
pub(in crate::circuits) struct ContinuationPostImageTableConfig<F: FieldExt> { | ||
config: ImageTableConfig<F>, | ||
} | ||
|
||
impl<F: FieldExt> PostImageTableConfigTrait<F> for ContinuationPostImageTableConfig<F> { | ||
fn configure(meta: &mut halo2_proofs::plonk::ConstraintSystem<F>) -> Self { | ||
Self { | ||
config: ImageTableConfig::configure(meta), | ||
} | ||
} | ||
} | ||
|
||
pub(in crate::circuits) struct ContinuationPostImageTableChip<F: FieldExt> { | ||
chip: ImageTableChip<F>, | ||
} | ||
|
||
impl<F: FieldExt> PostImageTableChipTrait<F, ContinuationPostImageTableConfig<F>> | ||
for ContinuationPostImageTableChip<F> | ||
{ | ||
fn new(config: ContinuationPostImageTableConfig<F>) -> Self { | ||
Self { | ||
chip: ImageTableChip::new(config.config), | ||
} | ||
} | ||
|
||
fn assign( | ||
self, | ||
layouter: &mut impl Layouter<F>, | ||
image_table: ImageTableLayouter<F>, | ||
permutation_cells: ImageTableLayouter<Cell>, | ||
) -> Result<(), Error> { | ||
self.chip.assign(layouter, image_table, permutation_cells) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
use halo2_proofs::arithmetic::FieldExt; | ||
use halo2_proofs::circuit::Cell; | ||
use halo2_proofs::circuit::Layouter; | ||
use halo2_proofs::plonk::ConstraintSystem; | ||
use halo2_proofs::plonk::Error; | ||
|
||
use super::image_table::ImageTableLayouter; | ||
|
||
pub(self) mod continuation; | ||
pub(self) mod trivial; | ||
|
||
pub(in crate::circuits) trait PostImageTableConfigTrait<F: FieldExt> { | ||
fn configure(_meta: &mut ConstraintSystem<F>) -> Self; | ||
} | ||
|
||
pub(in crate::circuits) trait PostImageTableChipTrait< | ||
F: FieldExt, | ||
Config: PostImageTableConfigTrait<F>, | ||
> | ||
{ | ||
fn new(config: Config) -> Self; | ||
fn assign( | ||
self, | ||
layouter: &mut impl Layouter<F>, | ||
image_table: ImageTableLayouter<F>, | ||
permutation_cells: ImageTableLayouter<Cell>, | ||
) -> Result<(), Error>; | ||
} | ||
|
||
cfg_if::cfg_if! { | ||
if #[cfg(feature = "continuation")] { | ||
use self::continuation::*; | ||
|
||
pub(in crate::circuits) type PostImageTableConfig<F> = ContinuationPostImageTableConfig<F>; | ||
pub(in crate::circuits) type PostImageTableChip<F> = ContinuationPostImageTableChip<F>; | ||
|
||
} else { | ||
use self::trivial::*; | ||
|
||
pub(in crate::circuits) type PostImageTableConfig<F> = TrivialPostImageTableConfig<F>; | ||
pub(in crate::circuits) type PostImageTableChip<F> = TrivialPostImageTableChip<F>; | ||
} | ||
} |
43 changes: 43 additions & 0 deletions
43
crates/zkwasm/src/circuits/post_image_table/trivial/mod.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
use std::marker::PhantomData; | ||
|
||
use halo2_proofs::arithmetic::FieldExt; | ||
use halo2_proofs::circuit::Cell; | ||
use halo2_proofs::circuit::Layouter; | ||
use halo2_proofs::plonk::Error; | ||
|
||
use crate::circuits::image_table::ImageTableLayouter; | ||
|
||
use super::PostImageTableChipTrait; | ||
use super::PostImageTableConfigTrait; | ||
|
||
#[derive(Clone)] | ||
pub(in crate::circuits) struct TrivialPostImageTableConfig<F: FieldExt> { | ||
_mark: PhantomData<F>, | ||
} | ||
|
||
impl<F: FieldExt> PostImageTableConfigTrait<F> for TrivialPostImageTableConfig<F> { | ||
fn configure(_meta: &mut halo2_proofs::plonk::ConstraintSystem<F>) -> Self { | ||
Self { _mark: PhantomData } | ||
} | ||
} | ||
|
||
pub(in crate::circuits) struct TrivialPostImageTableChip<F: FieldExt> { | ||
_mark: PhantomData<F>, | ||
} | ||
|
||
impl<F: FieldExt> PostImageTableChipTrait<F, TrivialPostImageTableConfig<F>> | ||
for TrivialPostImageTableChip<F> | ||
{ | ||
fn new(_config: TrivialPostImageTableConfig<F>) -> Self { | ||
Self { _mark: PhantomData } | ||
} | ||
|
||
fn assign( | ||
self, | ||
layouter: &mut impl Layouter<F>, | ||
image_table: ImageTableLayouter<F>, | ||
permutation_cells: ImageTableLayouter<Cell>, | ||
) -> Result<(), Error> { | ||
Ok(()) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters