core_utils/preprocessing/
mod.rs1use std::fmt::Debug;
2
3use primitives::{
4 algebra::elliptic_curve::Curve,
5 sharing::{Reconstructible, VerifiableWith},
6};
7use serde::{de::DeserializeOwned, Serialize};
8use wincode::{SchemaRead, SchemaWrite};
9
10use crate::{
11 circuit::Circuit,
12 preprocessing::{errors::PreprocessingBundlerError, iterator::CerberusPreprocessingIterator},
13};
14
15#[cfg(any(test, feature = "dev"))]
16pub mod dealer;
17pub mod errors;
18pub mod iterator;
19
20pub trait Preprocessing:
24 Debug
25 + Sized
26 + Send
27 + Sync
28 + Clone
29 + PartialEq
30 + Serialize
31 + DeserializeOwned
32 + SchemaWrite<Src = Self>
33 + for<'a> SchemaRead<'a>
34 + Reconstructible
35 + VerifiableWith<VerificationData = <Self as Preprocessing>::AssociatedData>
36{
37 type AssociatedData: Send
40 + Sync
41 + Clone
42 + PartialEq
43 + Serialize
44 + DeserializeOwned
45 + SchemaWrite<Src = Self::AssociatedData>
46 + for<'a> SchemaRead<'a, Dst = Self::AssociatedData>;
47}
48
49impl<
50 Data: Send
51 + Sync
52 + Clone
53 + PartialEq
54 + Serialize
55 + DeserializeOwned
56 + SchemaWrite<Src = Data>
57 + for<'a> SchemaRead<'a, Dst = Data>,
58 T: Debug
59 + Sized
60 + Send
61 + Sync
62 + Clone
63 + PartialEq
64 + Serialize
65 + DeserializeOwned
66 + VerifiableWith<VerificationData = Data>
67 + for<'a> wincode::SchemaRead<'a, Dst = T>
68 + wincode::SchemaWrite<Src = T>,
69 > Preprocessing for T
70{
71 type AssociatedData = Data;
72}
73
74#[allow(async_fn_in_trait)]
82pub trait PreprocessingBundler<C: Curve>: Send {
83 async fn fetch_for(
89 &mut self,
90 circuit: &Circuit<C>,
91 ) -> Result<CerberusPreprocessingIterator<C>, PreprocessingBundlerError>;
92}