rm unused errors

This commit is contained in:
collin 2020-05-12 20:23:45 -07:00
parent c1df2b00b2
commit 88f850164e
11 changed files with 7 additions and 102 deletions

View File

@ -1,32 +1,20 @@
use crate::{ConstrainedProgram, ConstrainedValue};
use snarkos_models::{
curves::{Field, PrimeField, Group},
gadgets::{
r1cs::ConstraintSystem,
utilities::boolean::Boolean
},
curves::{Field, Group, PrimeField},
gadgets::{r1cs::ConstraintSystem, utilities::boolean::Boolean},
};
impl<F: Field + PrimeField, G: Group, CS: ConstraintSystem<F>> ConstrainedProgram<F, G, CS> {
pub fn evaluate_group_eq(
group_element_1: G,
group_element_2: G,
) -> ConstrainedValue<F, G> {
pub fn evaluate_group_eq(group_element_1: G, group_element_2: G) -> ConstrainedValue<F, G> {
ConstrainedValue::Boolean(Boolean::constant(group_element_1.eq(&group_element_2)))
}
pub fn evaluate_group_add(
group_element_1: G,
group_element_2: G,
) -> ConstrainedValue<F, G> {
pub fn evaluate_group_add(group_element_1: G, group_element_2: G) -> ConstrainedValue<F, G> {
ConstrainedValue::GroupElement(group_element_1.add(&group_element_2))
}
pub fn evaluate_group_sub(
group_element_1: G,
group_element_2: G,
) -> ConstrainedValue<F, G> {
pub fn evaluate_group_sub(group_element_1: G, group_element_2: G) -> ConstrainedValue<F, G> {
ConstrainedValue::GroupElement(group_element_1.sub(&group_element_2))
}
}
}

View File

@ -5,9 +5,6 @@ use std::path::PathBuf;
#[derive(Debug, Error)]
pub enum CompilerError {
#[error("{}: {}", _0, _1)]
Crate(&'static str, String),
#[error("creating: {}", _0)]
Creating(io::Error),
@ -39,12 +36,6 @@ pub enum CompilerError {
Writing(io::Error),
}
impl From<std::io::Error> for CompilerError {
fn from(error: std::io::Error) -> Self {
CompilerError::Crate("std::io", format!("{}", error))
}
}
impl From<ImportError> for CompilerError {
fn from(error: ImportError) -> Self {
CompilerError::ImportError(error)

View File

@ -3,9 +3,6 @@ use snarkos_errors::gadgets::SynthesisError;
#[derive(Debug, Error)]
pub enum BooleanError {
#[error("{}: {}", _0, _1)]
Crate(&'static str, String),
#[error("{}", _0)]
ValueError(ValueError),
@ -28,12 +25,6 @@ pub enum BooleanError {
SynthesisError(SynthesisError),
}
impl From<std::io::Error> for BooleanError {
fn from(error: std::io::Error) -> Self {
BooleanError::Crate("std::io", format!("{}", error))
}
}
impl From<SynthesisError> for BooleanError {
fn from(error: SynthesisError) -> Self {
BooleanError::SynthesisError(error)

View File

@ -2,9 +2,6 @@ use crate::errors::{BooleanError, FieldElementError, FunctionError, IntegerError
#[derive(Debug, Error)]
pub enum ExpressionError {
#[error("{}: {}", _0, _1)]
Crate(&'static str, String),
// Variables
#[error("Variable \"{}\" not found", _0)]
UndefinedVariable(String),
@ -78,12 +75,6 @@ pub enum ExpressionError {
IfElseConditional(String),
}
impl From<std::io::Error> for ExpressionError {
fn from(error: std::io::Error) -> Self {
ExpressionError::Crate("std::io", format!("{}", error))
}
}
impl From<ValueError> for ExpressionError {
fn from(error: ValueError) -> Self {
ExpressionError::ValueError(error)

View File

@ -2,9 +2,6 @@ use snarkos_errors::gadgets::SynthesisError;
#[derive(Debug, Error)]
pub enum FieldElementError {
#[error("{}: {}", _0, _1)]
Crate(&'static str, String),
#[error("Expected field element parameter, got {}", _0)]
InvalidField(String),
@ -12,12 +9,6 @@ pub enum FieldElementError {
SynthesisError(SynthesisError),
}
impl From<std::io::Error> for FieldElementError {
fn from(error: std::io::Error) -> Self {
FieldElementError::Crate("std::io", format!("{}", error))
}
}
impl From<SynthesisError> for FieldElementError {
fn from(error: SynthesisError) -> Self {
FieldElementError::SynthesisError(error)

View File

@ -4,9 +4,6 @@ use crate::errors::{
#[derive(Debug, Error)]
pub enum FunctionError {
#[error("{}: {}", _0, _1)]
Crate(&'static str, String),
#[error("Function expected {} inputs, got {}", _0, _1)]
InputsLength(usize, usize),
@ -41,12 +38,6 @@ pub enum FunctionError {
StatementError(StatementError),
}
impl From<std::io::Error> for FunctionError {
fn from(error: std::io::Error) -> Self {
FunctionError::Crate("std::io", format!("{}", error))
}
}
impl From<ValueError> for FunctionError {
fn from(error: ValueError) -> Self {
FunctionError::ValueError(error)

View File

@ -1,4 +1,2 @@
#[derive(Debug, Error)]
pub enum GroupElementError {
}
pub enum GroupElementError {}

View File

@ -1,8 +1,5 @@
#[derive(Debug, Error)]
pub enum ImportError {
#[error("{}: {}", _0, _1)]
Crate(&'static str, String),
#[error("Cannot read from the provided file path - {}", _0)]
FileReadError(String),
@ -12,9 +9,3 @@ pub enum ImportError {
#[error("Unable to construct abstract syntax tree")]
SyntaxTreeError,
}
impl From<std::io::Error> for ImportError {
fn from(error: std::io::Error) -> Self {
ImportError::Crate("std::io", format!("{}", error))
}
}

View File

@ -2,9 +2,6 @@ use snarkos_errors::gadgets::SynthesisError;
#[derive(Debug, Error)]
pub enum IntegerError {
#[error("{}: {}", _0, _1)]
Crate(&'static str, String),
#[error("expected integer parameter type, got {}", _0)]
InvalidType(String),
@ -21,12 +18,6 @@ pub enum IntegerError {
SynthesisError(SynthesisError),
}
impl From<std::io::Error> for IntegerError {
fn from(error: std::io::Error) -> Self {
IntegerError::Crate("std::io", format!("{}", error))
}
}
impl From<SynthesisError> for IntegerError {
fn from(error: SynthesisError) -> Self {
IntegerError::SynthesisError(error)

View File

@ -2,9 +2,6 @@ use crate::errors::{BooleanError, ExpressionError, FieldElementError, IntegerErr
#[derive(Debug, Error)]
pub enum StatementError {
#[error("{}: {}", _0, _1)]
Crate(&'static str, String),
#[error("Attempted to assign to unknown variable {}", _0)]
UndefinedVariable(String),
@ -51,12 +48,6 @@ pub enum StatementError {
Unassigned(String),
}
impl From<std::io::Error> for StatementError {
fn from(error: std::io::Error) -> Self {
StatementError::Crate("std::io", format!("{}", error))
}
}
impl From<ExpressionError> for StatementError {
fn from(error: ExpressionError) -> Self {
StatementError::ExpressionError(error)

View File

@ -9,9 +9,6 @@ pub enum ValueError {
#[error("Expected type array, got {}", _0)]
ArrayModel(String),
#[error("{}: {}", _0, _1)]
Crate(&'static str, String),
#[error("{}", _0)]
IntegerError(IntegerError),
@ -24,12 +21,6 @@ pub enum ValueError {
TypeError(String),
}
impl From<std::io::Error> for ValueError {
fn from(error: std::io::Error) -> Self {
ValueError::Crate("std::io", format!("{}", error))
}
}
impl From<IntegerError> for ValueError {
fn from(error: IntegerError) -> Self {
ValueError::IntegerError(error)