mirror of https://github.com/zcash/halo2.git
Add accessors necessary for zip-225 write.
This commit is contained in:
parent
e743198a50
commit
a5c9fb953b
|
@ -195,6 +195,16 @@ impl Authorized {
|
|||
binding_signature,
|
||||
}
|
||||
}
|
||||
|
||||
/// Return the proof component of the authorizing data.
|
||||
pub fn proof(&self) -> &Proof {
|
||||
&self.proof
|
||||
}
|
||||
|
||||
/// Return the binding signature.
|
||||
pub fn binding_signature(&self) -> &redpallas::Signature<Binding> {
|
||||
&self.binding_signature
|
||||
}
|
||||
}
|
||||
|
||||
impl Authorization for Authorized {
|
||||
|
|
|
@ -120,6 +120,12 @@ impl Instance {
|
|||
#[derive(Debug)]
|
||||
pub struct Proof(Vec<u8>);
|
||||
|
||||
impl<'a> From<&'a Proof> for &'a Vec<u8> {
|
||||
fn from(proof: &'a Proof) -> &'a Vec<u8> {
|
||||
&proof.0
|
||||
}
|
||||
}
|
||||
|
||||
impl Proof {
|
||||
/// Creates a proof for the given circuits and instances.
|
||||
pub fn create(
|
||||
|
|
|
@ -64,6 +64,11 @@ impl ExtractedNoteCommitment {
|
|||
pub fn from_bytes(bytes: &[u8; 32]) -> CtOption<Self> {
|
||||
pallas::Base::from_bytes(bytes).map(ExtractedNoteCommitment)
|
||||
}
|
||||
|
||||
/// Serialize the value commitment to its canonical byte representation.
|
||||
pub fn to_bytes(&self) -> [u8; 32] {
|
||||
self.0.to_bytes()
|
||||
}
|
||||
}
|
||||
|
||||
impl From<NoteCommitment> for ExtractedNoteCommitment {
|
||||
|
|
|
@ -36,6 +36,11 @@ impl Nullifier {
|
|||
pallas::Base::from_bytes(bytes).map(Nullifier)
|
||||
}
|
||||
|
||||
/// Serialize the nullifier to its canonical byte representation.
|
||||
pub fn to_bytes(&self) -> [u8; 32] {
|
||||
self.0.to_bytes()
|
||||
}
|
||||
|
||||
/// $DeriveNullifier$.
|
||||
///
|
||||
/// Defined in [Zcash Protocol Spec § 4.16: Note Commitments and Nullifiers][commitmentsandnullifiers].
|
||||
|
|
|
@ -102,6 +102,12 @@ impl<T: SigType> From<[u8; 64]> for Signature<T> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<T: SigType> From<&Signature<T>> for [u8; 64] {
|
||||
fn from(sig: &Signature<T>) -> Self {
|
||||
sig.0.into()
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) mod private {
|
||||
use super::{Binding, SpendAuth};
|
||||
|
||||
|
|
|
@ -266,4 +266,9 @@ mod tests {
|
|||
assert_eq!(redpallas::VerificationKey::from(&bsk), bvk);
|
||||
}
|
||||
}
|
||||
|
||||
/// Serialize the value commitment to its canonical byte representation.
|
||||
pub fn to_bytes(&self) -> [u8; 32] {
|
||||
self.0.to_bytes()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue