tor_hscrypto/pow/v1/
err.rs

1//! Error types local to the `v1` protocol implementation
2
3/// Protocol-specific ways a solution can fail verification
4#[derive(Clone, Debug, thiserror::Error)]
5#[non_exhaustive]
6pub enum SolutionErrorV1 {
7    /// Mismatch between [`super::SeedHead`] and [`super::Instance`]
8    #[error("Solution has an unrecognized Seed value")]
9    Seed,
10    /// The effort constraint `H(challenge | proof) * effort` failed.
11    #[error("Failed to verify solution effort")]
12    Effort,
13    /// The Equi-X proof is not well-formed, it failed at least one order test.
14    #[error("Failed to verify order of Equi-X proof")]
15    Order,
16    /// The Equi-X proof does not apply to this particular challenge.
17    #[error("Failed to verify hash sums for Equi-X proof")]
18    HashSum,
19    /// Couldn't construct the HashX function
20    ///
21    /// A working solver should have rejected this [`super::Nonce`] value.
22    #[error("Solution requires a challenge string that fails HashX constraints")]
23    ChallengeConstraints,
24}
25
26/// Protocol-specific runtime errors
27#[derive(Clone, Debug, thiserror::Error)]
28#[non_exhaustive]
29pub enum RuntimeErrorV1 {
30    /// Unexpected error or runtime compiler error from the Equi-X layer
31    #[error("Equi-X error, {0}")]
32    EquiX(#[from] equix::Error),
33}