diff --git a/packages/core/src/errors/verification_error.rs b/packages/core/src/errors/verification_error.rs index bfc3d36c55..3d9120ddd1 100644 --- a/packages/core/src/errors/verification_error.rs +++ b/packages/core/src/errors/verification_error.rs @@ -18,10 +18,6 @@ pub enum AggregationError { #[derive(Display, Debug, PartialEq)] #[cfg_attr(feature = "std", derive(thiserror::Error))] pub enum PairingEqualityError { - #[display("List of G1 points is empty")] - EmptyG1, - #[display("List of G2 points is empty")] - EmptyG2, #[display("List is not a multiple of 48")] NotMultipleG1, #[display("List is not a multiple of 96")] @@ -125,18 +121,6 @@ impl From for VerificationError { } => VerificationError::Aggregation { source: AggregationError::NotMultiple, }, - CryptoError::PairingEquality { - source: cosmwasm_crypto::PairingEqualityError::EmptyG1, - .. - } => VerificationError::PairingEquality { - source: PairingEqualityError::EmptyG1, - }, - CryptoError::PairingEquality { - source: cosmwasm_crypto::PairingEqualityError::EmptyG2, - .. - } => VerificationError::PairingEquality { - source: PairingEqualityError::EmptyG2, - }, CryptoError::PairingEquality { source: cosmwasm_crypto::PairingEqualityError::NotMultipleG1 { .. }, .. diff --git a/packages/crypto/src/bls12_318/pairing.rs b/packages/crypto/src/bls12_318/pairing.rs index 63ae1b7ff3..d3821db0b0 100644 --- a/packages/crypto/src/bls12_318/pairing.rs +++ b/packages/crypto/src/bls12_318/pairing.rs @@ -20,11 +20,7 @@ pub fn bls12_381_pairing_equality( r: &[u8], s: &[u8], ) -> Result { - if ps.is_empty() { - return Err(PairingEquality::EmptyG1.into()); - } else if qs.is_empty() { - return Err(PairingEquality::EmptyG2.into()); - } else if ps.len() % BLS12_381_G1_POINT_LEN != 0 { + if ps.len() % BLS12_381_G1_POINT_LEN != 0 { return Err(PairingEquality::NotMultipleG1 { remainder: ps.len() % BLS12_381_G1_POINT_LEN, } @@ -159,24 +155,6 @@ mod test { #[test] fn pairing_equality_error_cases_work() { - let result = bls12_381_pairing_equality(&[], &[12], &[12], &[12]); - assert!(matches!( - result, - Err(CryptoError::PairingEquality { - source: PairingEqualityError::EmptyG1, - .. - }) - )); - - let result = bls12_381_pairing_equality(&[12], &[], &[12], &[12]); - assert!(matches!( - result, - Err(CryptoError::PairingEquality { - source: PairingEqualityError::EmptyG2, - .. - }) - )); - let result = bls12_381_pairing_equality(&[12], &[0; 96], &[12], &[12]); assert!(matches!( result, diff --git a/packages/crypto/src/errors.rs b/packages/crypto/src/errors.rs index 067b583e80..bd3a6ccc41 100644 --- a/packages/crypto/src/errors.rs +++ b/packages/crypto/src/errors.rs @@ -21,10 +21,6 @@ pub enum Aggregation { #[derive(Debug, Display)] #[cfg_attr(feature = "std", derive(thiserror::Error))] pub enum PairingEquality { - #[display("List of G1 points is empty")] - EmptyG1, - #[display("List of G2 points is empty")] - EmptyG2, #[display("List is not a multiple of 48. Remainder: {remainder}")] NotMultipleG1 { remainder: usize }, #[display("List is not a multiple of 96. Remainder: {remainder}")] @@ -139,22 +135,14 @@ impl CryptoError { source: PairingEquality::UnequalPointAmount { .. }, .. } => 13, - CryptoError::PairingEquality { - source: PairingEquality::EmptyG1 { .. }, - .. - } => 14, - CryptoError::PairingEquality { - source: PairingEquality::EmptyG2 { .. }, - .. - } => 15, CryptoError::Aggregation { source: Aggregation::Empty, .. - } => 16, + } => 14, CryptoError::Aggregation { source: Aggregation::NotMultiple { .. }, .. - } => 17, + } => 15, } } } diff --git a/packages/std/src/imports.rs b/packages/std/src/imports.rs index 4cb1779a54..b8045fe551 100644 --- a/packages/std/src/imports.rs +++ b/packages/std/src/imports.rs @@ -420,10 +420,10 @@ impl Api for ExternalApi { match result { 0 => Ok(point), 8 => Err(VerificationError::InvalidPoint), - 16 => Err(VerificationError::Aggregation { + 14 => Err(VerificationError::Aggregation { source: AggregationError::Empty, }), - 17 => Err(VerificationError::Aggregation { + 15 => Err(VerificationError::Aggregation { source: AggregationError::NotMultiple, }), error_code => Err(VerificationError::unknown_err(error_code)), @@ -463,12 +463,6 @@ impl Api for ExternalApi { 13 => Err(VerificationError::PairingEquality { source: PairingEqualityError::UnequalPointAmount, }), - 14 => Err(VerificationError::PairingEquality { - source: PairingEqualityError::EmptyG1, - }), - 15 => Err(VerificationError::PairingEquality { - source: PairingEqualityError::EmptyG2, - }), error_code => Err(VerificationError::unknown_err(error_code)), } }