Struct commit_verify::mpc::MerkleBlock  
source · pub struct MerkleBlock { /* private fields */ }Expand description
Partially-concealed merkle tree data.
Implementations§
source§impl MerkleBlock
 
impl MerkleBlock
sourcepub fn depth(&self) -> u5
 
pub fn depth(&self) -> u5
Method returning copy of MerkleBlock::depth field.
Tree depth (up to 16).
sourcepub fn cofactor(&self) -> u16
 
pub fn cofactor(&self) -> u16
Method returning copy of MerkleBlock::cofactor field.
Cofactor is used as an additive to the modulo divisor to improve packing
sourcepub fn entropy(&self) -> Option<u64>
 
pub fn entropy(&self) -> Option<u64>
Method returning copy of MerkleBlock::entropy field.
Entropy used for placeholders. May be unknown if the message is provided
source§impl MerkleBlock
 
impl MerkleBlock
sourcepub fn with(
    proof: &MerkleProof,
    protocol_id: ProtocolId,
    message: Message
) -> Result<Self, InvalidProof>
 
pub fn with( proof: &MerkleProof, protocol_id: ProtocolId, message: Message ) -> Result<Self, InvalidProof>
Constructs merkle block from a merkle proof
sourcepub fn conceal_except(
    &mut self,
    protocols: impl AsRef<[ProtocolId]>
) -> Result<usize, LeafNotKnown>
 
pub fn conceal_except( &mut self, protocols: impl AsRef<[ProtocolId]> ) -> Result<usize, LeafNotKnown>
Conceals all commitments in the block except for the commitment under
given protocol_ids. Also removes information about the entropy value
used.
Returns
Number of concealed nodes.
Error
If leaf with the given protocol_id is not found (absent or already
concealed), errors with LeafNotKnown error.
sourcepub fn merge_reveal_path(
    &mut self,
    proof: &MerkleProof,
    protocol_id: ProtocolId,
    message: Message
) -> Result<u16, MergeError>
 
pub fn merge_reveal_path( &mut self, proof: &MerkleProof, protocol_id: ProtocolId, message: Message ) -> Result<u16, MergeError>
Merges information from the given proof to the merkle block, revealing
path related to te commitment to the message under the given
protocol_id.
sourcepub fn merge_reveal(&mut self, other: MerkleBlock) -> Result<u16, MergeError>
 
pub fn merge_reveal(&mut self, other: MerkleBlock) -> Result<u16, MergeError>
Merges two merkle blocks together, joining revealed information from each one of them.
sourcepub fn into_merkle_proof(
    self,
    protocol_id: ProtocolId
) -> Result<MerkleProof, LeafNotKnown>
 
pub fn into_merkle_proof( self, protocol_id: ProtocolId ) -> Result<MerkleProof, LeafNotKnown>
Converts the merkle block into a merkle proof for the inclusion of a
commitment under given protocol_id.
sourcepub fn to_merkle_proof(
    &self,
    protocol_id: ProtocolId
) -> Result<MerkleProof, LeafNotKnown>
 
pub fn to_merkle_proof( &self, protocol_id: ProtocolId ) -> Result<MerkleProof, LeafNotKnown>
Constructs merkle proof for the inclusion of a commitment under given
protocol_id for the current Merkle block.
sourcepub fn protocol_id_pos(&self, protocol_id: ProtocolId) -> u32
 
pub fn protocol_id_pos(&self, protocol_id: ProtocolId) -> u32
Computes position for a given protocol_id within the tree leaves.
sourcepub fn to_known_message_map(&self) -> MessageMap
 
pub fn to_known_message_map(&self) -> MessageMap
Constructs MessageMap for revealed protocols and messages.
Trait Implementations§
source§impl Clone for MerkleBlock
 
impl Clone for MerkleBlock
source§fn clone(&self) -> MerkleBlock
 
fn clone(&self) -> MerkleBlock
1.0.0 · source§fn clone_from(&mut self, source: &Self)
 
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl CommitStrategy for MerkleBlock
 
impl CommitStrategy for MerkleBlock
§type Strategy = ConcealStrict
 
type Strategy = ConcealStrict
source§impl CommitmentId for MerkleBlock
 
impl CommitmentId for MerkleBlock
source§impl Conceal for MerkleBlock
 
impl Conceal for MerkleBlock
source§impl Debug for MerkleBlock
 
impl Debug for MerkleBlock
source§impl Default for MerkleBlock
 
impl Default for MerkleBlock
source§fn default() -> MerkleBlock
 
fn default() -> MerkleBlock
source§impl<'de> Deserialize<'de> for MerkleBlock
 
impl<'de> Deserialize<'de> for MerkleBlock
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
    __D: Deserializer<'de>,
 
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,
source§impl From<&MerkleTree> for MerkleBlock
 
impl From<&MerkleTree> for MerkleBlock
source§fn from(tree: &MerkleTree) -> Self
 
fn from(tree: &MerkleTree) -> Self
source§impl From<MerkleTree> for MerkleBlock
 
impl From<MerkleTree> for MerkleBlock
source§fn from(tree: MerkleTree) -> Self
 
fn from(tree: MerkleTree) -> Self
source§impl Hash for MerkleBlock
 
impl Hash for MerkleBlock
source§impl PartialEq<MerkleBlock> for MerkleBlock
 
impl PartialEq<MerkleBlock> for MerkleBlock
source§fn eq(&self, other: &MerkleBlock) -> bool
 
fn eq(&self, other: &MerkleBlock) -> bool
self and other values to be equal, and is used
by ==.source§impl Serialize for MerkleBlock
 
impl Serialize for MerkleBlock
source§impl StrictDecode for MerkleBlock
 
impl StrictDecode for MerkleBlock
fn strict_decode(reader: &mut impl TypedRead) -> Result<Self, DecodeError>
fn strict_read(lim: usize, reader: impl Read) -> Result<Self, DecodeError>
source§impl StrictEncode for MerkleBlock
 
impl StrictEncode for MerkleBlock
fn strict_encode<W: TypedWrite>(&self, writer: W) -> Result<W>
fn strict_write(&self, lim: usize, writer: impl Write) -> Result<usize, Error>
source§impl StrictStruct for MerkleBlock
 
impl StrictStruct for MerkleBlock
const ALL_FIELDS: &'static [&'static str] = _
fn strict_check_fields()
fn strict_type_info() -> TypeInfo<Self>
source§impl StrictType for MerkleBlock
 
impl StrictType for MerkleBlock
const STRICT_LIB_NAME: &'static str = LIB_NAME_COMMIT_VERIFY
fn strict_name() -> Option<TypeName>
impl Eq for MerkleBlock
impl Proof for MerkleBlock
impl StrictProduct for MerkleBlock
impl StructuralEq for MerkleBlock
impl StructuralPartialEq for MerkleBlock
Auto Trait Implementations§
impl RefUnwindSafe for MerkleBlock
impl Send for MerkleBlock
impl Sync for MerkleBlock
impl Unpin for MerkleBlock
impl UnwindSafe for MerkleBlock
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
source§impl<T> CommitEncode for Twhere
    T: CommitStrategy,
    Holder<&'a T, <T as CommitStrategy>::Strategy>: for<'a> CommitEncode,
 
impl<T> CommitEncode for Twhere T: CommitStrategy, Holder<&'a T, <T as CommitStrategy>::Strategy>: for<'a> CommitEncode,
source§fn commit_encode(&self, e: &mut impl Write)
 
fn commit_encode(&self, e: &mut impl Write)
io::Write writer instance§impl<Q, K> Equivalent<K> for Qwhere
    Q: Eq + ?Sized,
    K: Borrow<Q> + ?Sized,
 
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
 
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Qwhere
    Q: Eq + ?Sized,
    K: Borrow<Q> + ?Sized,
 
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
 
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.source§impl<Q, K> Equivalent<K> for Qwhere
    Q: Eq + ?Sized,
    K: Borrow<Q> + ?Sized,
 
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
 
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.