Fix intermittent errors in the groth16 verifier tests (#2412)
This commit is contained in:
parent
9cb7ee4d0e
commit
9d2d8c8215
|
|
@ -61,9 +61,31 @@ where
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn verify_sapling_groth16() {
|
async fn verify_sapling_groth16() {
|
||||||
// Since we expect these to pass, we can use the communal verifiers.
|
// Use separate verifiers so shared batch tasks aren't killed when the test ends (#2390)
|
||||||
let mut spend_verifier = groth16::SPEND_VERIFIER.clone();
|
let mut spend_verifier = Fallback::new(
|
||||||
let mut output_verifier = groth16::OUTPUT_VERIFIER.clone();
|
Batch::new(
|
||||||
|
Verifier::new(&PARAMS.sapling.spend.vk),
|
||||||
|
crate::primitives::MAX_BATCH_SIZE,
|
||||||
|
crate::primitives::MAX_BATCH_LATENCY,
|
||||||
|
),
|
||||||
|
tower::service_fn(
|
||||||
|
(|item: Item| {
|
||||||
|
ready(item.verify_single(&prepare_verifying_key(&PARAMS.sapling.spend.vk)))
|
||||||
|
}) as fn(_) -> _,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
let mut output_verifier = Fallback::new(
|
||||||
|
Batch::new(
|
||||||
|
Verifier::new(&PARAMS.sapling.output.vk),
|
||||||
|
crate::primitives::MAX_BATCH_SIZE,
|
||||||
|
crate::primitives::MAX_BATCH_LATENCY,
|
||||||
|
),
|
||||||
|
tower::service_fn(
|
||||||
|
(|item: Item| {
|
||||||
|
ready(item.verify_single(&prepare_verifying_key(&PARAMS.sapling.output.vk)))
|
||||||
|
}) as fn(_) -> _,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
let transactions = zebra_test::vectors::MAINNET_BLOCKS
|
let transactions = zebra_test::vectors::MAINNET_BLOCKS
|
||||||
.clone()
|
.clone()
|
||||||
|
|
@ -125,10 +147,9 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
#[should_panic]
|
|
||||||
async fn correctly_err_on_invalid_output_proof() {
|
async fn correctly_err_on_invalid_output_proof() {
|
||||||
// Since we expect these to fail, we don't want to poison the communal
|
// Use separate verifiers so shared batch tasks aren't killed when the test ends (#2390).
|
||||||
// verifiers.
|
// Also, since we expect these to fail, we don't want to slow down the communal verifiers.
|
||||||
let mut output_verifier = Fallback::new(
|
let mut output_verifier = Fallback::new(
|
||||||
Batch::new(
|
Batch::new(
|
||||||
Verifier::new(&PARAMS.sapling.output.vk),
|
Verifier::new(&PARAMS.sapling.output.vk),
|
||||||
|
|
@ -149,5 +170,5 @@ async fn correctly_err_on_invalid_output_proof() {
|
||||||
|
|
||||||
verify_invalid_groth16_output_description(&mut output_verifier, block.transactions)
|
verify_invalid_groth16_output_description(&mut output_verifier, block.transactions)
|
||||||
.await
|
.await
|
||||||
.unwrap()
|
.expect_err("unexpected success checking invalid groth16 inputs");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue