Skip to content

Commit

Permalink
chore: replace derive_more with thiserror 2 (#32)
Browse files Browse the repository at this point in the history
* chore: replace derive_more with thiserror

* chore: replace derive_more with thiserror
  • Loading branch information
mattsse authored Feb 27, 2025
1 parent ce71d08 commit 92b7d0a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 17 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ option-if-let-else = "warn"
redundant-clone = "warn"

[workspace.dependencies]
alloy-primitives = { version = "0.8.10", default-features = false }
alloy-primitives = { version = "0.8.11", default-features = false }
alloy-rlp = { version = "0.3", default-features = false }

# serde
Expand Down
4 changes: 2 additions & 2 deletions crates/eip7702/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ k256 = { workspace = true, optional = true }
rand = { workspace = true, optional = true }

# derive_more
derive_more = { version = "2", default-features = false, features = ["display", "from"] }
thiserror.workspace = true

[dev-dependencies]
bincode = "1.3"
Expand All @@ -48,7 +48,7 @@ serde_json.workspace = true

[features]
default = ["std"]
std = ["alloy-primitives/std", "alloy-rlp/std", "serde?/std", "derive_more/std"]
std = ["alloy-primitives/std", "alloy-rlp/std", "serde?/std", "thiserror/std"]
serde = ["dep:serde", "alloy-primitives/serde"]
serde-bincode-compat = ["serde_with"]
arbitrary = ["std", "dep:arbitrary", "dep:rand", "alloy-primitives/arbitrary"]
Expand Down
18 changes: 4 additions & 14 deletions crates/eip7702/src/error.rs
Original file line number Diff line number Diff line change
@@ -1,22 +1,12 @@
use alloy_primitives::U256;

/// EIP-7702 error.
#[derive(Debug, derive_more::Display, derive_more::From)]
#[derive(Debug, thiserror::Error)]
pub enum Eip7702Error {
/// Invalid signature `s` value.
#[display("invalid signature `s` value: {_0}")]
#[error("invalid signature `s` value: {0}")]
InvalidSValue(U256),
/// Signature error.
#[from]
Signature(alloy_primitives::SignatureError),
}

#[cfg(feature = "std")]
impl std::error::Error for Eip7702Error {
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
match self {
Self::InvalidSValue(_) => None,
Self::Signature(err) => Some(err),
}
}
#[error(transparent)]
Signature(#[from] alloy_primitives::SignatureError),
}

0 comments on commit 92b7d0a

Please sign in to comment.