pub struct MerkleBlock { /* private fields */ }
Expand description

Partially-concealed merkle tree data.

Implementations§

source§

impl MerkleBlock

source

pub fn depth(&self) -> u5

Method returning copy of MerkleBlock::depth field. Tree depth (up to 16).

source

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

source

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

source

pub fn with( proof: &MerkleProof, protocol_id: ProtocolId, message: Message ) -> Result<Self, InvalidProof>

Constructs merkle block from a merkle proof

source

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.

source

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.

source

pub fn merge_reveal(&mut self, other: MerkleBlock) -> Result<u16, MergeError>

Merges two merkle blocks together, joining revealed information from each one of them.

source

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.

source

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.

source

pub fn protocol_id_pos(&self, protocol_id: ProtocolId) -> u32

Computes position for a given protocol_id within the tree leaves.

source

pub fn width(&self) -> u32

Computes the width of the merkle tree.

source

pub fn to_known_message_map(&self) -> MessageMap

Constructs MessageMap for revealed protocols and messages.

Trait Implementations§

source§

impl Clone for MerkleBlock

source§

fn clone(&self) -> MerkleBlock

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl CommitStrategy for MerkleBlock

§

type Strategy = ConcealStrict

Specific strategy. List of supported strategies: Read more
source§

impl CommitmentId for MerkleBlock

source§

const TAG: [u8; 32] = _

§

type Id = Commitment

Type of the resulting commitment.
source§

fn commitment_id(&self) -> Self::Id

Performs commitment to client-side-validated data
source§

impl Conceal for MerkleBlock

source§

fn conceal(&self) -> Self::Concealed

Reduces merkle tree into merkle tree root.

§

type Concealed = MerkleNode

The resulting confidential type concealing original data.
source§

impl Debug for MerkleBlock

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for MerkleBlock

source§

fn default() -> MerkleBlock

Returns the “default value” for a type. Read more
source§

impl<'de> Deserialize<'de> for MerkleBlock

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl From<&MerkleTree> for MerkleBlock

source§

fn from(tree: &MerkleTree) -> Self

Converts to this type from the input type.
source§

impl From<MerkleTree> for MerkleBlock

source§

fn from(tree: MerkleTree) -> Self

Converts to this type from the input type.
source§

impl Hash for MerkleBlock

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl PartialEq for MerkleBlock

source§

fn eq(&self, other: &MerkleBlock) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Serialize for MerkleBlock

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl StrictDecode for MerkleBlock

source§

fn strict_decode(reader: &mut impl TypedRead) -> Result<Self, DecodeError>

source§

fn strict_read(lim: usize, reader: impl Read) -> Result<Self, DecodeError>

source§

impl StrictEncode for MerkleBlock

source§

fn strict_encode<W: TypedWrite>(&self, writer: W) -> Result<W>

source§

fn strict_write(&self, lim: usize, writer: impl Write) -> Result<usize, Error>

source§

impl StrictStruct for MerkleBlock

source§

impl StrictType for MerkleBlock

source§

const STRICT_LIB_NAME: &'static str = LIB_NAME_COMMIT_VERIFY

source§

fn strict_name() -> Option<TypeName>

source§

impl Eq for MerkleBlock

source§

impl Proof for MerkleBlock

source§

impl StrictProduct for MerkleBlock

source§

impl StructuralEq for MerkleBlock

source§

impl StructuralPartialEq for MerkleBlock

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
source§

impl<T> CommitEncode for T

source§

fn commit_encode(&self, e: &mut impl Write)

Encodes the data for the commitment by writing them directly into a io::Write writer instance
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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> Same for T

§

type Output = T

Should always be Self
source§

impl<T> StrictDumb for T
where T: StrictType + Default,

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

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

§

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>,

§

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

source§

impl<T> VerifyEq for T
where T: Eq,

source§

fn verify_eq(&self, other: &T) -> bool

Verifies commit-equivalence of two instances of the same type.
source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,