From ccdd5e6fac73ac133084414559097882be6c4732 Mon Sep 17 00:00:00 2001 From: Piotr Roslaniec Date: Tue, 31 Oct 2023 14:11:41 +0100 Subject: [PATCH] feat(ferveo): derive eq in DkgPublicKey --- ferveo-common/src/keypair.rs | 12 ++---------- ferveo/src/api.rs | 2 +- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/ferveo-common/src/keypair.rs b/ferveo-common/src/keypair.rs index 485241b3..9b251125 100644 --- a/ferveo-common/src/keypair.rs +++ b/ferveo-common/src/keypair.rs @@ -61,15 +61,7 @@ impl PublicKey { impl PartialOrd for PublicKey { fn partial_cmp(&self, other: &Self) -> Option { - if self.encryption_key.x() == other.encryption_key.x() { - return self - .encryption_key - .y() - .partial_cmp(&other.encryption_key.y()); - } - self.encryption_key - .x() - .partial_cmp(&other.encryption_key.x()) + Some(self.cmp(other)) } } @@ -102,7 +94,7 @@ pub struct Keypair { impl PartialOrd for Keypair { fn partial_cmp(&self, other: &Self) -> Option { - self.decryption_key.partial_cmp(&other.decryption_key) + Some(self.cmp(other)) } } diff --git a/ferveo/src/api.rs b/ferveo/src/api.rs index b2179ee6..3c354bcb 100644 --- a/ferveo/src/api.rs +++ b/ferveo/src/api.rs @@ -139,7 +139,7 @@ impl From for FerveoVariant { } #[serde_as] -#[derive(Copy, Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Copy, Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] pub struct DkgPublicKey( #[serde_as(as = "serialization::SerdeAs")] pub(crate) G1Affine, );