Skip to content

Commit

Permalink
add test for backward compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
YaoGalteland committed Mar 24, 2024
1 parent 1440a36 commit 0187cad
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions halo2_gadgets/src/utilities/lookup_range_check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -507,14 +507,13 @@ mod tests {
dev::{FailureLocation, MockProver, VerifyFailure},
plonk::{Circuit, ConstraintSystem, Error},
};
use pasta_curves::{pallas, vesta};

use pasta_curves::pallas;
use std::{convert::TryInto, marker::PhantomData};

Check warning on line 511 in halo2_gadgets/src/utilities/lookup_range_check.rs

View workflow job for this annotation

GitHub Actions / Clippy (beta)

the item `TryInto` is imported redundantly

warning: the item `TryInto` is imported redundantly --> halo2_gadgets/src/utilities/lookup_range_check.rs:511:15 | 511 | use std::{convert::TryInto, marker::PhantomData}; | ^^^^^^^^^^^^^^^^ --> /rustc/277d06bc95c6c38a2337ccde798b2c709384bd84/library/std/src/prelude/mod.rs:129:13 | = note: the item `TryInto` is already defined here

// test backward compatibility
// if enable_backward_compatibility = true, test the old version
// if enable_backward_compatibility = false, test the new version with extended lookup table
pub const enable_backward_compatibility: bool = false;
// if ENABLE_BACKWARD_COMPATIBILITY = true, test the old version
// if ENABLE_BACKWARD_COMPATIBILITY = false, test the new version with extended lookup table
pub const ENABLE_BACKWARD_COMPATIBILITY: bool = false;

#[test]
fn lookup_range_check() {
Expand All @@ -539,7 +538,7 @@ mod tests {
let constants = meta.fixed_column();
meta.enable_constant(constants);

let table_range_check_tag_option = if enable_backward_compatibility {
let table_range_check_tag_option = if ENABLE_BACKWARD_COMPATIBILITY {
None
} else {
Some(table_range_check_tag)
Expand Down Expand Up @@ -650,7 +649,7 @@ mod tests {
let constants = meta.fixed_column();
meta.enable_constant(constants);

let table_range_check_tag_option = if enable_backward_compatibility {
let table_range_check_tag_option = if ENABLE_BACKWARD_COMPATIBILITY {
None
} else {
Some(table_range_check_tag)
Expand Down Expand Up @@ -797,7 +796,7 @@ mod tests {
assert_eq!(prover.verify(), Ok(()));
}

if !enable_backward_compatibility {
if !ENABLE_BACKWARD_COMPATIBILITY {
// Element larger than 5 bits
let circuit: MyCircuit<pallas::Base> = MyCircuit {
element: Value::known(pallas::Base::from(1 << 5)),
Expand Down

0 comments on commit 0187cad

Please sign in to comment.