From ed0837c26e178a73b91598b0567f13a94a3fc478 Mon Sep 17 00:00:00 2001 From: morito Date: Mon, 9 Dec 2024 21:42:26 +0900 Subject: [PATCH] chore: mark `Signature` as deprecated (#819) * chore: mark Signature as `deprecated` * fix: put deprecation notice on the struct defs * add `allow(deprecated)` * add `allow(deprecated)` --- crates/primitives/src/lib.rs | 6 +++--- crates/primitives/src/signature/mod.rs | 4 ++++ crates/primitives/src/signature/parity.rs | 1 + crates/primitives/src/signature/sig.rs | 1 + 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/crates/primitives/src/lib.rs b/crates/primitives/src/lib.rs index a4ad0ea93..443dd6473 100644 --- a/crates/primitives/src/lib.rs +++ b/crates/primitives/src/lib.rs @@ -54,9 +54,9 @@ mod signed; pub use signed::{BigIntConversionError, ParseSignedError, Sign, Signed}; mod signature; -pub use signature::{ - normalize_v, to_eip155_v, Parity, PrimitiveSignature, Signature, SignatureError, -}; +pub use signature::{normalize_v, to_eip155_v, PrimitiveSignature, SignatureError}; +#[allow(deprecated)] +pub use signature::{Parity, Signature}; pub mod utils; pub use utils::{eip191_hash_message, keccak256, Keccak256}; diff --git a/crates/primitives/src/signature/mod.rs b/crates/primitives/src/signature/mod.rs index 815b32cdf..763b4f544 100644 --- a/crates/primitives/src/signature/mod.rs +++ b/crates/primitives/src/signature/mod.rs @@ -1,10 +1,14 @@ mod error; pub use error::SignatureError; +#[allow(deprecated)] mod parity; +#[allow(deprecated)] pub use parity::Parity; +#[allow(deprecated)] mod sig; +#[allow(deprecated)] pub use sig::Signature; mod utils; diff --git a/crates/primitives/src/signature/parity.rs b/crates/primitives/src/signature/parity.rs index b16011b0d..0f9f8d84a 100644 --- a/crates/primitives/src/signature/parity.rs +++ b/crates/primitives/src/signature/parity.rs @@ -5,6 +5,7 @@ use crate::{ /// The parity of the signature, stored as either a V value (which may include /// a chain id), or the y-parity. +#[deprecated(since = "0.8.15", note = "see https://github.com/alloy-rs/core/pull/776")] #[derive(Clone, Copy, Debug, Hash, PartialEq, Eq)] #[cfg_attr(feature = "arbitrary", derive(derive_arbitrary::Arbitrary, proptest_derive::Arbitrary))] pub enum Parity { diff --git a/crates/primitives/src/signature/sig.rs b/crates/primitives/src/signature/sig.rs index 537b155c6..baf164a61 100644 --- a/crates/primitives/src/signature/sig.rs +++ b/crates/primitives/src/signature/sig.rs @@ -13,6 +13,7 @@ const SECP256K1N_ORDER: U256 = uint!(0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141_U256); /// An Ethereum ECDSA signature. +#[deprecated(since = "0.8.15", note = "use PrimitiveSignature instead")] #[derive(Clone, Copy, Debug, Hash, PartialEq, Eq)] pub struct Signature { v: Parity,