Skip to content

Commit

Permalink
Adding various docs to clarify structs / traits (solana-labs#140)
Browse files Browse the repository at this point in the history
* Adding various docs to clarify structs / traits

Intended to be viewed via `docs.rs`. Locally, run `cargo doc --open` to preview

* Addressing comments
  • Loading branch information
jnwng authored Jul 11, 2022
1 parent f458216 commit b903cf0
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions lib/concurrent-merkle-tree/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,35 @@ use thiserror::Error;

#[derive(Error, Debug)]
pub enum CMTError {
/// Received an index larger than the rightmost index
#[error("Received an index larger than the rightmost index")]
LeafIndexOutOfBounds,

/// Invalid root recomputed from proof
#[error("Invalid root recomputed from proof")]
InvalidProof,

/// Node to append cannot be empty
#[error("Cannot append an empty node")]
CannotAppendEmptyNode,

/// The tree is at capacity
#[error("Tree is full, cannot append")]
TreeFull,

/// This tree has already been initialized
#[error("Tree already initialized")]
TreeAlreadyInitialized,

/// Invalid number of bytes passed for node (expected 32 bytes)
#[error("Invalid number of bytes passed for node (expected 32 bytes)")]
InvalidNodeByteLength,

/// Fast forward error: we cannot find a valid point to fast-forward the current proof from
#[error("Root not found in changelog buffer")]
RootNotFound,

/// Valid proof was passed to a leaf, but it's value has changed since the proof was issued
#[error(
"Valid proof was passed to a leaf, but it's value has changed since the proof was issued"
)]
Expand Down

0 comments on commit b903cf0

Please sign in to comment.