Skip to content

Commit

Permalink
chore: fix reth-primitives traits test build (paradigmxyz#13467)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsse authored Dec 20, 2024
1 parent 2183e49 commit 3c4a0dc
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
10 changes: 7 additions & 3 deletions crates/primitives-traits/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
2 changes: 1 addition & 1 deletion crates/primitives-traits/src/account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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))]
Expand Down
10 changes: 5 additions & 5 deletions crates/primitives-traits/src/crypto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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));
}
Expand Down

0 comments on commit 3c4a0dc

Please sign in to comment.