diff --git a/zebra-consensus/src/primitives/groth16/tests.rs b/zebra-consensus/src/primitives/groth16/tests.rs index 145b18c3..929e2c8b 100644 --- a/zebra-consensus/src/primitives/groth16/tests.rs +++ b/zebra-consensus/src/primitives/groth16/tests.rs @@ -61,9 +61,31 @@ where #[tokio::test] async fn verify_sapling_groth16() { - // Since we expect these to pass, we can use the communal verifiers. - let mut spend_verifier = groth16::SPEND_VERIFIER.clone(); - let mut output_verifier = groth16::OUTPUT_VERIFIER.clone(); + // Use separate verifiers so shared batch tasks aren't killed when the test ends (#2390) + let mut spend_verifier = Fallback::new( + 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 .clone() @@ -125,10 +147,9 @@ where } #[tokio::test] -#[should_panic] async fn correctly_err_on_invalid_output_proof() { - // Since we expect these to fail, we don't want to poison the communal - // verifiers. + // Use separate verifiers so shared batch tasks aren't killed when the test ends (#2390). + // Also, since we expect these to fail, we don't want to slow down the communal verifiers. let mut output_verifier = Fallback::new( Batch::new( 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) .await - .unwrap() + .expect_err("unexpected success checking invalid groth16 inputs"); }