mirror of https://github.com/zcash/orchard.git
Merge pull request #126 from zcash/proof-verification
Add `Bundle<Authorized, _>::verify_proof` API
This commit is contained in:
commit
93a7f1db22
|
@ -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.
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
//! The Orchard Action circuit implementation.
|
||||
|
||||
use group::Curve;
|
||||
use halo2::{
|
||||
plonk,
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue