diff --git a/crates/primitives/src/sealed.rs b/crates/primitives/src/sealed.rs index f69ded2d6..daedc3fc4 100644 --- a/crates/primitives/src/sealed.rs +++ b/crates/primitives/src/sealed.rs @@ -6,6 +6,7 @@ use crate::B256; /// implement the [`Sealable`] trait to provide define their own hash. #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr(feature = "arbitrary", derive(proptest_derive::Arbitrary))] pub struct Sealed { /// The inner item inner: T, @@ -67,6 +68,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.