zebra_chain/primitives/proofs/
halo2.rsuse serde::{Deserialize, Serialize};
use std::{fmt, io};
use crate::serialization::{
zcash_serialize_bytes, SerializationError, ZcashDeserialize, ZcashSerialize,
};
#[derive(Clone, Eq, PartialEq, Serialize, Deserialize)]
pub struct Halo2Proof(pub Vec<u8>);
impl fmt::Debug for Halo2Proof {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.debug_tuple("Halo2Proof")
.field(&hex::encode(&self.0[..]))
.finish()
}
}
impl ZcashSerialize for Halo2Proof {
fn zcash_serialize<W: io::Write>(&self, writer: W) -> Result<(), io::Error> {
zcash_serialize_bytes(&self.0, writer)
}
}
impl ZcashDeserialize for Halo2Proof {
fn zcash_deserialize<R: io::Read>(mut reader: R) -> Result<Self, SerializationError> {
let proof = Vec::zcash_deserialize(&mut reader)?;
Ok(Self(proof))
}
}
#[cfg(any(test, feature = "proptest-impl"))]
use proptest::prelude::*;
#[cfg(any(test, feature = "proptest-impl"))]
impl Arbitrary for Halo2Proof {
type Parameters = ();
fn arbitrary_with(_args: Self::Parameters) -> Self::Strategy {
(any::<Vec<u8>>()).prop_map(Self).boxed()
}
type Strategy = BoxedStrategy<Self>;
}