Skip to content

Commit

Permalink
commit: improve error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-orlovsky committed Dec 25, 2023
1 parent 6b634bc commit 2ec2bca
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 14 deletions.
5 changes: 2 additions & 3 deletions commit_verify/src/commit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,9 @@ use crate::CommitmentProtocol;
#[derive(Copy, Clone, Eq, PartialEq, Debug, Display, Error)]
#[display(doc_comments)]
pub enum VerifyError {
/// The verified commitment doesn't commit to the provided message.
/// commitment doesn't match the message.
InvalidCommitment,
/// The message is invalid since a commitment to it can't be created /
/// exist.
/// the message is invalid since a valid commitment to it can't be created.
InvalidMessage,
}

Expand Down
7 changes: 3 additions & 4 deletions commit_verify/src/convolve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,13 @@ use crate::{CommitEncode, CommitmentProtocol, VerifyEq};
serde(crate = "serde_crate", rename_all = "camelCase")
)]
pub enum ConvolveVerifyError {
/// The verified commitment doesn't commit to the provided message.
/// commitment doesn't match the message.
CommitmentMismatch,

/// The message is invalid since a valid commitment to it can't be created.
/// the message is invalid since a valid commitment to it can't be created.
ImpossibleMessage,

/// The proof of the commitment is invalid and the commitment can't be
/// verified.
/// the proof is invalid and the commitment can't be verified.
InvalidProof,
}

Expand Down
13 changes: 6 additions & 7 deletions commit_verify/src/embed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,21 @@ use crate::{CommitEncode, CommitmentProtocol};
#[derive(Copy, Clone, Eq, PartialEq, Debug, Display, Error, From)]
#[display(doc_comments)]
pub enum EmbedVerifyError<E: std::error::Error> {
/// The verified commitment doesn't commit to the provided message.
/// commitment doesn't match the message.
CommitmentMismatch,

/// The message is invalid since a commitment to it can't be created /
/// exist.
/// the message is invalid since a valid commitment to it can't be created.
///
/// Details: {0}
#[from]
InvalidMessage(E),

/// The proof of the commitment is invalid and the commitment can't be
/// verified since the original container can't be restored from it.
/// the proof is invalid and the commitment can't be verified since the
/// original container can't be restored from it.
InvalidProof,

/// The proof of the commitment does not match to the proof generated for
/// the same message during the verification.
/// the proof does not match to the proof generated for the same message
/// during the verification.
ProofMismatch,
}

Expand Down

0 comments on commit 2ec2bca

Please sign in to comment.