deps: use x25519-dalek's new PartialEq, Eq methods
This commit is contained in:
parent
448250f901
commit
3ed967bcf8
|
|
@ -3050,9 +3050,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "x25519-dalek"
|
name = "x25519-dalek"
|
||||||
version = "1.0.1"
|
version = "1.1.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "00ffb05621d7d051df0f020edf3e5db20797a4e522bf1f9c5dfa20603f1c85f6"
|
checksum = "bc614d95359fd7afc321b66d2107ede58b246b844cf5d8a0adcca413e439f088"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"curve25519-dalek",
|
"curve25519-dalek",
|
||||||
"rand_core 0.5.1",
|
"rand_core 0.5.1",
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ serde = { version = "1", features = ["serde_derive", "rc"] }
|
||||||
serde-big-array = "0.3.0"
|
serde-big-array = "0.3.0"
|
||||||
sha2 = { version = "0.9.1", features=["compress"] }
|
sha2 = { version = "0.9.1", features=["compress"] }
|
||||||
thiserror = "1"
|
thiserror = "1"
|
||||||
x25519-dalek = { version = "1", features = ["serde"] }
|
x25519-dalek = { version = "1.1", features = ["serde"] }
|
||||||
|
|
||||||
# ZF deps
|
# ZF deps
|
||||||
displaydoc = "0.1.7"
|
displaydoc = "0.1.7"
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ impl fmt::Debug for SproutShieldedAddress {
|
||||||
f.debug_struct("SproutShieldedAddress")
|
f.debug_struct("SproutShieldedAddress")
|
||||||
.field("network", &self.network)
|
.field("network", &self.network)
|
||||||
.field("paying_key", &self.paying_key)
|
.field("paying_key", &self.paying_key)
|
||||||
// Because x25519_dalek::PublicKey doesn't impl Debug.
|
// Use hex formatting for the transmission key.
|
||||||
.field(
|
.field(
|
||||||
"transmission_key",
|
"transmission_key",
|
||||||
&hex::encode(&self.transmission_key.as_bytes()),
|
&hex::encode(&self.transmission_key.as_bytes()),
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ use super::{commitment, note, tree};
|
||||||
/// A _JoinSplit Description_, as described in [protocol specification §7.2][ps].
|
/// A _JoinSplit Description_, as described in [protocol specification §7.2][ps].
|
||||||
///
|
///
|
||||||
/// [ps]: https://zips.z.cash/protocol/protocol.pdf#joinsplitencoding
|
/// [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> {
|
pub struct JoinSplit<P: ZkSnarkProof> {
|
||||||
/// A value that the JoinSplit transfer removes from the transparent value
|
/// A value that the JoinSplit transfer removes from the transparent value
|
||||||
/// pool.
|
/// pool.
|
||||||
|
|
@ -49,25 +49,6 @@ pub struct JoinSplit<P: ZkSnarkProof> {
|
||||||
pub enc_ciphertexts: [note::EncryptedNote; 2],
|
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> {
|
impl<P: ZkSnarkProof> ZcashSerialize for JoinSplit<P> {
|
||||||
fn zcash_serialize<W: io::Write>(&self, mut writer: W) -> Result<(), io::Error> {
|
fn zcash_serialize<W: io::Write>(&self, mut writer: W) -> Result<(), io::Error> {
|
||||||
writer.write_u64::<LittleEndian>(self.vpub_old.into())?;
|
writer.write_u64::<LittleEndian>(self.vpub_old.into())?;
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ use std::io::{self, Read};
|
||||||
///
|
///
|
||||||
/// binding h_sig to each a_sk of the JoinSplit description, computed as
|
/// binding h_sig to each a_sk of the JoinSplit description, computed as
|
||||||
/// described in § 4.10 ‘Non-malleability (Sprout)’ on p. 37
|
/// 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))]
|
#[cfg_attr(test, derive(proptest_derive::Arbitrary))]
|
||||||
pub struct MAC([u8; 32]);
|
pub struct MAC([u8; 32]);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue