thiserror 2.0, cargo update

This commit is contained in:
Luke Parker
2024-12-08 21:55:37 -05:00
parent 3192370484
commit 18897978d0
35 changed files with 645 additions and 667 deletions

View File

@@ -18,7 +18,7 @@ workspace = true
[dependencies]
std-shims = { path = "../../../../common/std-shims", version = "^0.1.1", default-features = false }
thiserror = { version = "1", default-features = false, optional = true }
thiserror = { version = "2", default-features = false }
rand_core = { version = "0.6", default-features = false }
zeroize = { version = "^1.5", default-features = false, features = ["zeroize_derive"] }
@@ -42,7 +42,7 @@ hex-literal = "0.4"
std = [
"std-shims/std",
"thiserror",
"thiserror/std",
"rand_core/std",
"zeroize/std",

View File

@@ -45,14 +45,13 @@ use crate::plus::{
mod tests;
/// An error from proving/verifying Bulletproofs(+).
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
#[cfg_attr(feature = "std", derive(thiserror::Error))]
#[derive(Clone, Copy, PartialEq, Eq, Debug, thiserror::Error)]
pub enum BulletproofError {
/// Proving/verifying a Bulletproof(+) range proof with no commitments.
#[cfg_attr(feature = "std", error("no commitments to prove the range for"))]
#[error("no commitments to prove the range for")]
NoCommitments,
/// Proving/verifying a Bulletproof(+) range proof with more commitments than supported.
#[cfg_attr(feature = "std", error("too many commitments to prove the range for"))]
#[error("too many commitments to prove the range for")]
TooManyCommitments,
}

View File

@@ -18,7 +18,7 @@ workspace = true
[dependencies]
std-shims = { path = "../../../../common/std-shims", version = "^0.1.1", default-features = false }
thiserror = { version = "1", default-features = false, optional = true }
thiserror = { version = "2", default-features = false }
rand_core = { version = "0.6", default-features = false }
zeroize = { version = "^1.5", default-features = false, features = ["zeroize_derive"] }
@@ -46,7 +46,7 @@ frost = { package = "modular-frost", path = "../../../../crypto/frost", default-
std = [
"std-shims/std",
"thiserror",
"thiserror/std",
"rand_core/std",
"zeroize/std",

View File

@@ -36,29 +36,28 @@ pub use multisig::{ClsagMultisigMaskSender, ClsagAddendum, ClsagMultisig};
mod tests;
/// Errors when working with CLSAGs.
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
#[cfg_attr(feature = "std", derive(thiserror::Error))]
#[derive(Clone, Copy, PartialEq, Eq, Debug, thiserror::Error)]
pub enum ClsagError {
/// The ring was invalid (such as being too small or too large).
#[cfg_attr(feature = "std", error("invalid ring"))]
#[error("invalid ring")]
InvalidRing,
/// The discrete logarithm of the key, scaling G, wasn't equivalent to the signing ring member.
#[cfg_attr(feature = "std", error("invalid commitment"))]
#[error("invalid commitment")]
InvalidKey,
/// The commitment opening provided did not match the ring member's.
#[cfg_attr(feature = "std", error("invalid commitment"))]
#[error("invalid commitment")]
InvalidCommitment,
/// The key image was invalid (such as being identity or torsioned)
#[cfg_attr(feature = "std", error("invalid key image"))]
#[error("invalid key image")]
InvalidImage,
/// The `D` component was invalid.
#[cfg_attr(feature = "std", error("invalid D"))]
#[error("invalid D")]
InvalidD,
/// The `s` vector was invalid.
#[cfg_attr(feature = "std", error("invalid s"))]
#[error("invalid s")]
InvalidS,
/// The `c1` variable was invalid.
#[cfg_attr(feature = "std", error("invalid c1"))]
#[error("invalid c1")]
InvalidC1,
}

View File

@@ -18,7 +18,7 @@ workspace = true
[dependencies]
std-shims = { path = "../../../../common/std-shims", version = "^0.1.1", default-features = false }
thiserror = { version = "1", default-features = false, optional = true }
thiserror = { version = "2", default-features = false }
zeroize = { version = "^1.5", default-features = false, features = ["zeroize_derive"] }
@@ -34,7 +34,7 @@ monero-primitives = { path = "../../primitives", version = "0.1", default-featur
std = [
"std-shims/std",
"thiserror",
"thiserror/std",
"zeroize/std",

View File

@@ -19,23 +19,22 @@ use monero_generators::{H, hash_to_point};
use monero_primitives::keccak256_to_scalar;
/// Errors when working with MLSAGs.
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
#[cfg_attr(feature = "std", derive(thiserror::Error))]
#[derive(Clone, Copy, PartialEq, Eq, Debug, thiserror::Error)]
pub enum MlsagError {
/// Invalid ring (such as too small or too large).
#[cfg_attr(feature = "std", error("invalid ring"))]
#[error("invalid ring")]
InvalidRing,
/// Invalid amount of key images.
#[cfg_attr(feature = "std", error("invalid amount of key images"))]
#[error("invalid amount of key images")]
InvalidAmountOfKeyImages,
/// Invalid ss matrix.
#[cfg_attr(feature = "std", error("invalid ss"))]
#[error("invalid ss")]
InvalidSs,
/// Invalid key image.
#[cfg_attr(feature = "std", error("invalid key image"))]
#[error("invalid key image")]
InvalidKeyImage,
/// Invalid ci vector.
#[cfg_attr(feature = "std", error("invalid ci"))]
#[error("invalid ci")]
InvalidCi,
}