pub struct MpcTree {
pub leaves: Vec<MpcLeaf>,
}Expand description
Multi-Protocol Commitment tree
Fields§
§leaves: Vec<MpcLeaf>Leaves in deterministic order
Implementations§
Source§impl MpcTree
impl MpcTree
Sourcepub fn from_pairs(pairs: &[(ProtocolId, Hash)]) -> Self
pub fn from_pairs(pairs: &[(ProtocolId, Hash)]) -> Self
Create from (protocol_id, commitment) pairs
Sourcepub fn root(&self) -> Hash
pub fn root(&self) -> Hash
Compute the MPC root hash
Uses a deterministic Merkle tree construction. For a single leaf, the root is the leaf hash. For multiple leaves, pairs are hashed together bottom-up.
Sourcepub fn prove(&self, protocol_id: ProtocolId) -> Option<MpcProof>
pub fn prove(&self, protocol_id: ProtocolId) -> Option<MpcProof>
Build a merkle proof for a specific protocol
Returns None if the protocol_id is not in this tree.
Sourcepub fn protocol_count(&self) -> usize
pub fn protocol_count(&self) -> usize
Get the number of protocols in this tree
Sourcepub fn contains_protocol(&self, protocol_id: ProtocolId) -> bool
pub fn contains_protocol(&self, protocol_id: ProtocolId) -> bool
Check if a protocol is present in this tree
Sourcepub fn push(&mut self, protocol_id: ProtocolId, commitment: Hash)
pub fn push(&mut self, protocol_id: ProtocolId, commitment: Hash)
Add a protocol to the tree
Trait Implementations§
impl Eq for MpcTree
impl StructuralPartialEq for MpcTree
Auto Trait Implementations§
impl Freeze for MpcTree
impl RefUnwindSafe for MpcTree
impl Send for MpcTree
impl Sync for MpcTree
impl Unpin for MpcTree
impl UnsafeUnpin for MpcTree
impl UnwindSafe for MpcTree
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
Mutably borrows from an owned value. Read more