use alloc::string::String;
use core::fmt;
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum VerifierError {
InconsistentBaseField,
UnsupportedFieldExtension(usize),
ProofDeserializationError(String),
RandomCoinError,
InconsistentOodConstraintEvaluations,
TraceQueryDoesNotMatchCommitment,
ConstraintQueryDoesNotMatchCommitment,
QuerySeedProofOfWorkVerificationFailed,
FriVerificationFailed(fri::VerifierError),
InsufficientConjecturedSecurity(u32, u32),
InsufficientProvenSecurity(u32, u32),
UnacceptableProofOptions,
}
impl fmt::Display for VerifierError {
#[rustfmt::skip]
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::InconsistentBaseField => {
write!(f, "base field of the proof does not match base field of the specified AIR")
}
Self::UnsupportedFieldExtension(degree) => {
write!(f, "field extension of degree {degree} is not supported for the proof base field")
}
Self::ProofDeserializationError(msg) => {
write!(f, "proof deserialization failed: {msg}")
}
Self::RandomCoinError => {
write!(f, "failed to draw a random value from a random coin")
}
Self::InconsistentOodConstraintEvaluations => {
write!(f, "constraint evaluations over the out-of-domain frame are inconsistent")
}
Self::TraceQueryDoesNotMatchCommitment => {
write!(f, "failed to open trace query against the given commitment")
}
Self::ConstraintQueryDoesNotMatchCommitment => {
write!(f, "failed to open constraint query against the given commitment")
}
Self::QuerySeedProofOfWorkVerificationFailed => {
write!(f, "query seed proof-of-work verification failed")
}
Self::FriVerificationFailed(err) => {
write!(f, "verification of low-degree proof failed: {err}")
}
Self::InsufficientConjecturedSecurity(minimal_security, proof_security)=> {
write!(f, "insufficient proof security level: expected at least {minimal_security} bits of conjectured security, but was {proof_security} bits")
}
Self::InsufficientProvenSecurity(minimal_security, proof_security)=> {
write!(f, "insufficient proof security level: expected at least {minimal_security} bits of proven security, but was {proof_security} bits")
}
Self::UnacceptableProofOptions => {write!(f, "invalid proof options: security parameters do not match the acceptable parameter set")}
}
}
}
impl core::error::Error for VerifierError {}