arcium-primitives 0.8.1

Arcium primitives
Documentation
use std::fmt::Debug;

use serde::{de::DeserializeOwned, Serialize};

use crate::{
    sharing::{Reconstructible, Verifiable},
    types::Batched,
};

pub mod bundler;
pub mod generator;
pub mod stream;
pub mod types;

pub use types::{dabits, powpairs, singlets, triples};

/// A marker trait for input-independent correlated randomness types that can be
/// consumed in the (input-dependent) online phase to speed it up.
/// Includes verification and random generation capabilities.
pub trait Correlation:
    'static
    + Debug
    + Sized
    + Send
    + Sync
    + Clone
    + PartialEq
    + Serialize
    + DeserializeOwned
    + Reconstructible
    + Verifiable
{
}

impl<
        T: 'static
            + Debug
            + Sized
            + Send
            + Sync
            + Clone
            + PartialEq
            + Serialize
            + DeserializeOwned
            + Verifiable,
    > Correlation for T
{
}

/// A marker trait for input-independent types that can be generated in batches, i.e. for which it
/// is more efficient to generate/request/verify multiple elements at once rather than one at a
/// time.
pub trait CorrelatedBatch: Correlation + Batched<Item: Correlation> {}
impl<T: Correlation + Batched<Item: Correlation>> CorrelatedBatch for T {}