Add `orchard::circuit::Instance::from_parts()`

This commit is contained in:
Deirdre Connolly 2021-11-03 23:15:27 -04:00 committed by Deirdre Connolly
parent 4f9c0be42e
commit e51e92e848
1 changed files with 21 additions and 0 deletions

View File

@ -817,6 +817,27 @@ pub struct Instance {
}
impl Instance {
/// Constructs an [`Instance`] from its constituent parts
pub fn from_parts(
anchor: Anchor,
cv_net: ValueCommitment,
nf_old: Nullifier,
rk: VerificationKey<SpendAuth>,
cmx: ExtractedNoteCommitment,
enable_spend: bool,
enable_output: bool,
) -> Self {
Instance {
anchor,
cv_net,
nf_old,
rk,
cmx,
enable_spend,
enable_output,
}
}
fn to_halo2_instance(&self) -> [[vesta::Scalar; 9]; 1] {
let mut instance = [vesta::Scalar::zero(); 9];