1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
use crate::base_dpc::BaseDPCComponents;
use snarkvm_algorithms::traits::{CommitmentScheme, CRH};
use snarkvm_fields::{ConstraintFieldError, ToConstraintField};
pub struct PrivateProgramInput {
pub verification_key: Vec<u8>,
pub proof: Vec<u8>,
}
impl Clone for PrivateProgramInput {
fn clone(&self) -> Self {
Self {
verification_key: self.verification_key.clone(),
proof: self.proof.clone(),
}
}
}
pub struct ProgramLocalData<C: BaseDPCComponents> {
pub local_data_commitment_parameters: <C::LocalDataCommitment as CommitmentScheme>::Parameters,
pub local_data_root: <C::LocalDataCRH as CRH>::Output,
pub position: u8,
}
impl<C: BaseDPCComponents> ToConstraintField<C::InnerField> for ProgramLocalData<C>
where
<C::LocalDataCommitment as CommitmentScheme>::Parameters: ToConstraintField<C::InnerField>,
<C::LocalDataCRH as CRH>::Output: ToConstraintField<C::InnerField>,
{
fn to_field_elements(&self) -> Result<Vec<C::InnerField>, ConstraintFieldError> {
let mut v = ToConstraintField::<C::InnerField>::to_field_elements(&[self.position][..])?;
v.extend_from_slice(&self.local_data_commitment_parameters.to_field_elements()?);
v.extend_from_slice(&self.local_data_root.to_field_elements()?);
Ok(v)
}
}