zebra_chain/sapling/note/
arbitrary.rs

1use proptest::{collection::vec, prelude::*};
2
3use super::*;
4
5impl Arbitrary for EncryptedNote {
6    type Parameters = ();
7
8    fn arbitrary_with(_args: Self::Parameters) -> Self::Strategy {
9        (vec(any::<u8>(), 580))
10            .prop_map(|v| {
11                let mut bytes = [0; 580];
12                bytes.copy_from_slice(v.as_slice());
13                Self(bytes)
14            })
15            .boxed()
16    }
17
18    type Strategy = BoxedStrategy<Self>;
19}
20
21impl Arbitrary for WrappedNoteKey {
22    type Parameters = ();
23
24    fn arbitrary_with(_args: Self::Parameters) -> Self::Strategy {
25        (vec(any::<u8>(), 80))
26            .prop_map(|v| {
27                let mut bytes = [0; 80];
28                bytes.copy_from_slice(v.as_slice());
29                Self(bytes)
30            })
31            .boxed()
32    }
33
34    type Strategy = BoxedStrategy<Self>;
35}