miden_objects/block/
nullifier_witness.rs1use crate::{
2 crypto::merkle::SmtProof,
3 utils::serde::{ByteReader, ByteWriter, Deserializable, DeserializationError, Serializable},
4};
5
6#[derive(Debug, Clone)]
11pub struct NullifierWitness {
12 proof: SmtProof,
13}
14
15impl NullifierWitness {
16 pub fn new(proof: SmtProof) -> Self {
18 Self { proof }
19 }
20
21 pub fn proof(&self) -> &SmtProof {
23 &self.proof
24 }
25
26 pub fn into_proof(self) -> SmtProof {
28 self.proof
29 }
30}
31
32impl Serializable for NullifierWitness {
33 fn write_into<W: ByteWriter>(&self, target: &mut W) {
34 target.write(&self.proof);
35 }
36}
37
38impl Deserializable for NullifierWitness {
39 fn read_from<R: ByteReader>(source: &mut R) -> Result<Self, DeserializationError> {
40 let proof = source.read()?;
41 Ok(Self::new(proof))
42 }
43}