diff --git a/crates/primitives-traits/Cargo.toml b/crates/primitives-traits/Cargo.toml index 296597d78284..995da07f934c 100644 --- a/crates/primitives-traits/Cargo.toml +++ b/crates/primitives-traits/Cargo.toml @@ -51,22 +51,26 @@ proptest = { workspace = true, optional = true } proptest-arbitrary-interop = { workspace = true, optional = true } [dev-dependencies] -alloy-primitives = { workspace = true, features = ["arbitrary"] } -alloy-consensus = { workspace = true, features = ["arbitrary"] } +reth-codecs.workspace = true +alloy-primitives = { workspace = true, features = ["arbitrary", "serde"] } +alloy-consensus = { workspace = true, features = ["arbitrary", "serde"] } + +arbitrary = { workspace = true, features = ["derive"] } secp256k1 = { workspace = true, features = [ "recovery", "global-context", "rand" ] } bincode.workspace = true +byteorder.workspace = true proptest-arbitrary-interop.workspace = true proptest.workspace = true rand.workspace = true +serde.workspace = true serde_json.workspace = true test-fuzz.workspace = true modular-bitfield.workspace = true -serde.workspace = true [features] default = ["std"] diff --git a/crates/primitives-traits/src/account.rs b/crates/primitives-traits/src/account.rs index 7ea618315fd9..64ce209e7f5e 100644 --- a/crates/primitives-traits/src/account.rs +++ b/crates/primitives-traits/src/account.rs @@ -25,7 +25,7 @@ pub mod compact_ids { } /// An Ethereum account. -#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr(any(test, feature = "serde"), derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Copy, Debug, PartialEq, Eq, Default)] #[cfg_attr(any(test, feature = "arbitrary"), derive(arbitrary::Arbitrary))] #[cfg_attr(any(test, feature = "reth-codec"), derive(reth_codecs::Compact))] diff --git a/crates/primitives-traits/src/crypto.rs b/crates/primitives-traits/src/crypto.rs index aba6107272e3..99a6521cd3c5 100644 --- a/crates/primitives-traits/src/crypto.rs +++ b/crates/primitives-traits/src/crypto.rs @@ -56,8 +56,8 @@ pub mod secp256k1 { } } -#[cfg(feature = "secp256k1")] -#[allow(unused)] +#[cfg(any(test, feature = "secp256k1"))] +#[allow(unused, unreachable_pub)] mod impl_secp256k1 { use super::*; pub(crate) use ::secp256k1::Error; @@ -196,9 +196,9 @@ mod tests { sign_message(B256::from_slice(&secret.to_bytes()[..]), hash).expect("sign message"); let mut sig: [u8; 65] = [0; 65]; - sig[0..32].copy_from_slice(&signature.r.to_be_bytes::<32>()); - sig[32..64].copy_from_slice(&signature.s.to_be_bytes::<32>()); - sig[64] = signature.odd_y_parity as u8; + sig[0..32].copy_from_slice(&signature.r().to_be_bytes::<32>()); + sig[32..64].copy_from_slice(&signature.s().to_be_bytes::<32>()); + sig[64] = signature.v() as u8; assert_eq!(recover_signer_unchecked(&sig, &hash).ok(), Some(signer)); }