Skip to content

Commit

Permalink
Merge pull request #228 from dusk-network/eq-impl
Browse files Browse the repository at this point in the history
impl `Eq` for `TxSkeleton` and `StealthAddress`
  • Loading branch information
Eduardo Leegwater Simões authored Jul 7, 2024
2 parents f4a8109 + d6bf04c commit b3ee366
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 11 deletions.
5 changes: 5 additions & 0 deletions core/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Added

- impl `Eq` for `StealthAddress`
- impl `Eq` for `TxSkeleton`

## [0.30.0] - 2024-07-03

### Added
Expand Down
4 changes: 1 addition & 3 deletions core/src/keys/public.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use dusk_jubjub::GENERATOR_EXTENDED;
use subtle::{Choice, ConstantTimeEq};

/// Public pair of `a·G` and `b·G` defining a [`PublicKey`]
#[derive(Debug, Clone, Copy)]
#[derive(Debug, Clone, Copy, Eq)]
#[cfg_attr(
feature = "rkyv-impl",
derive(Archive, Serialize, Deserialize),
Expand Down Expand Up @@ -72,8 +72,6 @@ impl PartialEq for PublicKey {
}
}

impl Eq for PublicKey {}

impl From<&SecretKey> for PublicKey {
fn from(sk: &SecretKey) -> Self {
let A = GENERATOR_EXTENDED * sk.a();
Expand Down
4 changes: 1 addition & 3 deletions core/src/keys/view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use rkyv::{Archive, Deserialize, Serialize};
///
/// The notes are encrypted against secret a, so this is used to decrypt the
/// blinding factor and value
#[derive(Clone, Copy, Debug)]
#[derive(Clone, Copy, Debug, Eq)]
#[cfg_attr(
feature = "rkyv-impl",
derive(Archive, Serialize, Deserialize),
Expand All @@ -43,8 +43,6 @@ impl PartialEq for ViewKey {
}
}

impl Eq for ViewKey {}

impl ViewKey {
/// This method is used to construct a new `ViewKey` from the given
/// pair of secret `a` and public `b·G`.
Expand Down
4 changes: 1 addition & 3 deletions core/src/note.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ impl TryFrom<i32> for NoteType {
}

/// A note that does not encrypt its value
#[derive(Clone, Debug)]
#[derive(Clone, Debug, Eq)]
#[cfg_attr(
feature = "rkyv-impl",
derive(Archive, Serialize, Deserialize),
Expand All @@ -89,8 +89,6 @@ impl PartialEq for Note {
}
}

impl Eq for Note {}

impl Note {
/// Creates a new phoenix output note
pub fn new<R: RngCore + CryptoRng>(
Expand Down
2 changes: 1 addition & 1 deletion core/src/stealth_address.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use rkyv::{Archive, Deserialize, Serialize};
/// system.
/// A `StealthAddress` is composed by a one-time note-public-key (the actual
/// address) and a random point `R`.
#[derive(Default, Debug, Clone, Copy)]
#[derive(Default, Debug, Clone, Copy, Eq)]
#[cfg_attr(
feature = "rkyv-impl",
derive(Archive, Serialize, Deserialize),
Expand Down
2 changes: 1 addition & 1 deletion core/src/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use dusk_bytes::{DeserializableSlice, Error as BytesError, Serializable};
use crate::{Note, OUTPUT_NOTES};

/// A phoenix transaction, referred to as tx-skeleton in the specs.
#[derive(Debug, Clone, PartialEq)]
#[derive(Debug, Clone, PartialEq, Eq)]
#[cfg_attr(
feature = "rkyv-impl",
derive(Archive, Serialize, Deserialize),
Expand Down

0 comments on commit b3ee366

Please sign in to comment.