use crate::commitment::{ injective_map::{InjectiveMap, PedersenCommCompressor}, pedersen::{ constraints::{CommGadget, ParametersVar, RandomnessVar}, Window, }, }; pub use crate::crh::injective_map::constraints::InjectiveMapGadget; use algebra_core::{Field, PrimeField, ProjectiveCurve}; use r1cs_core::SynthesisError; use r1cs_std::{ groups::{CurveVar, GroupOpsBounds}, uint8::UInt8, }; use core::marker::PhantomData; type ConstraintF = <::BaseField as Field>::BasePrimeField; pub struct CommitmentCompressorGadget where C: ProjectiveCurve, I: InjectiveMap, W: Window, GG: CurveVar>, IG: InjectiveMapGadget, for<'a> &'a GG: GroupOpsBounds<'a, C, GG>, { _compressor: PhantomData, _compressor_gadget: PhantomData, _comm: PhantomData>, } impl crate::commitment::CommitmentGadget, ConstraintF> for CommitmentCompressorGadget where C: ProjectiveCurve, I: InjectiveMap, GG: CurveVar>, ConstraintF: PrimeField, IG: InjectiveMapGadget, W: Window, for<'a> &'a GG: GroupOpsBounds<'a, C, GG>, { type OutputVar = IG::OutputVar; type ParametersVar = ParametersVar; type RandomnessVar = RandomnessVar>; fn commit( parameters: &Self::ParametersVar, input: &[UInt8>], r: &Self::RandomnessVar, ) -> Result { let result = CommGadget::::commit(parameters, input, r)?; IG::evaluate(&result) } }