From 52841ecf6069718c2485ae99a67d9fcf65969fc1 Mon Sep 17 00:00:00 2001 From: Vu Vo Date: Fri, 23 Dec 2022 04:01:29 +0700 Subject: [PATCH] export poseidon hasher chip --- transcript/src/hasher.rs | 10 +++++----- transcript/src/lib.rs | 1 + 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/transcript/src/hasher.rs b/transcript/src/hasher.rs index db2a94c3..1c002081 100644 --- a/transcript/src/hasher.rs +++ b/transcript/src/hasher.rs @@ -11,7 +11,7 @@ pub struct AssignedState(pub(super) [AssignedValue< /// `HasherChip` is basically responsible for contraining permutation part of /// transcript pipeline #[derive(Debug, Clone)] -pub(crate) struct HasherChip< +pub struct HasherChip< F: FieldExt, const NUMBER_OF_LIMBS: usize, const BIT_LEN: usize, @@ -33,7 +33,7 @@ impl< > HasherChip { // Constructs new hasher chip with assigned initial state - pub(crate) fn new( + pub fn new( // TODO: we can remove initial state assingment in construction ctx: &mut RegionCtx<'_, F>, spec: &Spec, @@ -71,7 +71,7 @@ impl< > HasherChip { /// Construct main gate - pub(super) fn main_gate(&self) -> MainGate { + pub fn main_gate(&self) -> MainGate { MainGate::<_>::new(self.main_gate_config.clone()) } @@ -259,7 +259,7 @@ impl< } /// Constrains poseidon permutation while mutating the given state - pub(crate) fn permutation( + pub fn permutation( &mut self, ctx: &mut RegionCtx<'_, F>, inputs: Vec>, @@ -298,7 +298,7 @@ impl< Ok(()) } - pub(crate) fn hash(&mut self, ctx: &mut RegionCtx<'_, F>) -> Result, Error> { + pub fn hash(&mut self, ctx: &mut RegionCtx<'_, F>) -> Result, Error> { // Get elements to be hashed let input_elements = self.absorbing.clone(); // Flush the input que diff --git a/transcript/src/lib.rs b/transcript/src/lib.rs index 9c9158d6..10aed407 100644 --- a/transcript/src/lib.rs +++ b/transcript/src/lib.rs @@ -4,6 +4,7 @@ mod transcript; pub use ecc; pub use ecc::halo2; pub use ecc::maingate; +pub use hasher::HasherChip; pub use crate::transcript::*;