use std::fmt::Debug;
use snarkvm_algorithms::traits::CommitmentScheme;
use snarkvm_fields::Field;
use snarkvm_r1cs::{errors::SynthesisError, ConstraintSystem};
use crate::{
bits::ToBytesGadget,
integers::uint::UInt8,
traits::{
alloc::AllocGadget,
eq::{ConditionalEqGadget, EqGadget},
select::CondSelectGadget,
},
ToBitsBEGadget,
};
pub trait CommitmentGadget<C: CommitmentScheme, F: Field>: AllocGadget<C, F> + Clone + Sized {
type OutputGadget: ConditionalEqGadget<F>
+ CondSelectGadget<F>
+ EqGadget<F>
+ ToBytesGadget<F>
+ ToBitsBEGadget<F>
+ AllocGadget<C::Output, F>
+ Clone
+ Sized
+ Debug;
type RandomnessGadget: AllocGadget<C::Randomness, F> + ToBytesGadget<F> + Clone;
fn randomness_from_bytes<CS: ConstraintSystem<F>>(
cs: CS,
bytes: &[UInt8],
) -> Result<Self::RandomnessGadget, SynthesisError>;
fn check_commitment_gadget<CS: ConstraintSystem<F>>(
&self,
cs: CS,
input: &[UInt8],
r: &Self::RandomnessGadget,
) -> Result<Self::OutputGadget, SynthesisError>;
}