From 4fdaf97ab3f08ee0136ebd5e3b2420fc8a822861 Mon Sep 17 00:00:00 2001 From: Matthias Seitz Date: Fri, 28 Jun 2024 11:49:07 +0200 Subject: [PATCH] fix: derive arbitrary for tests --- crates/primitives-traits/src/header/mod.rs | 2 +- crates/primitives/src/block.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/primitives-traits/src/header/mod.rs b/crates/primitives-traits/src/header/mod.rs index e817965a6d52..21a596ce7bd2 100644 --- a/crates/primitives-traits/src/header/mod.rs +++ b/crates/primitives-traits/src/header/mod.rs @@ -489,7 +489,7 @@ impl Decodable for Header { } } -#[cfg(feature = "arbitrary")] +#[cfg(any(test, feature = "test-utils", feature = "arbitrary"))] impl<'a> arbitrary::Arbitrary<'a> for Header { fn arbitrary(u: &mut arbitrary::Unstructured<'a>) -> arbitrary::Result { // Generate an arbitrary header, passing it to the generate_valid_header function to make diff --git a/crates/primitives/src/block.rs b/crates/primitives/src/block.rs index 9b5e172e8fc2..345b301666d7 100644 --- a/crates/primitives/src/block.rs +++ b/crates/primitives/src/block.rs @@ -171,7 +171,7 @@ impl Block { } } -#[cfg(feature = "arbitrary")] +#[cfg(any(test, feature = "arbitrary"))] impl<'a> arbitrary::Arbitrary<'a> for Block { fn arbitrary(u: &mut arbitrary::Unstructured<'a>) -> arbitrary::Result { // first generate up to 100 txs @@ -614,7 +614,7 @@ impl From for BlockBody { } } -#[cfg(feature = "arbitrary")] +#[cfg(any(test, feature = "arbitrary"))] impl<'a> arbitrary::Arbitrary<'a> for BlockBody { fn arbitrary(u: &mut arbitrary::Unstructured<'a>) -> arbitrary::Result { // first generate up to 100 txs