diff --git a/crates/primitives/src/sealed.rs b/crates/primitives/src/sealed.rs index 54a1318b6..708c52cfc 100644 --- a/crates/primitives/src/sealed.rs +++ b/crates/primitives/src/sealed.rs @@ -8,6 +8,7 @@ use crate::B256; /// implement the [`Sealable`] trait to provide define their own hash. #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Deref)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr(feature = "arbitrary", derive(proptest_derive::Arbitrary))] pub struct Sealed { /// The inner item #[deref] @@ -62,6 +63,16 @@ impl Sealed { } } +#[cfg(feature = "arbitrary")] +impl<'a, T> arbitrary::Arbitrary<'a> for Sealed +where + T: for<'b> arbitrary::Arbitrary<'b> + Sealable, +{ + fn arbitrary(u: &mut arbitrary::Unstructured<'a>) -> arbitrary::Result { + Ok(T::arbitrary(u)?.seal_slow()) + } +} + /// Sealeable objects. pub trait Sealable: Sized { /// Calculate the seal hash, this may be slow.