Skip to main content

VidScheme

Trait VidScheme 

Source
pub trait VidScheme {
    type Param: Send + Sync + Serialize + for<'a> Deserialize<'a>;
    type Share: Send + Sync + Serialize + for<'a> Deserialize<'a>;
    type Commit: Eq + PartialEq + Send + Sync + Serialize + for<'a> Deserialize<'a>;

    // Required methods
    fn commit(
        param: &Self::Param,
        payload: &[u8],
    ) -> Result<Self::Commit, VidError>;
    fn disperse(
        param: &Self::Param,
        distribution: &[u32],
        payload: &[u8],
    ) -> Result<(Self::Commit, Vec<Self::Share>), VidError>;
    fn verify_share(
        param: &Self::Param,
        commit: &Self::Commit,
        share: &Self::Share,
    ) -> Result<Result<(), ()>, VidError>;
    fn recover(
        param: &Self::Param,
        commit: &Self::Commit,
        shares: &[Self::Share],
    ) -> Result<Vec<u8>, VidError>;
}
Expand description

Trait definition for a Verifiable Information Dispersal (VID) scheme.

Required Associated Types§

Source

type Param: Send + Sync + Serialize + for<'a> Deserialize<'a>

VID Parameters

Source

type Share: Send + Sync + Serialize + for<'a> Deserialize<'a>

VID Share type

Source

type Commit: Eq + PartialEq + Send + Sync + Serialize + for<'a> Deserialize<'a>

VID commitment type

Required Methods§

Source

fn commit(param: &Self::Param, payload: &[u8]) -> Result<Self::Commit, VidError>

Commit to a payload without generating shares.

Source

fn disperse( param: &Self::Param, distribution: &[u32], payload: &[u8], ) -> Result<(Self::Commit, Vec<Self::Share>), VidError>

Disperse the given payload according to the weights in distribution.

Source

fn verify_share( param: &Self::Param, commit: &Self::Commit, share: &Self::Share, ) -> Result<Result<(), ()>, VidError>

Verify the given VID share against the VID commit.

Source

fn recover( param: &Self::Param, commit: &Self::Commit, shares: &[Self::Share], ) -> Result<Vec<u8>, VidError>

Recover the payload from the given shares.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§