Skip to content

Commit 29fad78

Browse files
committed
Add a conversion from ProofError to R1CSError.
In the long term, I think that it would be better to combine R1CSError with ProofError, if we can do that without breaking stability. If not, we should refactor the TranscriptProtocol so that it returns a TranscriptError type that can be converted into either a ProofError or an R1CSError.
1 parent 66c4a72 commit 29fad78

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/errors.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@ pub enum MPCError {
9191
}
9292

9393
/// Represents an error during the proving or verifying of a constraint system.
94+
///
95+
/// XXX: should this be separate from a `ProofError`?
9496
#[cfg(feature = "yoloproofs")]
9597
#[derive(Fail, Clone, Debug, Eq, PartialEq)]
9698
pub enum R1CSError {
@@ -118,3 +120,15 @@ pub enum R1CSError {
118120
description: String,
119121
},
120122
}
123+
124+
#[cfg(feature = "yoloproofs")]
125+
impl From<ProofError> for R1CSError {
126+
fn from(e: ProofError) -> R1CSError {
127+
match e {
128+
ProofError::InvalidGeneratorsLength => R1CSError::InvalidGeneratorsLength,
129+
ProofError::FormatError => R1CSError::FormatError,
130+
ProofError::VerificationError => R1CSError::VerificationError,
131+
_ => panic!("unexpected error type in conversion"),
132+
}
133+
}
134+
}

0 commit comments

Comments
 (0)