Add `Bundle<Authorized, _>::verify_proof` API

This commit is contained in:
Jack Grigg 2021-06-21 13:38:43 +01:00
parent 3543bab39d
commit 62642fd804
3 changed files with 18 additions and 2 deletions

View File

@ -3,7 +3,7 @@
use nonempty::NonEmpty;
use crate::{
circuit::{Instance, Proof},
circuit::{Instance, Proof, VerifyingKey},
note::{ExtractedNoteCommitment, Nullifier, TransmittedNoteCiphertext},
primitives::redpallas::{self, Binding, SpendAuth},
tree::Anchor,
@ -298,6 +298,13 @@ impl<T: Authorization, V> Bundle<T, V> {
authorization: step(context, authorization)?,
})
}
pub(crate) fn to_instances(&self) -> Vec<Instance> {
self.actions
.iter()
.map(|a| a.to_instance(self.flags, self.anchor))
.collect()
}
}
impl<T: Authorization, V: Copy + Into<ValueSum>> Bundle<T, V> {
@ -354,6 +361,13 @@ impl<V> Bundle<Authorized, V> {
pub fn authorizing_commitment(&self) -> BundleAuthorizingCommitment {
todo!()
}
/// Verifies the proof for this bundle.
pub fn verify_proof(&self, vk: &VerifyingKey) -> Result<(), halo2::plonk::Error> {
self.authorization()
.proof()
.verify(vk, &self.to_instances())
}
}
/// A commitment to a bundle of actions.

View File

@ -1,3 +1,5 @@
//! The Orchard Action circuit implementation.
use group::Curve;
use halo2::{
plonk,

View File

@ -19,7 +19,7 @@
mod address;
pub mod builder;
pub mod bundle;
mod circuit;
pub mod circuit;
mod constants;
pub mod keys;
pub mod note;