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