fix(verify): Only verify halo2 proofs once per transaction (#4752)
* Only verify halo2 proofs once per transaction (rather than once per action) * Update comments on how there is one aggregate Halo2 proof instead of one per Action Co-authored-by: Marek <mail@marek.onl> * cargo +stable fmt --all Co-authored-by: Deirdre Connolly <durumcrustulum@gmail.com> Co-authored-by: Marek <mail@marek.onl>
This commit is contained in:
parent
42ef8846b3
commit
383f83e5d9
|
@ -909,9 +909,6 @@ where
|
||||||
let mut async_checks = AsyncChecks::new();
|
let mut async_checks = AsyncChecks::new();
|
||||||
|
|
||||||
if let Some(orchard_shielded_data) = orchard_shielded_data {
|
if let Some(orchard_shielded_data) = orchard_shielded_data {
|
||||||
for authorized_action in orchard_shielded_data.actions.iter().cloned() {
|
|
||||||
let (action, spend_auth_sig) = authorized_action.into_parts();
|
|
||||||
|
|
||||||
// # Consensus
|
// # Consensus
|
||||||
//
|
//
|
||||||
// > The proof 𝜋 MUST be valid given a primary input (cv, rt^{Orchard},
|
// > The proof 𝜋 MUST be valid given a primary input (cv, rt^{Orchard},
|
||||||
|
@ -919,16 +916,19 @@ where
|
||||||
//
|
//
|
||||||
// https://zips.z.cash/protocol/protocol.pdf#actiondesc
|
// https://zips.z.cash/protocol/protocol.pdf#actiondesc
|
||||||
//
|
//
|
||||||
// Queue the verification of the Halo2 proof for each Action
|
// Unlike Sapling, Orchard shielded transactions have a single
|
||||||
// description while adding the resulting future to our
|
// aggregated Halo2 proof per transaction, even with multiple
|
||||||
// collection of async checks that (at a minimum) must pass for
|
// Actions in one transaction. So we queue it for verification
|
||||||
// the transaction to verify.
|
// only once instead of queuing it up for every Action description.
|
||||||
async_checks.push(
|
async_checks.push(
|
||||||
primitives::halo2::VERIFIER
|
primitives::halo2::VERIFIER
|
||||||
.clone()
|
.clone()
|
||||||
.oneshot(primitives::halo2::Item::from(orchard_shielded_data)),
|
.oneshot(primitives::halo2::Item::from(orchard_shielded_data)),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
for authorized_action in orchard_shielded_data.actions.iter().cloned() {
|
||||||
|
let (action, spend_auth_sig) = authorized_action.into_parts();
|
||||||
|
|
||||||
// # Consensus
|
// # Consensus
|
||||||
//
|
//
|
||||||
// > - Let SigHash be the SIGHASH transaction hash of this transaction, not
|
// > - Let SigHash be the SIGHASH transaction hash of this transaction, not
|
||||||
|
|
Loading…
Reference in New Issue