Skip to content
This repository has been archived by the owner on Jun 3, 2020. It is now read-only.

tendermint-rs: Derive Eq/Ord for (transitive) status types #324

Merged
merged 1 commit into from
Jul 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tendermint-rs/src/account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use subtle_encoding::hex;
const LENGTH: usize = 20;

/// Account IDs
#[derive(Copy, Clone, Hash)]
#[derive(Copy, Clone, Eq, Hash, PartialEq, PartialOrd, Ord)]
pub struct Id([u8; LENGTH]);

impl Id {
Expand Down
2 changes: 1 addition & 1 deletion tendermint-rs/src/block/id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pub const PREFIX_LENGTH: usize = 10;
///
/// <https://github.com/tendermint/tendermint/blob/master/docs/spec/blockchain/blockchain.md#blockid>
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[derive(Clone, Debug, Hash, Eq, PartialEq)]
#[derive(Clone, Debug, Hash, Eq, PartialEq, PartialOrd, Ord)]
pub struct Id {
/// The block's main hash is the Merkle root of all the fields in the
/// block header.
Expand Down
2 changes: 1 addition & 1 deletion tendermint-rs/src/block/parts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use {

/// Block parts header
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[derive(Clone, Debug, Hash, Eq, PartialEq)]
#[derive(Clone, Debug, Hash, Eq, PartialEq, PartialOrd, Ord)]
pub struct Header {
/// Number of parts in this block
#[cfg_attr(
Expand Down
2 changes: 1 addition & 1 deletion tendermint-rs/src/hash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pub enum Algorithm {
}

/// Hash digests
#[derive(Copy, Clone, Hash, Eq, PartialEq)]
#[derive(Copy, Clone, Hash, Eq, PartialEq, PartialOrd, Ord)]
pub enum Hash {
/// SHA-256 hashes
Sha256([u8; SHA256_HASH_SIZE]),
Expand Down
2 changes: 1 addition & 1 deletion tendermint-rs/src/node/id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub const LENGTH: usize = 20;

/// Node IDs
#[allow(clippy::derive_hash_xor_eq)]
#[derive(Copy, Clone, Eq, Hash)]
#[derive(Copy, Clone, Eq, Hash, PartialOrd, Ord)]
pub struct Id([u8; LENGTH]);

impl Id {
Expand Down
10 changes: 5 additions & 5 deletions tendermint-rs/src/node/info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use serde::{Deserialize, Serialize};
use std::fmt::{self, Display};

/// Node information
#[derive(Clone, Debug, Deserialize, Serialize)]
#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
pub struct Info {
/// Protocol version information
pub protocol_version: ProtocolVersionInfo,
Expand Down Expand Up @@ -33,7 +33,7 @@ pub struct Info {
}

/// Protocol version information
#[derive(Clone, Debug, Deserialize, Serialize)]
#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
pub struct ProtocolVersionInfo {
/// P2P protocol version
#[serde(
Expand All @@ -58,7 +58,7 @@ pub struct ProtocolVersionInfo {
}

/// Listen address information
#[derive(Clone, Debug, Deserialize, Serialize)]
#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
pub struct ListenAddress(String);

impl ListenAddress {
Expand All @@ -80,7 +80,7 @@ impl Display for ListenAddress {
}

/// Other information
#[derive(Clone, Debug, Deserialize, Serialize)]
#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
pub struct OtherInfo {
/// TX index status
pub tx_index: TxIndexStatus,
Expand All @@ -90,7 +90,7 @@ pub struct OtherInfo {
}

/// Transaction index status
#[derive(Copy, Clone, Debug, Deserialize, Serialize)]
#[derive(Copy, Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
pub enum TxIndexStatus {
/// Index is on
#[serde(rename = "on")]
Expand Down
4 changes: 2 additions & 2 deletions tendermint-rs/src/validator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use subtle_encoding::base64;

/// Validator information
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[derive(Clone, Debug)]
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct Info {
/// Validator account address
pub address: account::Id,
Expand Down Expand Up @@ -60,7 +60,7 @@ impl Serialize for ProposerPriority {

/// Updates to the validator set
#[cfg(feature = "rpc")]
#[derive(Clone, Debug, Serialize, Deserialize)]
#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
pub struct Update {
/// Validator public key
#[serde(deserialize_with = "deserialize_public_key")]
Expand Down