pub struct AvidMScheme;Expand description
Dummy struct for AVID-M scheme.
Implementations§
Source§impl AvidMScheme
impl AvidMScheme
Sourcepub fn proof_of_incorrect_encoding(
param: &AvidMParam,
commit: &AvidMCommit,
shares: &[AvidMShare],
) -> Result<AvidMBadEncodingProof, VidError>
pub fn proof_of_incorrect_encoding( param: &AvidMParam, commit: &AvidMCommit, shares: &[AvidMShare], ) -> Result<AvidMBadEncodingProof, VidError>
Generate a proof of incorrect encoding
See [MalEncodingProof] for details.
Source§impl AvidMScheme
impl AvidMScheme
Source§impl AvidMScheme
impl AvidMScheme
Sourcefn pad_to_fields(
param: &AvidMParam,
payload: &[u8],
) -> Vec<<Keccak256Config as AvidMConfig>::BaseField>
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.
Sourcefn raw_encode(
param: &AvidMParam,
payload: &[<Keccak256Config as AvidMConfig>::BaseField],
) -> Result<(<Keccak256Config as AvidMConfig>::MerkleTree, Vec<Vec<<Keccak256Config as AvidMConfig>::BaseField>>), VidError>
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.
Sourcefn pad_and_encode(
param: &AvidMParam,
payload: &[u8],
) -> Result<(<Keccak256Config as AvidMConfig>::MerkleTree, Vec<Vec<<Keccak256Config as AvidMConfig>::BaseField>>), VidError>
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.
Consume in the constructed Merkle tree and the raw shares from raw_encode, provide the AvidM commitment and shares.
pub(crate) fn verify_internal( param: &AvidMParam, commit: &AvidMCommit, share: &RawAvidMShare, ) -> Result<Result<(), ()>, VidError>
pub(crate) fn recover_fields( param: &AvidMParam, shares: &[AvidMShare], ) -> Result<Vec<<Keccak256Config as AvidMConfig>::BaseField>, VidError>
Trait Implementations§
Source§impl VidScheme for AvidMScheme
impl VidScheme for AvidMScheme
Source§fn recover(
param: &Self::Param,
_commit: &Self::Commit,
shares: &[Self::Share],
) -> Result<Vec<u8>, VidError>
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
payloadmust have equal length. - All shares must be verified under the given commitment.
Shares beyond recovery_threshold are ignored.
Source§type Param = AvidMParam
type Param = AvidMParam
Source§type Commit = AvidMCommit
type Commit = AvidMCommit
Source§fn commit(param: &Self::Param, payload: &[u8]) -> Result<Self::Commit, VidError>
fn commit(param: &Self::Param, payload: &[u8]) -> Result<Self::Commit, VidError>
payload without generating shares.Source§fn disperse(
param: &Self::Param,
distribution: &[u32],
payload: &[u8],
) -> Result<(Self::Commit, Vec<Self::Share>), VidError>
fn disperse( param: &Self::Param, distribution: &[u32], payload: &[u8], ) -> Result<(Self::Commit, Vec<Self::Share>), VidError>
payload according to the weights in distribution.share against the VID commit.Auto Trait Implementations§
impl Freeze for AvidMScheme
impl RefUnwindSafe for AvidMScheme
impl Send for AvidMScheme
impl Sync for AvidMScheme
impl Unpin for AvidMScheme
impl UnwindSafe for AvidMScheme
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
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>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
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)
fn as_any(&self) -> &(dyn Any + 'static)
&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)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&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
impl<T> DowncastSync for T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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