use crate::{
errors::SpartanError,
traits::{Engine, Group},
};
pub trait TranscriptReprTrait<G: Group>: Send + Sync {
fn to_transcript_bytes(&self) -> Vec<u8>;
}
pub trait TranscriptEngineTrait<E: Engine>: Send + Sync {
fn new(label: &'static [u8]) -> Self;
fn squeeze(&mut self, label: &'static [u8]) -> Result<E::Scalar, SpartanError>;
fn absorb<T: TranscriptReprTrait<E::GE>>(&mut self, label: &'static [u8], o: &T);
fn dom_sep(&mut self, bytes: &'static [u8]);
}
impl<G: Group, T: TranscriptReprTrait<G>> TranscriptReprTrait<G> for &[T] {
fn to_transcript_bytes(&self) -> Vec<u8> {
self
.iter()
.flat_map(|t| t.to_transcript_bytes())
.collect::<Vec<u8>>()
}
}