diff --git a/pipeline/src/test_util.rs b/pipeline/src/test_util.rs index 9f4c0429f..bbbff59cc 100644 --- a/pipeline/src/test_util.rs +++ b/pipeline/src/test_util.rs @@ -76,7 +76,10 @@ pub fn verify_pipeline( verify(pipeline.output_dir().as_ref().unwrap()) } -pub fn make_pipeline(file_name: &str, inputs: Vec) -> Pipeline { +/// Makes a new pipeline for the given file and inputs. All steps until witness generation are +/// already computed, so that the test can branch off from there, without having to re-compute +/// these steps. +pub fn make_prepared_pipeline(file_name: &str, inputs: Vec) -> Pipeline { let mut pipeline = Pipeline::default() .with_tmp_output() .from_file(resolve_test_file(file_name)) @@ -86,7 +89,7 @@ pub fn make_pipeline(file_name: &str, inputs: Vec) -> Pipeli } pub fn gen_estark_proof(file_name: &str, inputs: Vec) { - let pipeline = make_pipeline(file_name, inputs); + let pipeline = make_prepared_pipeline(file_name, inputs); gen_estark_proof_with_backend_variant(pipeline.clone(), BackendVariant::Monolithic); gen_estark_proof_with_backend_variant(pipeline, BackendVariant::Composite); } @@ -130,7 +133,7 @@ pub fn gen_estark_proof_with_backend_variant( } pub fn test_halo2(file_name: &str, inputs: Vec) { - let pipeline = make_pipeline(file_name, inputs); + let pipeline = make_prepared_pipeline(file_name, inputs); test_halo2_with_backend_variant(pipeline.clone(), BackendVariant::Monolithic); test_halo2_with_backend_variant(pipeline, BackendVariant::Composite); } diff --git a/pipeline/tests/asm.rs b/pipeline/tests/asm.rs index 7aa1bf2a1..66d69592c 100644 --- a/pipeline/tests/asm.rs +++ b/pipeline/tests/asm.rs @@ -2,8 +2,9 @@ use powdr_backend::BackendType; use powdr_number::{Bn254Field, FieldElement, GoldilocksField}; use powdr_pipeline::{ test_util::{ - gen_estark_proof, gen_estark_proof_with_backend_variant, make_pipeline, resolve_test_file, - test_halo2, test_halo2_with_backend_variant, verify_test_file, BackendVariant, + gen_estark_proof, gen_estark_proof_with_backend_variant, make_prepared_pipeline, + resolve_test_file, test_halo2, test_halo2_with_backend_variant, verify_test_file, + BackendVariant, }, util::{read_poly_set, FixedPolySet, WitnessPolySet}, Pipeline, @@ -227,8 +228,11 @@ fn vm_to_block_different_length() { let f = "asm/vm_to_block_different_length.asm"; // Because machines have different lengths, this can only be proven // with a composite proof. - test_halo2_with_backend_variant(make_pipeline(f, vec![]), BackendVariant::Composite); - gen_estark_proof_with_backend_variant(make_pipeline(f, vec![]), BackendVariant::Composite); + test_halo2_with_backend_variant(make_prepared_pipeline(f, vec![]), BackendVariant::Composite); + gen_estark_proof_with_backend_variant( + make_prepared_pipeline(f, vec![]), + BackendVariant::Composite, + ); } #[test] diff --git a/pipeline/tests/pil.rs b/pipeline/tests/pil.rs index f47c22cfd..073739705 100644 --- a/pipeline/tests/pil.rs +++ b/pipeline/tests/pil.rs @@ -5,7 +5,7 @@ use powdr_pipeline::test_util::{ assert_proofs_fail_for_invalid_witnesses, assert_proofs_fail_for_invalid_witnesses_estark, assert_proofs_fail_for_invalid_witnesses_halo2, assert_proofs_fail_for_invalid_witnesses_pilcom, gen_estark_proof, - gen_estark_proof_with_backend_variant, make_pipeline, test_halo2, + gen_estark_proof_with_backend_variant, make_prepared_pipeline, test_halo2, test_halo2_with_backend_variant, test_plonky3, verify_test_file, BackendVariant, }; @@ -313,8 +313,11 @@ fn different_degrees() { let f = "pil/different_degrees.pil"; // Because machines have different lengths, this can only be proven // with a composite proof. - test_halo2_with_backend_variant(make_pipeline(f, vec![]), BackendVariant::Composite); - gen_estark_proof_with_backend_variant(make_pipeline(f, vec![]), BackendVariant::Composite); + test_halo2_with_backend_variant(make_prepared_pipeline(f, vec![]), BackendVariant::Composite); + gen_estark_proof_with_backend_variant( + make_prepared_pipeline(f, vec![]), + BackendVariant::Composite, + ); } #[test] diff --git a/pipeline/tests/powdr_std.rs b/pipeline/tests/powdr_std.rs index 3af1d8baf..f241f5053 100644 --- a/pipeline/tests/powdr_std.rs +++ b/pipeline/tests/powdr_std.rs @@ -6,7 +6,7 @@ use powdr_pil_analyzer::evaluator::Value; use powdr_pipeline::{ test_util::{ evaluate_function, evaluate_integer_function, execute_test_file, gen_estark_proof, - gen_halo2_proof, make_pipeline, resolve_test_file, std_analyzed, test_halo2, + gen_halo2_proof, make_prepared_pipeline, resolve_test_file, std_analyzed, test_halo2, verify_test_file, BackendVariant, }, Pipeline, @@ -21,8 +21,11 @@ fn poseidon_bn254_test() { // `test_halo2` only does a mock proof in the PR tests. // This makes sure we test the whole proof generation for one example // file even in the PR tests. - gen_halo2_proof(make_pipeline(f, vec![]), BackendVariant::Monolithic); - gen_halo2_proof(make_pipeline(f, vec![]), BackendVariant::Composite); + gen_halo2_proof( + make_prepared_pipeline(f, vec![]), + BackendVariant::Monolithic, + ); + gen_halo2_proof(make_prepared_pipeline(f, vec![]), BackendVariant::Composite); } #[test]