snarkvm_algorithms/polycommit/
error.rs1#[derive(Debug, Error)]
18pub enum PCError {
19    #[error("{0}")]
20    AnyhowError(#[from] anyhow::Error),
21
22    #[error("QuerySet` refers to polynomial \"{label}\", but it was not provided.")]
23    MissingPolynomial {
24        label: String,
26    },
27
28    #[error("`QuerySet` refers to polynomial \"{label}\", but `Evaluations` does not contain an evaluation for it.")]
29    MissingEvaluation {
30        label: String,
32    },
33
34    #[error("The provided polynomial was meant to be hiding, but `rng` was `None`.")]
35    MissingRng,
36
37    #[error("The degree provided in setup was too small; degree 0 polynomials are not supported.")]
38    DegreeIsZero,
39
40    #[error(
41        "the number of coefficients in the polynomial ({num_coefficients:?}) is greater than \
42             the maximum number of powers in `Powers` ({num_powers:?})"
43    )]
44    TooManyCoefficients {
45        num_coefficients: usize,
47        num_powers: usize,
49    },
50
51    #[error("The hiding bound was not `None`, but the hiding bound was zero.")]
52    HidingBoundIsZero,
53
54    #[error(
55        "the degree of the hiding poly ({hiding_poly_degree:?}) is not less than the maximum number of powers in `Powers` ({num_powers:?})"
56    )]
57    HidingBoundToolarge {
58        hiding_poly_degree: usize,
60        num_powers: usize,
62    },
63
64    #[error("The lagrange basis is not a power of two.")]
65    LagrangeBasisSizeIsNotPowerOfTwo,
66
67    #[error("The lagrange basis is larger than the supported degree.")]
68    LagrangeBasisSizeIsTooLarge,
69
70    #[error("The degree provided to `trim` was too large.")]
71    TrimmingDegreeTooLarge,
72
73    #[error("the equation \"{0}\" contained degree-bounded polynomials")]
74    EquationHasDegreeBounds(String),
75
76    #[error("the degree bound ({0}) is not supported by the parameters")]
77    UnsupportedDegreeBound(usize),
78
79    #[error("the Lagrange basis size ({0}) is not supported by the parameters")]
80    UnsupportedLagrangeBasisSize(usize),
81
82    #[error(
83        "the degree bound ({degree_bound}) for the polynomial {label} \
84        (having degree {poly_degree}) is greater than the maximum degree ({max_degree})"
85    )]
86    IncorrectDegreeBound {
87        poly_degree: usize,
89        degree_bound: usize,
91        max_degree: usize,
93        label: String,
95    },
96}