mirror of
https://github.com/arnaucube/hyperplonk.git
synced 2026-01-10 16:11:29 +01:00
enabling batch opening and mock tests (#80)
- add mock circuits - add vanilla and jellyfish plonk gates - performance tuning
This commit is contained in:
@@ -5,14 +5,14 @@ use displaydoc::Display;
|
||||
|
||||
/// A `enum` specifying the possible failure modes of the Transcript.
|
||||
#[derive(Display, Debug)]
|
||||
pub enum TranscriptErrors {
|
||||
pub enum TranscriptError {
|
||||
/// Invalid Transcript: {0}
|
||||
InvalidTranscript(String),
|
||||
/// An error during (de)serialization: {0}
|
||||
SerializationError(ark_serialize::SerializationError),
|
||||
}
|
||||
|
||||
impl From<ark_serialize::SerializationError> for TranscriptErrors {
|
||||
impl From<ark_serialize::SerializationError> for TranscriptError {
|
||||
fn from(e: ark_serialize::SerializationError) -> Self {
|
||||
Self::SerializationError(e)
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
//! TODO(ZZ): decide which APIs need to be public.
|
||||
|
||||
mod errors;
|
||||
pub use errors::TranscriptErrors;
|
||||
pub use errors::TranscriptError;
|
||||
|
||||
use ark_ff::PrimeField;
|
||||
use ark_serialize::CanonicalSerialize;
|
||||
@@ -44,7 +44,7 @@ impl<F: PrimeField> IOPTranscript<F> {
|
||||
&mut self,
|
||||
label: &'static [u8],
|
||||
msg: &[u8],
|
||||
) -> Result<(), TranscriptErrors> {
|
||||
) -> Result<(), TranscriptError> {
|
||||
self.transcript.append_message(label, msg);
|
||||
self.is_empty = false;
|
||||
Ok(())
|
||||
@@ -55,7 +55,7 @@ impl<F: PrimeField> IOPTranscript<F> {
|
||||
&mut self,
|
||||
label: &'static [u8],
|
||||
field_elem: &F,
|
||||
) -> Result<(), TranscriptErrors> {
|
||||
) -> Result<(), TranscriptError> {
|
||||
self.append_message(label, &to_bytes!(field_elem)?)
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ impl<F: PrimeField> IOPTranscript<F> {
|
||||
&mut self,
|
||||
label: &'static [u8],
|
||||
group_elem: &S,
|
||||
) -> Result<(), TranscriptErrors> {
|
||||
) -> Result<(), TranscriptError> {
|
||||
self.append_message(label, &to_bytes!(group_elem)?)
|
||||
}
|
||||
|
||||
@@ -73,13 +73,10 @@ impl<F: PrimeField> IOPTranscript<F> {
|
||||
//
|
||||
// The output field element is statistical uniform as long
|
||||
// as the field has a size less than 2^384.
|
||||
pub fn get_and_append_challenge(
|
||||
&mut self,
|
||||
label: &'static [u8],
|
||||
) -> Result<F, TranscriptErrors> {
|
||||
pub fn get_and_append_challenge(&mut self, label: &'static [u8]) -> Result<F, TranscriptError> {
|
||||
// we need to reject when transcript is empty
|
||||
if self.is_empty {
|
||||
return Err(TranscriptErrors::InvalidTranscript(
|
||||
return Err(TranscriptError::InvalidTranscript(
|
||||
"transcript is empty".to_string(),
|
||||
));
|
||||
}
|
||||
@@ -100,10 +97,10 @@ impl<F: PrimeField> IOPTranscript<F> {
|
||||
&mut self,
|
||||
label: &'static [u8],
|
||||
len: usize,
|
||||
) -> Result<Vec<F>, TranscriptErrors> {
|
||||
) -> Result<Vec<F>, TranscriptError> {
|
||||
// we need to reject when transcript is empty
|
||||
if self.is_empty {
|
||||
return Err(TranscriptErrors::InvalidTranscript(
|
||||
return Err(TranscriptError::InvalidTranscript(
|
||||
"transcript is empty".to_string(),
|
||||
));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user