thiserror 2.0, cargo update

This commit is contained in:
Luke Parker 2024-12-08 21:55:37 -05:00
parent 3192370484
commit 18897978d0
No known key found for this signature in database
35 changed files with 645 additions and 667 deletions

1075
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -18,7 +18,7 @@ workspace = true
[dependencies] [dependencies]
spin = { version = "0.9", default-features = false, features = ["use_ticket_mutex", "lazy"] } spin = { version = "0.9", default-features = false, features = ["use_ticket_mutex", "lazy"] }
hashbrown = { version = "0.14", default-features = false, features = ["ahash", "inline-more"] } hashbrown = { version = "0.15", default-features = false, features = ["default-hasher", "inline-more"] }
[features] [features]
std = [] std = []

View file

@ -8,6 +8,7 @@ authors = ["Luke Parker <lukeparker5132@gmail.com>"]
keywords = [] keywords = []
edition = "2021" edition = "2021"
publish = false publish = false
rust-version = "1.81"
[package.metadata.docs.rs] [package.metadata.docs.rs]
all-features = true all-features = true

View file

@ -6,6 +6,7 @@ license = "AGPL-3.0-only"
repository = "https://github.com/serai-dex/serai/tree/develop/coordinator/tributary" repository = "https://github.com/serai-dex/serai/tree/develop/coordinator/tributary"
authors = ["Luke Parker <lukeparker5132@gmail.com>"] authors = ["Luke Parker <lukeparker5132@gmail.com>"]
edition = "2021" edition = "2021"
rust-version = "1.81"
[package.metadata.docs.rs] [package.metadata.docs.rs]
all-features = true all-features = true
@ -16,7 +17,7 @@ workspace = true
[dependencies] [dependencies]
async-trait = { version = "0.1", default-features = false } async-trait = { version = "0.1", default-features = false }
thiserror = { version = "1", default-features = false } thiserror = { version = "2", default-features = false, features = ["std"] }
subtle = { version = "^2", default-features = false, features = ["std"] } subtle = { version = "^2", default-features = false, features = ["std"] }
zeroize = { version = "^1.5", default-features = false, features = ["std"] } zeroize = { version = "^1.5", default-features = false, features = ["std"] }

View file

@ -6,6 +6,7 @@ license = "MIT"
repository = "https://github.com/serai-dex/serai/tree/develop/coordinator/tendermint" repository = "https://github.com/serai-dex/serai/tree/develop/coordinator/tendermint"
authors = ["Luke Parker <lukeparker5132@gmail.com>"] authors = ["Luke Parker <lukeparker5132@gmail.com>"]
edition = "2021" edition = "2021"
rust-version = "1.81"
[package.metadata.docs.rs] [package.metadata.docs.rs]
all-features = true all-features = true
@ -16,7 +17,7 @@ workspace = true
[dependencies] [dependencies]
async-trait = { version = "0.1", default-features = false } async-trait = { version = "0.1", default-features = false }
thiserror = { version = "1", default-features = false } thiserror = { version = "2", default-features = false, features = ["std"] }
hex = { version = "0.4", default-features = false, features = ["std"] } hex = { version = "0.4", default-features = false, features = ["std"] }
log = { version = "0.4", default-features = false, features = ["std"] } log = { version = "0.4", default-features = false, features = ["std"] }

View file

@ -7,7 +7,7 @@ repository = "https://github.com/serai-dex/serai/tree/develop/crypto/dkg"
authors = ["Luke Parker <lukeparker5132@gmail.com>"] authors = ["Luke Parker <lukeparker5132@gmail.com>"]
keywords = ["dkg", "multisig", "threshold", "ff", "group"] keywords = ["dkg", "multisig", "threshold", "ff", "group"]
edition = "2021" edition = "2021"
rust-version = "1.80" rust-version = "1.81"
[package.metadata.docs.rs] [package.metadata.docs.rs]
all-features = true all-features = true
@ -17,7 +17,7 @@ rustdoc-args = ["--cfg", "docsrs"]
workspace = true workspace = true
[dependencies] [dependencies]
thiserror = { version = "1", default-features = false, optional = true } thiserror = { version = "2", default-features = false }
rand_core = { version = "0.6", default-features = false } rand_core = { version = "0.6", default-features = false }
@ -58,7 +58,7 @@ pasta_curves = "0.5"
[features] [features]
std = [ std = [
"thiserror", "thiserror/std",
"rand_core/std", "rand_core/std",

View file

@ -4,7 +4,6 @@
use core::fmt::{self, Debug}; use core::fmt::{self, Debug};
#[cfg(feature = "std")]
use thiserror::Error; use thiserror::Error;
use zeroize::Zeroize; use zeroize::Zeroize;
@ -67,8 +66,7 @@ impl fmt::Display for Participant {
} }
/// Various errors possible during key generation. /// Various errors possible during key generation.
#[derive(Clone, PartialEq, Eq, Debug)] #[derive(Clone, PartialEq, Eq, Debug, Error)]
#[cfg_attr(feature = "std", derive(Error))]
pub enum DkgError<B: Clone + PartialEq + Eq + Debug> { pub enum DkgError<B: Clone + PartialEq + Eq + Debug> {
/// A parameter was zero. /// A parameter was zero.
#[cfg_attr(feature = "std", error("a parameter was 0 (threshold {0}, participants {1})"))] #[cfg_attr(feature = "std", error("a parameter was 0 (threshold {0}, participants {1})"))]

View file

@ -6,7 +6,7 @@ license = "MIT"
repository = "https://github.com/serai-dex/serai/tree/develop/crypto/dleq" repository = "https://github.com/serai-dex/serai/tree/develop/crypto/dleq"
authors = ["Luke Parker <lukeparker5132@gmail.com>"] authors = ["Luke Parker <lukeparker5132@gmail.com>"]
edition = "2021" edition = "2021"
rust-version = "1.79" rust-version = "1.81"
[package.metadata.docs.rs] [package.metadata.docs.rs]
all-features = true all-features = true
@ -18,7 +18,7 @@ workspace = true
[dependencies] [dependencies]
rustversion = "1" rustversion = "1"
thiserror = { version = "1", optional = true } thiserror = { version = "2", default-features = false, optional = true }
rand_core = { version = "0.6", default-features = false } rand_core = { version = "0.6", default-features = false }
zeroize = { version = "^1.5", default-features = false, features = ["zeroize_derive"] } zeroize = { version = "^1.5", default-features = false, features = ["zeroize_derive"] }
@ -44,7 +44,7 @@ dalek-ff-group = { path = "../dalek-ff-group" }
transcript = { package = "flexible-transcript", path = "../transcript", features = ["recommended"] } transcript = { package = "flexible-transcript", path = "../transcript", features = ["recommended"] }
[features] [features]
std = ["rand_core/std", "zeroize/std", "digest/std", "transcript/std", "ff/std", "multiexp?/std"] std = ["thiserror?/std", "rand_core/std", "zeroize/std", "digest/std", "transcript/std", "ff/std", "multiexp?/std"]
serialize = ["std"] serialize = ["std"]
# Needed for cross-group DLEqs # Needed for cross-group DLEqs

View file

@ -92,7 +92,7 @@ impl<G: PrimeGroup> Generators<G> {
} }
/// Error for cross-group DLEq proofs. /// Error for cross-group DLEq proofs.
#[derive(Error, PartialEq, Eq, Debug)] #[derive(Clone, Copy, PartialEq, Eq, Debug, Error)]
pub enum DLEqError { pub enum DLEqError {
/// Invalid proof length. /// Invalid proof length.
#[error("invalid proof length")] #[error("invalid proof length")]

View file

@ -22,7 +22,7 @@ rand_core = { version = "0.6", default-features = false, features = ["std"] }
zeroize = { version = "^1.5", default-features = false, features = ["std", "zeroize_derive"] } zeroize = { version = "^1.5", default-features = false, features = ["std", "zeroize_derive"] }
subtle = { version = "^2.4", default-features = false, features = ["std"] } subtle = { version = "^2.4", default-features = false, features = ["std"] }
generic-array = { version = "0.14", default-features = false } generic-array = { version = "1", default-features = false }
crypto-bigint = { version = "0.5", default-features = false, features = ["zeroize"] } crypto-bigint = { version = "0.5", default-features = false, features = ["zeroize"] }
dalek-ff-group = { path = "../../dalek-ff-group", version = "0.4", default-features = false } dalek-ff-group = { path = "../../dalek-ff-group", version = "0.4", default-features = false }

View file

@ -17,7 +17,7 @@ rustdoc-args = ["--cfg", "docsrs"]
workspace = true workspace = true
[dependencies] [dependencies]
thiserror = "1" thiserror = { version = "2", default-features = false, features = ["std"] }
rand_core = { version = "0.6", default-features = false, features = ["std"] } rand_core = { version = "0.6", default-features = false, features = ["std"] }
rand_chacha = { version = "0.3", default-features = false, features = ["std"] } rand_chacha = { version = "0.3", default-features = false, features = ["std"] }

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -18,7 +18,7 @@ workspace = true
[dependencies] [dependencies]
std-shims = { path = "../../../../common/std-shims", version = "^0.1.1", default-features = false } 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"] } 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 = [
"std-shims/std", "std-shims/std",
"thiserror", "thiserror/std",
"zeroize/std", "zeroize/std",

View file

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

View file

@ -18,7 +18,7 @@ workspace = true
[dependencies] [dependencies]
std-shims = { path = "../../../common/std-shims", version = "^0.1.1", default-features = false } 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"] } zeroize = { version = "^1.5", default-features = false, features = ["zeroize_derive"] }
hex = { version = "0.4", default-features = false, features = ["alloc"] } hex = { version = "0.4", default-features = false, features = ["alloc"] }
@ -34,7 +34,7 @@ monero-address = { path = "../wallet/address", default-features = false }
std = [ std = [
"std-shims/std", "std-shims/std",
"thiserror", "thiserror/std",
"zeroize/std", "zeroize/std",
"hex/std", "hex/std",

View file

@ -42,34 +42,33 @@ const GRACE_BLOCKS_FOR_FEE_ESTIMATE: u64 = 10;
const TXS_PER_REQUEST: usize = 100; const TXS_PER_REQUEST: usize = 100;
/// An error from the RPC. /// An error from the RPC.
#[derive(Clone, PartialEq, Eq, Debug)] #[derive(Clone, PartialEq, Eq, Debug, thiserror::Error)]
#[cfg_attr(feature = "std", derive(thiserror::Error))]
pub enum RpcError { pub enum RpcError {
/// An internal error. /// An internal error.
#[cfg_attr(feature = "std", error("internal error ({0})"))] #[error("internal error ({0})")]
InternalError(String), InternalError(String),
/// A connection error with the node. /// A connection error with the node.
#[cfg_attr(feature = "std", error("connection error ({0})"))] #[error("connection error ({0})")]
ConnectionError(String), ConnectionError(String),
/// The node is invalid per the expected protocol. /// The node is invalid per the expected protocol.
#[cfg_attr(feature = "std", error("invalid node ({0})"))] #[error("invalid node ({0})")]
InvalidNode(String), InvalidNode(String),
/// Requested transactions weren't found. /// Requested transactions weren't found.
#[cfg_attr(feature = "std", error("transactions not found"))] #[error("transactions not found")]
TransactionsNotFound(Vec<[u8; 32]>), TransactionsNotFound(Vec<[u8; 32]>),
/// The transaction was pruned. /// The transaction was pruned.
/// ///
/// Pruned transactions are not supported at this time. /// Pruned transactions are not supported at this time.
#[cfg_attr(feature = "std", error("pruned transaction"))] #[error("pruned transaction")]
PrunedTransaction, PrunedTransaction,
/// A transaction (sent or received) was invalid. /// A transaction (sent or received) was invalid.
#[cfg_attr(feature = "std", error("invalid transaction ({0:?})"))] #[error("invalid transaction ({0:?})")]
InvalidTransaction([u8; 32]), InvalidTransaction([u8; 32]),
/// The returned fee was unusable. /// The returned fee was unusable.
#[cfg_attr(feature = "std", error("unexpected fee response"))] #[error("unexpected fee response")]
InvalidFee, InvalidFee,
/// The priority intended for use wasn't usable. /// The priority intended for use wasn't usable.
#[cfg_attr(feature = "std", error("invalid priority"))] #[error("invalid priority")]
InvalidPriority, InvalidPriority,
} }

View file

@ -21,7 +21,7 @@ workspace = true
[dependencies] [dependencies]
std-shims = { path = "../../../common/std-shims", version = "^0.1.1", default-features = false } 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"] } zeroize = { version = "^1.5", default-features = false, features = ["zeroize_derive"] }
@ -61,7 +61,7 @@ monero-simple-request-rpc = { path = "../rpc/simple-request", default-features =
std = [ std = [
"std-shims/std", "std-shims/std",
"thiserror", "thiserror/std",
"zeroize/std", "zeroize/std",

View file

@ -18,7 +18,7 @@ workspace = true
[dependencies] [dependencies]
std-shims = { path = "../../../../common/std-shims", version = "^0.1.1", default-features = false } 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"] } zeroize = { version = "^1.5", default-features = false, features = ["zeroize_derive"] }
@ -40,7 +40,7 @@ serde_json = { version = "1", default-features = false, features = ["alloc"] }
std = [ std = [
"std-shims/std", "std-shims/std",
"thiserror", "thiserror/std",
"zeroize/std", "zeroize/std",

View file

@ -199,29 +199,25 @@ pub enum Network {
} }
/// Errors when decoding an address. /// Errors when decoding an address.
#[derive(Clone, Copy, PartialEq, Eq, Debug)] #[derive(Clone, Copy, PartialEq, Eq, Debug, thiserror::Error)]
#[cfg_attr(feature = "std", derive(thiserror::Error))]
pub enum AddressError { pub enum AddressError {
/// The address had an invalid (network, type) byte. /// The address had an invalid (network, type) byte.
#[cfg_attr(feature = "std", error("invalid byte for the address's network/type ({0})"))] #[error("invalid byte for the address's network/type ({0})")]
InvalidTypeByte(u8), InvalidTypeByte(u8),
/// The address wasn't a valid Base58Check (as defined by Monero) string. /// The address wasn't a valid Base58Check (as defined by Monero) string.
#[cfg_attr(feature = "std", error("invalid address encoding"))] #[error("invalid address encoding")]
InvalidEncoding, InvalidEncoding,
/// The data encoded wasn't the proper length. /// The data encoded wasn't the proper length.
#[cfg_attr(feature = "std", error("invalid length"))] #[error("invalid length")]
InvalidLength, InvalidLength,
/// The address had an invalid key. /// The address had an invalid key.
#[cfg_attr(feature = "std", error("invalid key"))] #[error("invalid key")]
InvalidKey, InvalidKey,
/// The address was featured with unrecognized features. /// The address was featured with unrecognized features.
#[cfg_attr(feature = "std", error("unknown features"))] #[error("unknown features")]
UnknownFeatures(u64), UnknownFeatures(u64),
/// The network was for a different network than expected. /// The network was for a different network than expected.
#[cfg_attr( #[error("different network ({actual:?}) than expected ({expected:?})")]
feature = "std",
error("different network ({actual:?}) than expected ({expected:?})")
)]
DifferentNetwork { DifferentNetwork {
/// The Network expected. /// The Network expected.
expected: Network, expected: Network,

View file

@ -18,7 +18,7 @@ workspace = true
[dependencies] [dependencies]
std-shims = { path = "../../../../common/std-shims", version = "^0.1.1", default-features = false } 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 }
subtle = { version = "^2.4", default-features = false } subtle = { version = "^2.4", default-features = false }
zeroize = { version = "^1.5", default-features = false, features = ["zeroize_derive"] } zeroize = { version = "^1.5", default-features = false, features = ["zeroize_derive"] }
@ -34,7 +34,7 @@ hex = { version = "0.4", default-features = false, features = ["std"] }
std = [ std = [
"std-shims/std", "std-shims/std",
"thiserror", "thiserror/std",
"subtle/std", "subtle/std",
"zeroize/std", "zeroize/std",

View file

@ -106,20 +106,19 @@ const POLYSEED_KEYGEN_ITERATIONS: u32 = 10000;
const COIN: u16 = 0; const COIN: u16 = 0;
/// An error when working with a Polyseed. /// An error when working with a Polyseed.
#[derive(Clone, Copy, PartialEq, Eq, Debug)] #[derive(Clone, Copy, PartialEq, Eq, Debug, thiserror::Error)]
#[cfg_attr(feature = "std", derive(thiserror::Error))]
pub enum PolyseedError { pub enum PolyseedError {
/// The seed was invalid. /// The seed was invalid.
#[cfg_attr(feature = "std", error("invalid seed"))] #[error("invalid seed")]
InvalidSeed, InvalidSeed,
/// The entropy was invalid. /// The entropy was invalid.
#[cfg_attr(feature = "std", error("invalid entropy"))] #[error("invalid entropy")]
InvalidEntropy, InvalidEntropy,
/// The checksum did not match the data. /// The checksum did not match the data.
#[cfg_attr(feature = "std", error("invalid checksum"))] #[error("invalid checksum")]
InvalidChecksum, InvalidChecksum,
/// Unsupported feature bits were set. /// Unsupported feature bits were set.
#[cfg_attr(feature = "std", error("unsupported features"))] #[error("unsupported features")]
UnsupportedFeatures, UnsupportedFeatures,
} }

View file

@ -18,7 +18,7 @@ workspace = true
[dependencies] [dependencies]
std-shims = { path = "../../../../common/std-shims", version = "^0.1.1", default-features = false } 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"] } zeroize = { version = "^1.5", default-features = false, features = ["zeroize_derive"] }
rand_core = { version = "0.6", default-features = false } rand_core = { version = "0.6", default-features = false }
@ -33,7 +33,7 @@ monero-primitives = { path = "../../primitives", default-features = false, featu
std = [ std = [
"std-shims/std", "std-shims/std",
"thiserror", "thiserror/std",
"zeroize/std", "zeroize/std",
"rand_core/std", "rand_core/std",

View file

@ -26,19 +26,18 @@ const SEED_LENGTH: usize = 24;
const SEED_LENGTH_WITH_CHECKSUM: usize = 25; const SEED_LENGTH_WITH_CHECKSUM: usize = 25;
/// An error when working with a seed. /// An error when working with a seed.
#[derive(Clone, Copy, PartialEq, Eq, Debug)] #[derive(Clone, Copy, PartialEq, Eq, Debug, thiserror::Error)]
#[cfg_attr(feature = "std", derive(thiserror::Error))]
pub enum SeedError { pub enum SeedError {
#[cfg_attr(feature = "std", error("invalid seed"))] #[error("invalid seed")]
/// The seed was invalid. /// The seed was invalid.
InvalidSeed, InvalidSeed,
/// The checksum did not match the data. /// The checksum did not match the data.
#[cfg_attr(feature = "std", error("invalid checksum"))] #[error("invalid checksum")]
InvalidChecksum, InvalidChecksum,
/// The deprecated English language option was used with a checksum. /// The deprecated English language option was used with a checksum.
/// ///
/// The deprecated English language option did not include a checksum. /// The deprecated English language option did not include a checksum.
#[cfg_attr(feature = "std", error("deprecated English language option included a checksum"))] #[error("deprecated English language option included a checksum")]
DeprecatedEnglishWithChecksum, DeprecatedEnglishWithChecksum,
} }

View file

@ -67,14 +67,13 @@ impl Timelocked {
} }
/// Errors when scanning a block. /// Errors when scanning a block.
#[derive(Clone, Copy, PartialEq, Eq, Debug)] #[derive(Clone, Copy, PartialEq, Eq, Debug, thiserror::Error)]
#[cfg_attr(feature = "std", derive(thiserror::Error))]
pub enum ScanError { pub enum ScanError {
/// The block was for an unsupported protocol version. /// The block was for an unsupported protocol version.
#[cfg_attr(feature = "std", error("unsupported protocol version ({0})"))] #[error("unsupported protocol version ({0})")]
UnsupportedProtocol(u8), UnsupportedProtocol(u8),
/// The ScannableBlock was invalid. /// The ScannableBlock was invalid.
#[cfg_attr(feature = "std", error("invalid scannable block ({0})"))] #[error("invalid scannable block ({0})")]
InvalidScannableBlock(&'static str), InvalidScannableBlock(&'static str),
} }

View file

@ -140,48 +140,44 @@ impl InternalPayment {
} }
/// An error while sending Monero. /// An error while sending Monero.
#[derive(Clone, PartialEq, Eq, Debug)] #[derive(Clone, PartialEq, Eq, Debug, thiserror::Error)]
#[cfg_attr(feature = "std", derive(thiserror::Error))]
pub enum SendError { pub enum SendError {
/// The RingCT type to produce proofs for this transaction with weren't supported. /// The RingCT type to produce proofs for this transaction with weren't supported.
#[cfg_attr(feature = "std", error("this library doesn't yet support that RctType"))] #[error("this library doesn't yet support that RctType")]
UnsupportedRctType, UnsupportedRctType,
/// The transaction had no inputs specified. /// The transaction had no inputs specified.
#[cfg_attr(feature = "std", error("no inputs"))] #[error("no inputs")]
NoInputs, NoInputs,
/// The decoy quantity was invalid for the specified RingCT type. /// The decoy quantity was invalid for the specified RingCT type.
#[cfg_attr(feature = "std", error("invalid number of decoys"))] #[error("invalid number of decoys")]
InvalidDecoyQuantity, InvalidDecoyQuantity,
/// The transaction had no outputs specified. /// The transaction had no outputs specified.
#[cfg_attr(feature = "std", error("no outputs"))] #[error("no outputs")]
NoOutputs, NoOutputs,
/// The transaction had too many outputs specified. /// The transaction had too many outputs specified.
#[cfg_attr(feature = "std", error("too many outputs"))] #[error("too many outputs")]
TooManyOutputs, TooManyOutputs,
/// The transaction did not have a change output, and did not have two outputs. /// The transaction did not have a change output, and did not have two outputs.
/// ///
/// Monero requires all transactions have at least two outputs, assuming one payment and one /// Monero requires all transactions have at least two outputs, assuming one payment and one
/// change (or at least one dummy and one change). Accordingly, specifying no change and only /// change (or at least one dummy and one change). Accordingly, specifying no change and only
/// one payment prevents creating a valid transaction /// one payment prevents creating a valid transaction
#[cfg_attr(feature = "std", error("only one output and no change address"))] #[error("only one output and no change address")]
NoChange, NoChange,
/// Multiple addresses had payment IDs specified. /// Multiple addresses had payment IDs specified.
/// ///o
/// Only one payment ID is allowed per transaction. /// Only one payment ID is allowed per transaction.
#[cfg_attr(feature = "std", error("multiple addresses with payment IDs"))] #[error("multiple addresses with payment IDs")]
MultiplePaymentIds, MultiplePaymentIds,
/// Too much arbitrary data was specified. /// Too much arbitrary data was specified.
#[cfg_attr(feature = "std", error("too much data"))] #[error("too much data")]
TooMuchArbitraryData, TooMuchArbitraryData,
/// The created transaction was too large. /// The created transaction was too large.
#[cfg_attr(feature = "std", error("too large of a transaction"))] #[error("too large of a transaction")]
TooLargeTransaction, TooLargeTransaction,
/// This transaction could not pay for itself. /// This transaction could not pay for itself.
#[cfg_attr( #[error(
feature = "std", "not enough funds (inputs {inputs}, outputs {outputs}, necessary_fee {necessary_fee:?})"
error(
"not enough funds (inputs {inputs}, outputs {outputs}, necessary_fee {necessary_fee:?})"
)
)] )]
NotEnoughFunds { NotEnoughFunds {
/// The amount of funds the inputs contributed. /// The amount of funds the inputs contributed.
@ -195,20 +191,17 @@ pub enum SendError {
necessary_fee: Option<u64>, necessary_fee: Option<u64>,
}, },
/// This transaction is being signed with the wrong private key. /// This transaction is being signed with the wrong private key.
#[cfg_attr(feature = "std", error("wrong spend private key"))] #[error("wrong spend private key")]
WrongPrivateKey, WrongPrivateKey,
/// This transaction was read from a bytestream which was malicious. /// This transaction was read from a bytestream which was malicious.
#[cfg_attr( #[error("this SignableTransaction was created by deserializing a malicious serialization")]
feature = "std",
error("this SignableTransaction was created by deserializing a malicious serialization")
)]
MaliciousSerialization, MaliciousSerialization,
/// There was an error when working with the CLSAGs. /// There was an error when working with the CLSAGs.
#[cfg_attr(feature = "std", error("clsag error ({0})"))] #[error("clsag error ({0})")]
ClsagError(ClsagError), ClsagError(ClsagError),
/// There was an error when working with FROST. /// There was an error when working with FROST.
#[cfg(feature = "multisig")] #[cfg(feature = "multisig")]
#[cfg_attr(feature = "std", error("frost error {0}"))] #[error("frost error {0}")]
FrostError(FrostError), FrostError(FrostError),
} }

View file

@ -10,8 +10,7 @@ use crate::{
}; };
/// An error while working with a ViewPair. /// An error while working with a ViewPair.
#[derive(Clone, PartialEq, Eq, Debug)] #[derive(Clone, PartialEq, Eq, Debug, thiserror::Error)]
#[cfg_attr(feature = "std", derive(thiserror::Error))]
pub enum ViewPairError { pub enum ViewPairError {
/// The spend key was torsioned. /// The spend key was torsioned.
/// ///
@ -20,7 +19,7 @@ pub enum ViewPairError {
// CLSAG seems to support it if the challenge does a torsion clear, FCMP++ should ship with a // CLSAG seems to support it if the challenge does a torsion clear, FCMP++ should ship with a
// torsion clear, yet it's not worth it to modify CLSAG sign to generate challenges until the // torsion clear, yet it's not worth it to modify CLSAG sign to generate challenges until the
// torsion clears and ensure spendability (nor can we reasonably guarantee that in the future) // torsion clears and ensure spendability (nor can we reasonably guarantee that in the future)
#[cfg_attr(feature = "std", error("torsioned spend key"))] #[error("torsioned spend key")]
TorsionedSpendKey, TorsionedSpendKey,
} }

View file

@ -18,7 +18,7 @@ workspace = true
[dependencies] [dependencies]
std-shims = { path = "../../../../common/std-shims", version = "^0.1.1", default-features = false } 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"] } zeroize = { version = "^1.5", default-features = false, features = ["zeroize_derive"] }
rand_core = { version = "0.6", default-features = false } rand_core = { version = "0.6", default-features = false }
@ -36,7 +36,7 @@ curve25519-dalek = { version = "4", default-features = false, features = ["alloc
std = [ std = [
"std-shims/std", "std-shims/std",
"thiserror", "thiserror/std",
"zeroize/std", "zeroize/std",
"rand_core/std", "rand_core/std",

View file

@ -11,20 +11,19 @@ use original::{SeedError as OriginalSeedError, Seed as OriginalSeed};
use polyseed::{PolyseedError, Polyseed}; use polyseed::{PolyseedError, Polyseed};
/// An error from working with seeds. /// An error from working with seeds.
#[derive(Clone, Copy, PartialEq, Eq, Debug)] #[derive(Clone, Copy, PartialEq, Eq, Debug, thiserror::Error)]
#[cfg_attr(feature = "std", derive(thiserror::Error))]
pub enum SeedError { pub enum SeedError {
/// The seed was invalid. /// The seed was invalid.
#[cfg_attr(feature = "std", error("invalid seed"))] #[error("invalid seed")]
InvalidSeed, InvalidSeed,
/// The entropy was invalid. /// The entropy was invalid.
#[cfg_attr(feature = "std", error("invalid entropy"))] #[error("invalid entropy")]
InvalidEntropy, InvalidEntropy,
/// The checksum did not match the data. /// The checksum did not match the data.
#[cfg_attr(feature = "std", error("invalid checksum"))] #[error("invalid checksum")]
InvalidChecksum, InvalidChecksum,
/// Unsupported features were enabled. /// Unsupported features were enabled.
#[cfg_attr(feature = "std", error("unsupported features"))] #[error("unsupported features")]
UnsupportedFeatures, UnsupportedFeatures,
} }

View file

@ -18,7 +18,7 @@ workspace = true
[dependencies] [dependencies]
zeroize = "^1.5" zeroize = "^1.5"
thiserror = { version = "1", optional = true } thiserror = { version = "2", default-features = false, optional = true }
bitvec = { version = "1", default-features = false, features = ["alloc", "serde"] } bitvec = { version = "1", default-features = false, features = ["alloc", "serde"] }
@ -60,7 +60,7 @@ dockertest = "0.5"
serai-docker-tests = { path = "../../tests/docker" } serai-docker-tests = { path = "../../tests/docker" }
[features] [features]
serai = ["thiserror", "serde", "serde_json", "serai-abi/serde", "multiaddr", "sp-core", "sp-runtime", "frame-system", "simple-request"] serai = ["thiserror/std", "serde", "serde_json", "serai-abi/serde", "multiaddr", "sp-core", "sp-runtime", "frame-system", "simple-request"]
borsh = ["serai-abi/borsh"] borsh = ["serai-abi/borsh"]
networks = [] networks = []

View file

@ -55,7 +55,7 @@ impl Block {
} }
} }
#[derive(Error, Debug)] #[derive(Debug, Error)]
pub enum SeraiError { pub enum SeraiError {
#[error("failed to communicate with serai")] #[error("failed to communicate with serai")]
ConnectionError, ConnectionError,

View file

@ -19,7 +19,7 @@ ignored = ["scale", "scale-info"]
workspace = true workspace = true
[dependencies] [dependencies]
hashbrown = { version = "0.14", default-features = false, features = ["ahash", "inline-more"] } hashbrown = { version = "0.15", default-features = false, features = ["default-hasher", "inline-more"] }
scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] }
scale-info = { version = "2", default-features = false, features = ["derive"] } scale-info = { version = "2", default-features = false, features = ["derive"] }