Skip to content

Commit

Permalink
Derive partial eq for a Packet struct and its descendents
Browse files Browse the repository at this point in the history
Signed-off-by: Jacinta Ferrant <[email protected]>
  • Loading branch information
jferrant committed Jan 10, 2024
1 parent c96236d commit 3b5f3f4
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
4 changes: 2 additions & 2 deletions src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use crate::{
/// A merkle root is a 256 bit hash
pub type MerkleRoot = [u8; 32];

#[derive(Clone, Debug, Deserialize, Serialize)]
#[derive(Clone, Debug, Deserialize, Serialize, PartialEq)]
/// A commitment to a polynonial, with a Schnorr proof of ownership bound to the ID
pub struct PolyCommitment {
/// The party ID with a schnorr proof
Expand Down Expand Up @@ -115,7 +115,7 @@ impl Display for PublicNonce {
}
}

#[derive(Clone, Debug, Deserialize, Serialize)]
#[derive(Clone, Debug, Deserialize, Serialize, PartialEq)]
/// A share of the party signature with related values
pub struct SignatureShare {
/// The ID of the party
Expand Down
24 changes: 12 additions & 12 deletions src/net.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ pub trait Signable {
}
}

#[derive(Clone, Serialize, Deserialize, Debug)]
#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
/// Final DKG status after receiving public and private shares
pub enum DkgStatus {
/// DKG completed successfully
Expand All @@ -52,7 +52,7 @@ pub enum DkgStatus {
Failure(String),
}

#[derive(Clone, Serialize, Deserialize, Debug)]
#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
/// Encapsulation of all possible network message types
pub enum Message {
/// Tell signers to begin DKG by sending DKG public shares
Expand All @@ -75,7 +75,7 @@ pub enum Message {
SignatureShareResponse(SignatureShareResponse),
}

#[derive(Clone, Serialize, Deserialize, Debug)]
#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
/// DKG begin message from coordinator to signers
pub struct DkgBegin {
/// DKG round ID
Expand All @@ -89,7 +89,7 @@ impl Signable for DkgBegin {
}
}

#[derive(Clone, Serialize, Deserialize, Debug)]
#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
/// DKG public shares message from signer to all signers and coordinator
pub struct DkgPublicShares {
/// DKG round ID
Expand All @@ -114,7 +114,7 @@ impl Signable for DkgPublicShares {
}
}

#[derive(Clone, Serialize, Deserialize, Debug)]
#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
/// DKG private begin message from signer to all signers and coordinator
pub struct DkgPrivateBegin {
/// DKG round ID
Expand All @@ -133,7 +133,7 @@ impl Signable for DkgPrivateBegin {
}
}

#[derive(Clone, Serialize, Deserialize, Debug)]
#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
/// DKG private shares message from signer to all signers and coordinator
pub struct DkgPrivateShares {
/// DKG round ID
Expand All @@ -160,7 +160,7 @@ impl Signable for DkgPrivateShares {
}
}

#[derive(Clone, Serialize, Deserialize, Debug)]
#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
/// DKG end message from signers to coordinator
pub struct DkgEnd {
/// DKG round ID
Expand All @@ -179,7 +179,7 @@ impl Signable for DkgEnd {
}
}

#[derive(Clone, Serialize, Deserialize, Debug)]
#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
/// Nonce request message from coordinator to signers
pub struct NonceRequest {
/// DKG round ID
Expand Down Expand Up @@ -210,7 +210,7 @@ impl Signable for NonceRequest {
}
}

#[derive(Clone, Serialize, Deserialize, Debug)]
#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
/// Nonce response message from signers to coordinator
pub struct NonceResponse {
/// DKG round ID
Expand Down Expand Up @@ -246,7 +246,7 @@ impl Signable for NonceResponse {
}
}

#[derive(Clone, Serialize, Deserialize, Debug)]
#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
/// Signature share request message from coordinator to signers
pub struct SignatureShareRequest {
/// DKG round ID
Expand Down Expand Up @@ -284,7 +284,7 @@ impl Signable for SignatureShareRequest {
}
}

#[derive(Clone, Serialize, Deserialize, Debug)]
#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
/// Signature share response message from signers to coordinator
pub struct SignatureShareResponse {
/// DKG round ID
Expand Down Expand Up @@ -313,7 +313,7 @@ impl Signable for SignatureShareResponse {
}
}

#[derive(Serialize, Deserialize, Debug, Clone)]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)]
/// Network packets need to be signed so they can be verified
pub struct Packet {
/// The message to sign
Expand Down
2 changes: 1 addition & 1 deletion src/schnorr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use crate::{
};

#[allow(non_snake_case)]
#[derive(Clone, Debug, Deserialize, Serialize)]
#[derive(Clone, Debug, Deserialize, Serialize, PartialEq)]
/// ID type which encapsulates the ID and a schnorr proof of ownership of the polynomial
pub struct ID {
/// The ID
Expand Down

0 comments on commit 3b5f3f4

Please sign in to comment.