docs: fix typos in doc comments

This commit is contained in:
Bobbin Threadbare
2023-02-17 11:58:23 -08:00
parent 2d97153fd0
commit 3c9a5235a0
3 changed files with 12 additions and 10 deletions

View File

@@ -68,7 +68,7 @@ impl MerkleTree {
/// # Errors
/// Returns an error if:
/// * The specified depth is greater than the depth of the tree.
/// * The specified index not valid for the specified depth.
/// * The specified index is not valid for the specified depth.
pub fn get_node(&self, index: NodeIndex) -> Result<Word, MerkleError> {
if index.is_root() {
return Err(MerkleError::DepthTooSmall(index.depth()));
@@ -88,7 +88,7 @@ impl MerkleTree {
/// # Errors
/// Returns an error if:
/// * The specified depth is greater than the depth of the tree.
/// * The specified value not valid for the specified depth.
/// * The specified value is not valid for the specified depth.
pub fn get_path(&self, mut index: NodeIndex) -> Result<MerklePath, MerkleError> {
if index.is_root() {
return Err(MerkleError::DepthTooSmall(index.depth()));

View File

@@ -46,7 +46,7 @@ impl MerklePathSet {
///
/// # Errors
/// Returns an error if:
/// * The specified index not valid for the depth of structure.
/// * The specified index is not valid for the depth of structure.
/// * Requested node does not exist in the set.
pub fn get_node(&self, index: NodeIndex) -> Result<Word, MerkleError> {
if !index.with_depth(self.total_depth).is_valid() {
@@ -75,7 +75,7 @@ impl MerklePathSet {
///
/// # Errors
/// Returns an error if:
/// * The specified index not valid for the depth of structure.
/// * The specified index is not valid for the depth of structure.
/// * Node of the requested path does not exist in the set.
pub fn get_path(&self, index: NodeIndex) -> Result<MerklePath, MerkleError> {
if !index.with_depth(self.total_depth).is_valid() {
@@ -108,8 +108,8 @@ impl MerklePathSet {
///
/// # Errors
/// Returns an error if:
/// - The specified index is not valid in the context of this Merkle path set (i.e., the index
/// implies a greater depth than is specified for this set).
/// - The specified index is is not valid in the context of this Merkle path set (i.e., the
/// index implies a greater depth than is specified for this set).
/// - The specified path is not consistent with other paths in the set (i.e., resolves to a
/// different root).
pub fn add_path(
@@ -140,7 +140,8 @@ impl MerklePathSet {
Rpo256::merge(&index.build_node(root.into(), hash.into())).into()
});
// TODO review and document this logic
// if the path set is empty (the root is all ZEROs), set the root to the root of the added
// path; otherwise, the root of the added path must be identical to the current root
if self.root == [ZERO; 4] {
self.root = root;
} else if self.root != root {