chore: fix reth-primitives traits test build (#13467)

This commit is contained in:
Matthias Seitz
2024-12-20 09:43:41 +01:00
committed by GitHub
parent 2183e49552
commit 3c4a0dcfbd
3 changed files with 13 additions and 9 deletions

View File

@ -51,22 +51,26 @@ proptest = { workspace = true, optional = true }
proptest-arbitrary-interop = { workspace = true, optional = true } proptest-arbitrary-interop = { workspace = true, optional = true }
[dev-dependencies] [dev-dependencies]
alloy-primitives = { workspace = true, features = ["arbitrary"] } reth-codecs.workspace = true
alloy-consensus = { workspace = true, features = ["arbitrary"] }
alloy-primitives = { workspace = true, features = ["arbitrary", "serde"] }
alloy-consensus = { workspace = true, features = ["arbitrary", "serde"] }
arbitrary = { workspace = true, features = ["derive"] }
secp256k1 = { workspace = true, features = [ secp256k1 = { workspace = true, features = [
"recovery", "recovery",
"global-context", "global-context",
"rand" "rand"
] } ] }
bincode.workspace = true bincode.workspace = true
byteorder.workspace = true
proptest-arbitrary-interop.workspace = true proptest-arbitrary-interop.workspace = true
proptest.workspace = true proptest.workspace = true
rand.workspace = true rand.workspace = true
serde.workspace = true
serde_json.workspace = true serde_json.workspace = true
test-fuzz.workspace = true test-fuzz.workspace = true
modular-bitfield.workspace = true modular-bitfield.workspace = true
serde.workspace = true
[features] [features]
default = ["std"] default = ["std"]

View File

@ -25,7 +25,7 @@ pub mod compact_ids {
} }
/// An Ethereum account. /// 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)] #[derive(Clone, Copy, Debug, PartialEq, Eq, Default)]
#[cfg_attr(any(test, feature = "arbitrary"), derive(arbitrary::Arbitrary))] #[cfg_attr(any(test, feature = "arbitrary"), derive(arbitrary::Arbitrary))]
#[cfg_attr(any(test, feature = "reth-codec"), derive(reth_codecs::Compact))] #[cfg_attr(any(test, feature = "reth-codec"), derive(reth_codecs::Compact))]

View File

@ -56,8 +56,8 @@ pub mod secp256k1 {
} }
} }
#[cfg(feature = "secp256k1")] #[cfg(any(test, feature = "secp256k1"))]
#[allow(unused)] #[allow(unused, unreachable_pub)]
mod impl_secp256k1 { mod impl_secp256k1 {
use super::*; use super::*;
pub(crate) use ::secp256k1::Error; pub(crate) use ::secp256k1::Error;
@ -196,9 +196,9 @@ mod tests {
sign_message(B256::from_slice(&secret.to_bytes()[..]), hash).expect("sign message"); sign_message(B256::from_slice(&secret.to_bytes()[..]), hash).expect("sign message");
let mut sig: [u8; 65] = [0; 65]; let mut sig: [u8; 65] = [0; 65];
sig[0..32].copy_from_slice(&signature.r.to_be_bytes::<32>()); 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[32..64].copy_from_slice(&signature.s().to_be_bytes::<32>());
sig[64] = signature.odd_y_parity as u8; sig[64] = signature.v() as u8;
assert_eq!(recover_signer_unchecked(&sig, &hash).ok(), Some(signer)); assert_eq!(recover_signer_unchecked(&sig, &hash).ok(), Some(signer));
} }