Skip to content

Commit

Permalink
Merge pull request #400 from ralexstokes/add-ord
Browse files Browse the repository at this point in the history
add `PartialOrd`, `Ord` to some types
  • Loading branch information
ralexstokes committed May 4, 2024
2 parents 0ead81b + fb4da9a commit 2ce2ca4
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ serde_yaml = "0.8"
itertools = "0.10.3"
thiserror = "1.0.30"
hex = "0.4.3"
ssz_rs = { git = "https://github.com/ralexstokes/ssz-rs", rev = "52cf0426922df94c0cb45a4736032d772c0a744f" }
ssz_rs = { git = "https://github.com/ralexstokes/ssz-rs", rev = "84ef2b71aa004f6767420badb42c902ad56b8b72" }
blst = "0.3.11"
rand = "0.8.4"
sha2 = "0.10.8"
Expand Down
11 changes: 10 additions & 1 deletion ethereum-consensus/src/crypto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,16 @@ impl SecretKey {
}

#[derive(
Clone, Default, Hash, PartialEq, Eq, SimpleSerialize, serde::Serialize, serde::Deserialize,
Clone,
Default,
Hash,
PartialEq,
Eq,
PartialOrd,
Ord,
SimpleSerialize,
serde::Serialize,
serde::Deserialize,
)]
pub struct PublicKey(ByteVector<BLS_PUBLIC_KEY_BYTES_LEN>);

Expand Down
12 changes: 11 additions & 1 deletion ethereum-consensus/src/ssz/byte_vector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,17 @@ use std::{
ops::{Deref, DerefMut},
};

#[derive(Default, Clone, PartialEq, Eq, SimpleSerialize, serde::Serialize, serde::Deserialize)]
#[derive(
Default,
Clone,
PartialEq,
Eq,
PartialOrd,
Ord,
SimpleSerialize,
serde::Serialize,
serde::Deserialize,
)]
pub struct ByteVector<const N: usize>(#[serde(with = "crate::serde::as_hex")] Vector<u8, N>);

impl<const N: usize> TryFrom<&[u8]> for ByteVector<N> {
Expand Down

0 comments on commit 2ce2ca4

Please sign in to comment.