Bundle, V> {
+impl Bundle, V> {
/// Loads the sighash into this bundle, preparing it for signing.
///
/// This API ensures that all signatures are created over the same sighash.
@@ -534,7 +535,7 @@ impl Bundle, V> {
}
}
-impl
Bundle, V> {
+impl Bundle, V> {
/// Signs this bundle with the given [`SpendAuthorizingKey`].
///
/// This will apply signatures for all notes controlled by this spending key.
@@ -679,9 +680,9 @@ pub mod testing {
for note in notes.iter() {
let leaf = MerkleHashOrchard::from_cmx(¬e.commitment().into());
tree.append(&leaf);
- tree.witness();
+ let (position, leaf) = tree.witness().expect("tree is not empty");
- let path = tree.authentication_path(&leaf).unwrap().into();
+ let path = MerklePath::from((position, tree.authentication_path(position, &leaf).expect("we just witnessed the path")));
notes_and_auth_paths.push((*note, path));
}
diff --git a/src/bundle.rs b/src/bundle.rs
index 4c0454c0..8f6de3d5 100644
--- a/src/bundle.rs
+++ b/src/bundle.rs
@@ -3,6 +3,7 @@
pub mod commitments;
use std::convert::TryInto;
+use std::fmt;
use std::io;
use blake2b_simd::Hash as Blake2bHash;
@@ -230,9 +231,9 @@ impl Flags {
}
/// Defines the authorization type of an Orchard bundle.
-pub trait Authorization {
+pub trait Authorization: fmt::Debug {
/// The authorization type of an Orchard action.
- type SpendAuth;
+ type SpendAuth: fmt::Debug;
}
/// A bundle of actions to be applied to the ledger.
diff --git a/src/keys.rs b/src/keys.rs
index 698e2010..3e135c22 100644
--- a/src/keys.rs
+++ b/src/keys.rs
@@ -407,12 +407,12 @@ impl FullViewingKey {
/// Derives an internal full viewing key from a full viewing key, as specified in [ZIP32][orchardinternalfullviewingkey]
///
/// [orchardinternalfullviewingkey]: https://zips.z.cash/zip-0032#orchard-internal-key-derivation
- pub fn derive_internal(&self) -> Option {
- Some(FullViewingKey {
+ pub fn derive_internal(&self) -> Self {
+ FullViewingKey {
ak: self.ak.clone(),
nk: self.nk,
rivk: self.rivk_internal(),
- })
+ }
}
}
@@ -981,7 +981,7 @@ mod tests {
let internal_rivk = fvk.rivk_internal();
assert_eq!(internal_rivk.0.to_repr(), tv.internal_rivk);
- let internal_fvk = fvk.derive_internal().unwrap();
+ let internal_fvk = fvk.derive_internal();
assert_eq!(internal_rivk, *internal_fvk.rivk());
let internal_ivk: KeyAgreementPrivateKey = (&internal_fvk).into();
diff --git a/src/lib.rs b/src/lib.rs
index d0078466..b3579899 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -11,7 +11,7 @@
// Temporary until we have more of the crate implemented.
#![allow(dead_code)]
// Catch documentation errors caused by code changes.
-#![deny(broken_intra_doc_links)]
+#![deny(rustdoc::broken_intra_doc_links)]
#![deny(missing_debug_implementations)]
#![deny(missing_docs)]
#![deny(unsafe_code)]
diff --git a/src/note/nullifier.rs b/src/note/nullifier.rs
index db2c583d..17b9d5c3 100644
--- a/src/note/nullifier.rs
+++ b/src/note/nullifier.rs
@@ -11,7 +11,7 @@ use crate::{
};
/// A unique nullifier for a note.
-#[derive(Clone, Copy, Debug)]
+#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord)]
pub struct Nullifier(pub(crate) pallas::Base);
impl Nullifier {
diff --git a/src/tree.rs b/src/tree.rs
index 729529f1..874d08e0 100644
--- a/src/tree.rs
+++ b/src/tree.rs
@@ -19,7 +19,7 @@ use serde::de::{Deserializer, Error};
use serde::ser::Serializer;
use serde::{Deserialize, Serialize};
use std::iter;
-use subtle::{Choice, ConditionallySelectable, ConstantTimeEq, CtOption};
+use subtle::{Choice, ConditionallySelectable, CtOption};
// The uncommitted leaf is defined as pallas::Base(2).
//
@@ -160,7 +160,7 @@ impl MerklePath {
/// A newtype wrapper for leaves and internal nodes in the Orchard
/// incremental note commitment tree.
-#[derive(Copy, Clone, Debug)]
+#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
pub struct MerkleHashOrchard(pallas::Base);
impl MerkleHashOrchard {
@@ -190,25 +190,6 @@ impl MerkleHashOrchard {
}
}
-/// This instance should only be used for hash table key comparisons.
-impl std::cmp::PartialEq for MerkleHashOrchard {
- fn eq(&self, other: &Self) -> bool {
- self.0.ct_eq(&other.0).into()
- }
-}
-
-/// This instance should only be used for hash table key comparisons.
-impl std::cmp::Eq for MerkleHashOrchard {}
-
-/// This instance should only be used for hash table key hashing.
-impl std::hash::Hash for MerkleHashOrchard {
- fn hash(&self, state: &mut H) {
-