Struct AvidMScheme

Source
pub struct AvidMScheme;
Expand description

Dummy struct for AVID-M scheme.

Implementations§

Source§

impl AvidMScheme

Source

pub fn proof_of_incorrect_encoding( param: &AvidMParam, commit: &AvidMCommit, shares: &[AvidMShare], ) -> Result<MalEncodingProof, VidError>

Generate a proof of incorrect encoding See MalEncodingProof for details.

Source§

impl AvidMScheme

Source

pub fn setup( recovery_threshold: usize, total_weights: usize, ) -> Result<AvidMParam, VidError>

Setup an instance for AVID-M scheme

Source§

impl AvidMScheme

Source

fn pad_to_fields( param: &AvidMParam, payload: &[u8], ) -> Vec<<Keccak256Config as AvidMConfig>::BaseField>

Helper function. Transform the payload bytes into a list of fields elements. This function also pads the bytes with a 1 in the end, following by many 0’s until the length of the output is a multiple of param.recovery_threshold.

Source

fn raw_encode( param: &AvidMParam, payload: &[<Keccak256Config as AvidMConfig>::BaseField], ) -> Result<(<Keccak256Config as AvidMConfig>::MerkleTree, Vec<Vec<<Keccak256Config as AvidMConfig>::BaseField>>), VidError>

Helper function. Let k = recovery_threshold and n = total_weights. This function partition the payload into many chunks, each containing k field elements. Then each chunk is encoded into n field element with Reed Solomon erasure code. They are then re-organized as n vectors, each collecting one field element from each chunk. These n vectors are then Merklized for commitment and membership proof generation.

Source

fn pad_and_encode( param: &AvidMParam, payload: &[u8], ) -> Result<(<Keccak256Config as AvidMConfig>::MerkleTree, Vec<Vec<<Keccak256Config as AvidMConfig>::BaseField>>), VidError>

Short hand for pad_to_field and raw_encode.

Source

fn distribute_shares( param: &AvidMParam, distribution: &[u32], mt: <Keccak256Config as AvidMConfig>::MerkleTree, raw_shares: Vec<Vec<<Keccak256Config as AvidMConfig>::BaseField>>, payload_byte_len: usize, ) -> Result<(AvidMCommit, Vec<AvidMShare>), VidError>

Consume in the constructed Merkle tree and the raw shares from raw_encode, provide the AvidM commitment and shares.

Source

pub(crate) fn verify_internal( param: &AvidMParam, commit: &AvidMCommit, share: &RawAvidMShare, ) -> Result<Result<(), ()>, VidError>

Source

pub(crate) fn recover_fields( param: &AvidMParam, shares: &[AvidMShare], ) -> Result<Vec<<Keccak256Config as AvidMConfig>::BaseField>, VidError>

Trait Implementations§

Source§

impl VidScheme for AvidMScheme

Source§

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

Recover payload data from shares.

§Requirements
  • Total weight of all shares must be at least recovery_threshold.
  • Each share’s payload must have equal length.
  • All shares must be verified under the given commitment.

Shares beyond recovery_threshold are ignored.

Source§

type Param = AvidMParam

VID Parameters
Source§

type Share = AvidMShare

VID Share type
Source§

type Commit = AvidMCommit

VID commitment type
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.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V