Skip to content

Commit

Permalink
Move circuit test data to tests/circuit_reference_data folder, fix na…
Browse files Browse the repository at this point in the history
…mes of the test data files to follow the same convention: .proof.bin for proof tests, .vk.txt for verifying key/layout tests
  • Loading branch information
dmidem committed May 15, 2024
1 parent 3324348 commit 92922be
Show file tree
Hide file tree
Showing 19 changed files with 19 additions and 17 deletions.
4 changes: 2 additions & 2 deletions halo2_gadgets/src/ecc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -914,13 +914,13 @@ pub(crate) mod tests {
#[test]
fn fixed_verification_key_test() {
let circuit = MyCircuit { test_errors: false };
fixed_verification_key_test_with_circuit(&circuit, "vk_ecc_chip_0");
fixed_verification_key_test_with_circuit(&circuit, "ecc_chip");
}

#[test]
fn serialized_proof_test_case() {
let circuit = MyCircuit { test_errors: false };
serialized_proof_test_case_with_circuit(circuit, "circuit_proof_test_case_ecc");
serialized_proof_test_case_with_circuit(circuit, "ecc_chip");
}

#[cfg(feature = "test-dev-graph")]
Expand Down
4 changes: 2 additions & 2 deletions halo2_gadgets/src/sinsemilla.rs
Original file line number Diff line number Diff line change
Expand Up @@ -747,13 +747,13 @@ pub(crate) mod tests {
#[test]
fn fixed_verification_key_test() {
let circuit = MyCircuit {};
fixed_verification_key_test_with_circuit(&circuit, "vk_sinsemilla_chip_0");
fixed_verification_key_test_with_circuit(&circuit, "sinsemilla_chip");
}

#[test]
fn serialized_proof_test_case() {
let circuit = MyCircuit {};
serialized_proof_test_case_with_circuit(circuit, "circuit_proof_test_case_sinsemilla");
serialized_proof_test_case_with_circuit(circuit, "sinsemilla_chip");
}

#[cfg(feature = "test-dev-graph")]
Expand Down
4 changes: 2 additions & 2 deletions halo2_gadgets/src/sinsemilla/merkle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -393,13 +393,13 @@ pub mod tests {
#[test]
fn fixed_verification_key_test() {
let circuit = generate_circuit();
fixed_verification_key_test_with_circuit(&circuit, "vk_merkle_chip_0");
fixed_verification_key_test_with_circuit(&circuit, "merkle_chip");
}

#[test]
fn serialized_proof_test_case() {
let circuit = generate_circuit();
serialized_proof_test_case_with_circuit(circuit, "circuit_proof_test_case_merkle");
serialized_proof_test_case_with_circuit(circuit, "merkle_chip");
}

#[cfg(feature = "test-dev-graph")]
Expand Down
File renamed without changes.
File renamed without changes.
8 changes: 5 additions & 3 deletions halo2_gadgets/src/tests/test_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use halo2_proofs::{
transcript::{Blake2bRead, Blake2bWrite},
};

const TEST_DATA_DIR: &str = "src/tests";
const TEST_DATA_DIR: &str = "src/tests/circuit_reference_data";

/// A proof structure
#[derive(Clone, Debug)]
Expand Down Expand Up @@ -70,7 +70,9 @@ pub(crate) fn fixed_verification_key_test_with_circuit<C: Circuit<pallas::Base>>
circuit: &C,
file_name: &str,
) {
let full_file_name = Path::new(TEST_DATA_DIR).join(file_name);
let full_file_name = Path::new(TEST_DATA_DIR)
.join(file_name)
.with_extension("vk.txt");

// Setup phase: generate parameters, vk for the circuit.
let params: Params<Affine> = Params::new(11);
Expand Down Expand Up @@ -114,7 +116,7 @@ pub(crate) fn serialized_proof_test_case_with_circuit<C: Circuit<pallas::Base>>(
) {
let full_file_name = Path::new(TEST_DATA_DIR)
.join(file_name)
.with_extension("bin");
.with_extension("proof.bin");

// Setup phase: generate parameters, vk for the circuit.
let params: Params<Affine> = Params::new(11);
Expand Down
16 changes: 8 additions & 8 deletions halo2_gadgets/src/utilities/lookup_range_check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -574,11 +574,11 @@ mod tests {
let prover = MockProver::<pallas::Base>::run(11, &circuit, vec![]).unwrap();
assert_eq!(prover.verify(), Ok(()));

fixed_verification_key_test_with_circuit(&circuit, "vk_lookup_range_check_0");
fixed_verification_key_test_with_circuit(&circuit, "lookup_range_check");

serialized_proof_test_case_with_circuit(
circuit,
"circuit_proof_test_case_lookup_range_check",
"lookup_range_check",
);
}
}
Expand Down Expand Up @@ -639,11 +639,11 @@ mod tests {
let prover = MockProver::<pallas::Base>::run(11, &circuit, vec![]).unwrap();
assert_eq!(prover.verify(), Ok(()));

fixed_verification_key_test_with_circuit(&circuit, "vk_short_range_check_0");
fixed_verification_key_test_with_circuit(&circuit, "short_range_check_0");

serialized_proof_test_case_with_circuit(
circuit,
"circuit_proof_test_case_short_range_check_0",
"short_range_check_0",
);
}

Expand All @@ -656,11 +656,11 @@ mod tests {
let prover = MockProver::<pallas::Base>::run(11, &circuit, vec![]).unwrap();
assert_eq!(prover.verify(), Ok(()));

fixed_verification_key_test_with_circuit(&circuit, "vk_short_range_check_1");
fixed_verification_key_test_with_circuit(&circuit, "short_range_check_1");

serialized_proof_test_case_with_circuit(
circuit,
"circuit_proof_test_case_short_range_check_1",
"short_range_check_1",
);
}

Expand All @@ -673,11 +673,11 @@ mod tests {
let prover = MockProver::<pallas::Base>::run(11, &circuit, vec![]).unwrap();
assert_eq!(prover.verify(), Ok(()));

fixed_verification_key_test_with_circuit(&circuit, "vk_short_range_check_2");
fixed_verification_key_test_with_circuit(&circuit, "short_range_check_2");

serialized_proof_test_case_with_circuit(
circuit,
"circuit_proof_test_case_short_range_check_2",
"short_range_check_2",
);
}

Expand Down

0 comments on commit 92922be

Please sign in to comment.