deps: use x25519-dalek's new PartialEq, Eq methods

This commit is contained in:
Henry de Valence 2020-08-31 13:05:09 -07:00
parent 448250f901
commit 3ed967bcf8
5 changed files with 6 additions and 25 deletions

4
Cargo.lock generated
View File

@ -3050,9 +3050,9 @@ dependencies = [
[[package]]
name = "x25519-dalek"
version = "1.0.1"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "00ffb05621d7d051df0f020edf3e5db20797a4e522bf1f9c5dfa20603f1c85f6"
checksum = "bc614d95359fd7afc321b66d2107ede58b246b844cf5d8a0adcca413e439f088"
dependencies = [
"curve25519-dalek",
"rand_core 0.5.1",

View File

@ -27,7 +27,7 @@ serde = { version = "1", features = ["serde_derive", "rc"] }
serde-big-array = "0.3.0"
sha2 = { version = "0.9.1", features=["compress"] }
thiserror = "1"
x25519-dalek = { version = "1", features = ["serde"] }
x25519-dalek = { version = "1.1", features = ["serde"] }
# ZF deps
displaydoc = "0.1.7"

View File

@ -34,7 +34,7 @@ impl fmt::Debug for SproutShieldedAddress {
f.debug_struct("SproutShieldedAddress")
.field("network", &self.network)
.field("paying_key", &self.paying_key)
// Because x25519_dalek::PublicKey doesn't impl Debug.
// Use hex formatting for the transmission key.
.field(
"transmission_key",
&hex::encode(&self.transmission_key.as_bytes()),

View File

@ -16,7 +16,7 @@ use super::{commitment, note, tree};
/// A _JoinSplit Description_, as described in [protocol specification §7.2][ps].
///
/// [ps]: https://zips.z.cash/protocol/protocol.pdf#joinsplitencoding
#[derive(Clone, Debug, Serialize, Deserialize)]
#[derive(PartialEq, Eq, Clone, Debug, Serialize, Deserialize)]
pub struct JoinSplit<P: ZkSnarkProof> {
/// A value that the JoinSplit transfer removes from the transparent value
/// pool.
@ -49,25 +49,6 @@ pub struct JoinSplit<P: ZkSnarkProof> {
pub enc_ciphertexts: [note::EncryptedNote; 2],
}
// Because x25519_dalek::PublicKey does not impl PartialEq
impl<P: ZkSnarkProof> PartialEq for JoinSplit<P> {
fn eq(&self, other: &Self) -> bool {
self.vpub_old == other.vpub_old
&& self.vpub_new == other.vpub_new
&& self.anchor == other.anchor
&& self.nullifiers == other.nullifiers
&& self.commitments == other.commitments
&& self.ephemeral_key.as_bytes() == other.ephemeral_key.as_bytes()
&& self.random_seed == other.random_seed
&& self.vmacs == other.vmacs
&& self.zkproof == other.zkproof
&& self.enc_ciphertexts == other.enc_ciphertexts
}
}
// Because x25519_dalek::PublicKey does not impl Eq
impl<P: ZkSnarkProof> Eq for JoinSplit<P> {}
impl<P: ZkSnarkProof> ZcashSerialize for JoinSplit<P> {
fn zcash_serialize<W: io::Write>(&self, mut writer: W) -> Result<(), io::Error> {
writer.write_u64::<LittleEndian>(self.vpub_old.into())?;

View File

@ -5,7 +5,7 @@ use std::io::{self, Read};
///
/// binding h_sig to each a_sk of the JoinSplit description, computed as
/// described in § 4.10 Non-malleability (Sprout) on p. 37
#[derive(PartialEq, Clone, Debug, Serialize, Deserialize)]
#[derive(PartialEq, Eq, Clone, Debug, Serialize, Deserialize)]
#[cfg_attr(test, derive(proptest_derive::Arbitrary))]
pub struct MAC([u8; 32]);