use proptest::{arbitrary::any, array, prelude::*}; use crate::commitments::sapling; impl Arbitrary for sapling::NoteCommitment { type Parameters = (); fn arbitrary_with(_args: Self::Parameters) -> Self::Strategy { array::uniform32(any::()) .prop_filter("Valid jubjub::AffinePoint", |b| { jubjub::AffinePoint::from_bytes(*b).is_some().unwrap_u8() == 1 }) .prop_map(Self::from) .boxed() } type Strategy = BoxedStrategy; } impl Arbitrary for sapling::ValueCommitment { type Parameters = (); fn arbitrary_with(_args: Self::Parameters) -> Self::Strategy { array::uniform32(any::()) .prop_filter("Valid jubjub::AffinePoint", |b| { jubjub::AffinePoint::from_bytes(*b).is_some().unwrap_u8() == 1 }) .prop_map(Self::from) .boxed() } type Strategy = BoxedStrategy; }