mirror of https://github.com/zcash/halo2.git
dev: impl fmt::Display for VerifyFailure
This commit is contained in:
parent
47061ade3d
commit
ff2a500e9a
46
src/dev.rs
46
src/dev.rs
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::convert::TryInto;
|
use std::convert::TryInto;
|
||||||
|
use std::fmt;
|
||||||
use std::iter;
|
use std::iter;
|
||||||
|
|
||||||
use ff::Field;
|
use ff::Field;
|
||||||
|
@ -82,6 +83,51 @@ pub enum VerifyFailure {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl fmt::Display for VerifyFailure {
|
||||||
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
|
match self {
|
||||||
|
Self::Cell {
|
||||||
|
column,
|
||||||
|
row,
|
||||||
|
gate_index,
|
||||||
|
gate_name,
|
||||||
|
} => {
|
||||||
|
write!(
|
||||||
|
f,
|
||||||
|
"Cell ({:?}, {}) was not assigned to, but it is used by active gate {} ('{}').",
|
||||||
|
column, row, gate_index, gate_name
|
||||||
|
)
|
||||||
|
}
|
||||||
|
Self::Constraint {
|
||||||
|
gate_index,
|
||||||
|
gate_name,
|
||||||
|
constraint_index,
|
||||||
|
row,
|
||||||
|
} => {
|
||||||
|
write!(
|
||||||
|
f,
|
||||||
|
"Constraint {} in gate {} ('{}') is not satisfied on row {}",
|
||||||
|
constraint_index, gate_index, gate_name, row
|
||||||
|
)
|
||||||
|
}
|
||||||
|
Self::Lookup { lookup_index, row } => {
|
||||||
|
write!(f, "Lookup {} is not satisfied on row {}", lookup_index, row)
|
||||||
|
}
|
||||||
|
Self::Permutation {
|
||||||
|
perm_index,
|
||||||
|
column,
|
||||||
|
row,
|
||||||
|
} => {
|
||||||
|
write!(
|
||||||
|
f,
|
||||||
|
"Permutation {} is not satisfied by cell ({:?}, {})",
|
||||||
|
perm_index, column, row
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// A test prover for debugging circuits.
|
/// A test prover for debugging circuits.
|
||||||
///
|
///
|
||||||
/// The normal proving process, when applied to a buggy circuit implementation, might
|
/// The normal proving process, when applied to a buggy circuit implementation, might
|
||||||
|
|
Loading…
Reference in New Issue