mirror of https://github.com/zcash/halo2.git
Remove `PartialEq, PartialOrd` impls from `{Extended}SpendingKey`
This commit is contained in:
parent
674ceb54c8
commit
37f1bba998
|
@ -32,7 +32,7 @@ const ZIP32_PURPOSE: u32 = 32;
|
|||
/// Defined in [Zcash Protocol Spec § 4.2.3: Orchard Key Components][orchardkeycomponents].
|
||||
///
|
||||
/// [orchardkeycomponents]: https://zips.z.cash/protocol/nu5.pdf#orchardkeycomponents
|
||||
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord)]
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
pub struct SpendingKey([u8; 32]);
|
||||
|
||||
impl ConstantTimeEq for SpendingKey {
|
||||
|
|
27
src/zip32.rs
27
src/zip32.rs
|
@ -112,16 +112,6 @@ impl ConstantTimeEq for ExtendedSpendingKey {
|
|||
}
|
||||
}
|
||||
|
||||
impl std::cmp::PartialEq for ExtendedSpendingKey {
|
||||
fn eq(&self, rhs: &ExtendedSpendingKey) -> bool {
|
||||
self.depth == rhs.depth
|
||||
&& self.parent_fvk_tag == rhs.parent_fvk_tag
|
||||
&& self.child_index == rhs.child_index
|
||||
&& self.chain_code == rhs.chain_code
|
||||
&& self.sk == rhs.sk
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(non_snake_case)]
|
||||
impl ExtendedSpendingKey {
|
||||
/// Returns the spending key of the child key corresponding to
|
||||
|
@ -240,16 +230,17 @@ mod tests {
|
|||
let xsk_m = ExtendedSpendingKey::master(&seed).unwrap();
|
||||
|
||||
let xsk_5h = xsk_m.derive_child(5.try_into().unwrap()).unwrap();
|
||||
assert_eq!(
|
||||
ExtendedSpendingKey::from_path(&seed, &[5.try_into().unwrap()]).unwrap(),
|
||||
xsk_5h
|
||||
);
|
||||
assert!(bool::from(
|
||||
ExtendedSpendingKey::from_path(&seed, &[5.try_into().unwrap()])
|
||||
.unwrap()
|
||||
.ct_eq(&xsk_5h)
|
||||
));
|
||||
|
||||
let xsk_5h_7 = xsk_5h.derive_child(7.try_into().unwrap()).unwrap();
|
||||
assert_eq!(
|
||||
assert!(bool::from(
|
||||
ExtendedSpendingKey::from_path(&seed, &[5.try_into().unwrap(), 7.try_into().unwrap()])
|
||||
.unwrap(),
|
||||
xsk_5h_7
|
||||
);
|
||||
.unwrap()
|
||||
.ct_eq(&xsk_5h_7)
|
||||
));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue