Enable V5 transaction test vectors in the groth16 tests (#2383)

This also simplifies the code.
This commit is contained in:
teor 2021-06-24 16:28:23 +10:00 committed by GitHub
parent 1b6688f139
commit 5bce941e70
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 31 additions and 52 deletions

View File

@ -25,17 +25,10 @@ where
let mut async_checks = FuturesUnordered::new(); let mut async_checks = FuturesUnordered::new();
for tx in transactions { for tx in transactions {
match &*tx { let spends = tx.sapling_spends_per_anchor();
Transaction::V1 { .. } let outputs = tx.sapling_outputs();
| Transaction::V2 { .. }
| Transaction::V3 { .. } for spend in spends {
| Transaction::V5 { .. } => (),
Transaction::V4 {
sapling_shielded_data,
..
} => {
if let Some(sapling_shielded_data) = sapling_shielded_data {
for spend in sapling_shielded_data.spends_per_anchor() {
tracing::trace!(?spend); tracing::trace!(?spend);
let spend_rsp = spend_verifier let spend_rsp = spend_verifier
@ -46,7 +39,7 @@ where
async_checks.push(spend_rsp); async_checks.push(spend_rsp);
} }
for output in sapling_shielded_data.outputs() { for output in outputs {
tracing::trace!(?output); tracing::trace!(?output);
let output_rsp = output_verifier let output_rsp = output_verifier
@ -56,9 +49,6 @@ where
async_checks.push(output_rsp); async_checks.push(output_rsp);
} }
}
}
}
while let Some(result) = async_checks.next().await { while let Some(result) = async_checks.next().await {
tracing::trace!(?result); tracing::trace!(?result);
@ -108,17 +98,9 @@ where
let mut async_checks = FuturesUnordered::new(); let mut async_checks = FuturesUnordered::new();
for tx in transactions { for tx in transactions {
match &*tx { let outputs = tx.sapling_outputs();
Transaction::V1 { .. }
| Transaction::V2 { .. } for output in outputs {
| Transaction::V3 { .. }
| Transaction::V5 { .. } => (),
Transaction::V4 {
sapling_shielded_data,
..
} => {
if let Some(sapling_shielded_data) = sapling_shielded_data {
for output in sapling_shielded_data.outputs() {
// This changes the primary inputs to the proof // This changes the primary inputs to the proof
// verification, causing it to fail for this proof. // verification, causing it to fail for this proof.
let mut modified_output = output.clone(); let mut modified_output = output.clone();
@ -133,9 +115,6 @@ where
async_checks.push(output_rsp); async_checks.push(output_rsp);
} }
}
}
}
while let Some(result) = async_checks.next().await { while let Some(result) = async_checks.next().await {
result?; result?;