Skip to content

Commit 25a44a2

Browse files
committed
Derive Copy, Clone, Debug, Eq, PartialEq for EncryptedNote instead of explicit imlps as const generic are stabilized
1 parent 7735050 commit 25a44a2

File tree

1 file changed

+1
-28
lines changed

1 file changed

+1
-28
lines changed

zebra-chain/src/orchard/note/ciphertexts.rs

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -9,30 +9,9 @@ use crate::serialization::{SerializationError, ZcashDeserialize, ZcashSerialize}
99
/// A ciphertext component for encrypted output notes.
1010
///
1111
/// Corresponds to the Orchard 'encCiphertext's
12-
#[derive(Deserialize, Serialize)]
12+
#[derive(Deserialize, Serialize, Copy, Clone, Debug, Eq, PartialEq)]
1313
pub struct EncryptedNote<const N: usize>(#[serde(with = "BigArray")] pub(crate) [u8; N]);
1414

15-
// These impls all only exist because of array length restrictions.
16-
// TODO: use const generics https://github.com/ZcashFoundation/zebra/issues/2042
17-
18-
impl<const N: usize> Copy for EncryptedNote<N> {}
19-
20-
impl<const N: usize> Clone for EncryptedNote<N> {
21-
fn clone(&self) -> Self {
22-
*self
23-
}
24-
}
25-
26-
impl<const N: usize> fmt::Debug for EncryptedNote<N> {
27-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
28-
f.debug_tuple("EncryptedNote")
29-
.field(&hex::encode(&self.0[..]))
30-
.finish()
31-
}
32-
}
33-
34-
impl<const N: usize> Eq for EncryptedNote<N> {}
35-
3615
impl<const N: usize> From<[u8; N]> for EncryptedNote<N> {
3716
fn from(bytes: [u8; N]) -> Self {
3817
EncryptedNote(bytes)
@@ -45,12 +24,6 @@ impl<const N: usize> From<EncryptedNote<N>> for [u8; N] {
4524
}
4625
}
4726

48-
impl<const N: usize> PartialEq for EncryptedNote<N> {
49-
fn eq(&self, other: &Self) -> bool {
50-
self.0[..] == other.0[..]
51-
}
52-
}
53-
5427
impl<const N: usize> ZcashSerialize for EncryptedNote<N> {
5528
fn zcash_serialize<W: io::Write>(&self, mut writer: W) -> Result<(), io::Error> {
5629
writer.write_all(&self.0[..])?;

0 commit comments

Comments
 (0)