Skip to content

Commit

Permalink
Save test files for optimized lookup range check
Browse files Browse the repository at this point in the history
  • Loading branch information
ConstanceBeguier committed Jun 21, 2024
1 parent 6cab338 commit 474cfac
Show file tree
Hide file tree
Showing 9 changed files with 25,547 additions and 24 deletions.
15 changes: 9 additions & 6 deletions halo2_gadgets/src/ecc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -955,14 +955,9 @@ pub(crate) mod tests {
}

#[test]
fn fixed_verification_key_test() {
fn test_against_stored_ecc_chip() {
let circuit = MyCircuit { test_errors: false };
test_against_stored_vk(&circuit, "ecc_chip");
}

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

Expand Down Expand Up @@ -1179,6 +1174,14 @@ pub(crate) mod tests {

assert_eq!(prover.verify(), Ok(()))
}

#[test]
fn test_against_stored_ecc_chip_4_5_b() {
let circuit = MyCircuit { test_errors: false };
test_against_stored_vk(&circuit, "ecc_chip_4_5_b");
test_against_stored_proof(circuit, "ecc_chip_4_5_b", 0);
}

#[cfg(feature = "test-dev-graph")]
#[test]
fn print_ecc_chip_4_5_b() {
Expand Down
16 changes: 9 additions & 7 deletions halo2_gadgets/src/sinsemilla.rs
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,6 @@ where
/// for implementing the Sinsemilla hash function and commitment scheme
/// on elliptic curves. This trait is an extension of the `SinsemillaInstructions` trait,
/// designed to enhance performance in specific cryptographic scenarios.ld

pub trait SinsemillaInstructionsOptimized<C: CurveAffine, const K: usize, const MAX_WORDS: usize>:
SinsemillaInstructions<C, K, MAX_WORDS>
{
Expand Down Expand Up @@ -880,14 +879,9 @@ pub(crate) mod tests {
}

#[test]
fn fixed_verification_key_test() {
fn test_against_stored_sinsemilla_chip() {
let circuit = MyCircuit {};
test_against_stored_vk(&circuit, "sinsemilla_chip");
}

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

Expand Down Expand Up @@ -1150,6 +1144,14 @@ pub(crate) mod tests {
assert_eq!(prover.verify(), Ok(()))
}

#[test]
fn test_against_stored_sinsemilla_chip_4_5_b() {
let circuit = MyCircuit45B {};

test_against_stored_vk(&circuit, "sinsemilla_chip_4_5_b");
test_against_stored_proof(circuit, "sinsemilla_chip_4_5_b", 0);
}

#[cfg(feature = "test-dev-graph")]
#[test]
fn print_sinsemilla_chip_4_5_b() {
Expand Down
27 changes: 16 additions & 11 deletions halo2_gadgets/src/sinsemilla/merkle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -394,14 +394,9 @@ pub mod tests {
}

#[test]
fn fixed_verification_key_test() {
fn test_against_stored_merkle_chip() {
let circuit = generate_circuit();
test_against_stored_vk(&circuit, "merkle_chip");
}

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

Expand Down Expand Up @@ -593,8 +588,7 @@ pub mod tests {
}
}

#[test]
fn merkle_chip_4_5_b() {
fn generate_circuit_4_5_b() -> MyCircuit45B {
let mut rng = OsRng;

// Choose a random leaf and position
Expand All @@ -607,17 +601,28 @@ pub mod tests {
.collect();

// The root is provided as a public input in the Orchard circuit.

let circuit = MyCircuit45B {
MyCircuit45B {
leaf: Value::known(leaf),
leaf_pos: Value::known(pos),
merkle_path: Value::known(path.try_into().unwrap()),
};
}
}
#[test]
fn merkle_chip_4_5_b() {
let circuit = generate_circuit_4_5_b();

let prover = MockProver::run(11, &circuit, vec![]).unwrap();
assert_eq!(prover.verify(), Ok(()))
}

#[test]
fn test_against_stored_merkle_chip_4_5_b() {
let circuit = generate_circuit_4_5_b();

test_against_stored_vk(&circuit, "merkle_chip_4_5_b");
test_against_stored_proof(circuit, "merkle_chip_4_5_b", 0);
}

#[cfg(feature = "test-dev-graph")]
#[test]
fn print_merkle_chip_4_5_b() {
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading

0 comments on commit 474cfac

Please sign in to comment.