mirror of
https://github.com/ProvableHQ/leo.git
synced 2024-09-11 05:45:30 +03:00
remove extra dependency and rename error
This commit is contained in:
parent
01cc8e3066
commit
887e374e28
1
Cargo.lock
generated
1
Cargo.lock
generated
@ -479,7 +479,6 @@ dependencies = [
|
||||
"pest-ast",
|
||||
"pest_derive",
|
||||
"rand",
|
||||
"rand_xorshift",
|
||||
"sha2",
|
||||
"snarkos-algorithms",
|
||||
"snarkos-curves",
|
||||
|
@ -21,5 +21,4 @@ pest = { version = "2.0" }
|
||||
pest-ast = { version = "0.3.3" }
|
||||
pest_derive = { version = "2.0" }
|
||||
rand = { version = "0.7" }
|
||||
rand_xorshift = { version = "0.2" }
|
||||
sha2 = { version = "0.8" }
|
||||
|
@ -16,7 +16,7 @@ pub(crate) fn group_from_input<F: Field + PrimeField, G: GroupType<F>, CS: Const
|
||||
if let InputValue::Group(group_string) = input {
|
||||
Some(group_string)
|
||||
} else {
|
||||
return Err(GroupError::InvalidGroup(input.to_string()));
|
||||
return Err(GroupError::Invalid(input.to_string()));
|
||||
}
|
||||
}
|
||||
None => None,
|
||||
|
@ -2,8 +2,8 @@ use snarkos_errors::gadgets::SynthesisError;
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum GroupError {
|
||||
#[error("Expected group element parameter, got {}", _0)]
|
||||
InvalidGroup(String),
|
||||
#[error("Expected affine point, got {}", _0)]
|
||||
Invalid(String),
|
||||
|
||||
#[error("{}", _0)]
|
||||
SynthesisError(SynthesisError),
|
||||
|
@ -88,10 +88,8 @@ impl EdwardsGroupType {
|
||||
pub fn edwards_affine_from_str(string: String) -> Result<EdwardsAffine, GroupError> {
|
||||
// 0 or (0, 1)
|
||||
match Fq::from_str(&string).ok() {
|
||||
Some(x) => {
|
||||
EdwardsAffine::get_point_from_x(x, false).ok_or(GroupError::InvalidGroup(string))
|
||||
}
|
||||
None => EdwardsAffine::from_str(&string).map_err(|_| GroupError::InvalidGroup(string)),
|
||||
Some(x) => EdwardsAffine::get_point_from_x(x, false).ok_or(GroupError::Invalid(string)),
|
||||
None => EdwardsAffine::from_str(&string).map_err(|_| GroupError::Invalid(string)),
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user