Skip to content
Snippets Groups Projects
Verified Commit 1c9077f6 authored by STEVAN Antoine's avatar STEVAN Antoine :crab:
Browse files

add documentation to the errors

parent dad69f2c
No related branches found
No related tags found
1 merge request!159add some more documentation
......@@ -3,30 +3,49 @@
//! there are a few linear algebra errors and some related to ZK.
use thiserror::Error;
/// An error that Komodo could end up producing.
///
/// There are a few families of errors in Komodo:
/// - related to _linear algebra_
/// - related to FEC
/// - related to proving the shards
#[derive(Clone, Debug, Error, PartialEq)]
pub enum KomodoError {
/// `{0}` is a custom error message when a matrix is invalid.
#[error("Invalid matrix elements: {0}")]
InvalidMatrixElements(String),
/// `{0}` and `{1}` are the shape of the rectangular matrix.
#[error("Matrix is not a square, ({0} x {1})")]
NonSquareMatrix(usize, usize),
/// `{0}` is the ID of the row where the matrix inversion failed.
#[error("Matrix is not invertible at row {0}")]
NonInvertibleMatrix(usize),
/// `{0}` and `{1}` are the shape of the left matrix and `{2}` and `{3}` are the shape of the
/// right matrix.
#[error("Matrices don't have compatible shapes: ({0} x {1}) and ({2} x {3})")]
IncompatibleMatrixShapes(usize, usize, usize, usize),
/// `{0}` and `{1}` are the IDs of the non-distinct _Vandermonde_ points and `{2}` is the list
/// of all the _Vandermonde_ points.
#[error(
"Seed points of a Vandermonde matrix should be distinct: {0} and {1} are the same ({2})"
)]
InvalidVandermonde(usize, usize, String),
/// `{0}` is the actual number of shards and `{1}` is the expected amount.
#[error("Expected at least {1} shards, got {0}")]
TooFewShards(usize, usize),
/// `{0}` is a custom error message when shards are incompatible.
#[error("Shards are incompatible: {0}")]
IncompatibleShards(String),
/// `{0}` is a custom error message when blocks are incompatible.
#[error("Blocks are incompatible: {0}")]
IncompatibleBlocks(String),
#[error("Degree is zero")]
DegreeIsZero,
/// `{0}` is the supported degree of the trusted setup and `{1}` is the actual requested
/// polynomnial degree
#[error("too many coefficients: max is {0}, found {0}")]
TooFewPowersInTrustedSetup(usize, usize),
/// `{0}` is a custom error message.
#[error("Another error: {0}")]
Other(String),
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment