Skip to content

Commit

Permalink
Simplify tests (#2161)
Browse files Browse the repository at this point in the history
This PR:
- Changes the RISCV tests to use MockProver + Plonky3 only
- Changes the pipeline std/pil/asm tests to use mostly pilcom/mock, and
sometimes use p3/halo2/estark
- Changes the degree of a couple std/asm tests to be smaller

---------

Co-authored-by: Leandro Pacheco <[email protected]>
Co-authored-by: Georg Wiese <[email protected]>
  • Loading branch information
3 people authored Nov 28, 2024
1 parent dd1842d commit 72632ab
Show file tree
Hide file tree
Showing 22 changed files with 321 additions and 391 deletions.
38 changes: 20 additions & 18 deletions pipeline/src/test_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,40 +47,42 @@ pub fn make_prepared_pipeline<T: FieldElement>(
pipeline
}

/// Tests witness generation, pilcom, halo2, estark and plonky3.
pub fn regular_test(file_name: &str, inputs: &[i32]) {
let inputs_gl = inputs.iter().map(|x| GoldilocksField::from(*x)).collect();
let pipeline_gl = make_prepared_pipeline(file_name, inputs_gl, vec![]);

test_mock_backend(pipeline_gl.clone());
run_pilcom_with_backend_variant(pipeline_gl.clone(), BackendVariant::Composite).unwrap();
gen_estark_proof_with_backend_variant(pipeline_gl.clone(), BackendVariant::Composite);
test_plonky3_pipeline(pipeline_gl);
/// Tests witness generation, mock prover, pilcom and plonky3 with
/// Goldilocks, BabyBear and KoalaBear.
pub fn regular_test_all_fields(file_name: &str, inputs: &[i32]) {
regular_test_gl(file_name, inputs);
regular_test_small_field(file_name, inputs);
}

let inputs_bn = inputs.iter().map(|x| Bn254Field::from(*x)).collect();
let pipeline_bn = make_prepared_pipeline(file_name, inputs_bn, vec![]);
test_halo2_with_backend_variant(pipeline_bn, BackendVariant::Composite);
pub fn regular_test_small_field(file_name: &str, inputs: &[i32]) {
regular_test_bb(file_name, inputs);
regular_test_kb(file_name, inputs);
}

/// Tests witness generation, mock prover, pilcom and plonky3 with BabyBear.
pub fn regular_test_bb(file_name: &str, inputs: &[i32]) {
let inputs_bb = inputs.iter().map(|x| BabyBearField::from(*x)).collect();
let pipeline_bb = make_prepared_pipeline(file_name, inputs_bb, vec![]);
test_mock_backend(pipeline_bb.clone());
test_plonky3_pipeline(pipeline_bb);
}

/// Tests witness generation, mock prover, pilcom and plonky3 with BabyBear and KoalaBear.
pub fn regular_test_kb(file_name: &str, inputs: &[i32]) {
let inputs_kb = inputs.iter().map(|x| KoalaBearField::from(*x)).collect();
let pipeline_kb = make_prepared_pipeline(file_name, inputs_kb, vec![]);
test_mock_backend(pipeline_kb.clone());
test_plonky3_pipeline(pipeline_kb);
}

pub fn regular_test_without_small_field(file_name: &str, inputs: &[i32]) {
/// Tests witness generation, mock prover, pilcom and plonky3 with Goldilocks.
pub fn regular_test_gl(file_name: &str, inputs: &[i32]) {
let inputs_gl = inputs.iter().map(|x| GoldilocksField::from(*x)).collect();
let pipeline_gl = make_prepared_pipeline(file_name, inputs_gl, vec![]);

test_mock_backend(pipeline_gl.clone());
run_pilcom_with_backend_variant(pipeline_gl.clone(), BackendVariant::Composite).unwrap();
gen_estark_proof_with_backend_variant(pipeline_gl, BackendVariant::Composite);

let inputs_bn = inputs.iter().map(|x| Bn254Field::from(*x)).collect();
let pipeline_bn = make_prepared_pipeline(file_name, inputs_bn, vec![]);
test_halo2_with_backend_variant(pipeline_bn, BackendVariant::Composite);
test_plonky3_pipeline(pipeline_gl);
}

pub fn test_pilcom(pipeline: Pipeline<GoldilocksField>) {
Expand Down
Loading

0 comments on commit 72632ab

Please sign in to comment.