Use MockProver::FailureLocation in gadget unit tests.

This was introduced in halo2#433.
This commit is contained in:
therealyingtong 2022-01-05 15:02:21 +08:00
parent 5b26c7d67a
commit d4d167c216
3 changed files with 35 additions and 11 deletions

View File

@ -373,7 +373,7 @@ pub mod tests {
use crate::circuit::gadget::{ecc::chip::EccConfig, utilities::UtilitiesInstructions};
use halo2::{
circuit::{Layouter, SimpleFloorPlanner},
dev::{MockProver, VerifyFailure},
dev::{FailureLocation, MockProver, VerifyFailure},
plonk::{Circuit, ConstraintSystem, Error},
};
@ -531,7 +531,10 @@ pub mod tests {
"last_window_check"
)
.into(),
row: 26,
location: FailureLocation::InRegion {
region: (3, "Short fixed-base mul (most significant word)").into(),
offset: 1,
},
cell_values: vec![(
((Any::Advice, 5).into(), 0).into(),
format_value(circuit.magnitude_error.unwrap()),
@ -574,7 +577,10 @@ pub mod tests {
VerifyFailure::ConstraintNotSatisfied {
constraint: ((17, "Short fixed-base mul gate").into(), 1, "sign_check")
.into(),
row: 26,
location: FailureLocation::InRegion {
region: (3, "Short fixed-base mul (most significant word)").into(),
offset: 1,
},
cell_values: vec![(((Any::Advice, 4).into(), 0).into(), "0".to_string())],
},
VerifyFailure::ConstraintNotSatisfied {
@ -584,7 +590,10 @@ pub mod tests {
"negation_check"
)
.into(),
row: 26,
location: FailureLocation::InRegion {
region: (3, "Short fixed-base mul (most significant word)").into(),
offset: 1,
},
cell_values: vec![
(
((Any::Advice, 1).into(), 0).into(),

View File

@ -122,7 +122,7 @@ mod tests {
use ff::PrimeField;
use halo2::{
circuit::{Layouter, SimpleFloorPlanner},
dev::{MockProver, VerifyFailure},
dev::{FailureLocation, MockProver, VerifyFailure},
plonk::{Any, Circuit, ConstraintSystem, Error, Selector},
poly::Rotation,
};
@ -199,7 +199,10 @@ mod tests {
prover.verify(),
Err(vec![VerifyFailure::ConstraintNotSatisfied {
constraint: ((0, "range check").into(), 0, "").into(),
row: 0,
location: FailureLocation::InRegion {
region: (0, "range constrain").into(),
offset: 0,
},
cell_values: vec![(((Any::Advice, 0).into(), 0).into(), "0x8".to_string())],
}])
);

View File

@ -369,7 +369,7 @@ mod tests {
use ff::{Field, PrimeFieldBits};
use halo2::{
circuit::{Layouter, SimpleFloorPlanner},
dev::{MockProver, VerifyFailure},
dev::{FailureLocation, MockProver, VerifyFailure},
plonk::{Circuit, ConstraintSystem, Error},
};
use pasta_curves::{arithmetic::FieldExt, pallas};
@ -562,7 +562,10 @@ mod tests {
prover.verify(),
Err(vec![VerifyFailure::Lookup {
lookup_index: 0,
row: 1
location: FailureLocation::InRegion {
region: (1, "Range check 6 bits").into(),
offset: 1,
},
}])
);
}
@ -579,11 +582,17 @@ mod tests {
Err(vec![
VerifyFailure::Lookup {
lookup_index: 0,
row: 0
location: FailureLocation::InRegion {
region: (1, "Range check 6 bits").into(),
offset: 0,
},
},
VerifyFailure::Lookup {
lookup_index: 0,
row: 1
location: FailureLocation::InRegion {
region: (1, "Range check 6 bits").into(),
offset: 1,
},
},
])
);
@ -609,7 +618,10 @@ mod tests {
prover.verify(),
Err(vec![VerifyFailure::Lookup {
lookup_index: 0,
row: 0
location: FailureLocation::InRegion {
region: (1, "Range check 6 bits").into(),
offset: 0,
},
}])
);
}