commonware_cryptography/zk/
mod.rs1#[cfg(feature = "std")]
2pub mod bulletproofs;
3#[cfg(feature = "std")]
4pub mod pedersen_to_plain;
5
6#[cfg(all(feature = "std", feature = "fuzz"))]
7pub mod fuzz {
8 use arbitrary::{Arbitrary, Unstructured};
9
10 pub enum Plan {
11 Bulletproofs(crate::zk::bulletproofs::fuzz::Plan),
12 PedersenToPlain(crate::zk::pedersen_to_plain::fuzz::Plan),
13 }
14
15 impl<'a> Arbitrary<'a> for Plan {
16 fn arbitrary(u: &mut Unstructured<'a>) -> arbitrary::Result<Self> {
17 match u.int_in_range(0..=1)? {
18 0 => Ok(Self::Bulletproofs(u.arbitrary()?)),
19 1 => Ok(Self::PedersenToPlain(u.arbitrary()?)),
20 _ => unreachable!("plan variant out of range"),
21 }
22 }
23 }
24
25 impl Plan {
26 pub fn run(self, u: &mut Unstructured<'_>) -> arbitrary::Result<()> {
27 match self {
28 Self::Bulletproofs(plan) => plan.run(u),
29 Self::PedersenToPlain(plan) => plan.run(u),
30 }
31 }
32 }
33}