Skip to content

Commit

Permalink
mpc: add MerkleBlock::conceal_other method
Browse files Browse the repository at this point in the history
Closes #162
  • Loading branch information
dr-orlovsky committed Mar 30, 2024
1 parent 3425446 commit 4ab7d0d
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion commit_verify/src/mpc/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,19 @@ impl MerkleBlock {
})
}

/// Conceals all commitments in the block except for the commitment under
/// given `protocol_id`. Also removes information about the entropy value
/// used.
///
/// # Error
///
/// If leaf with the given `protocol_id` is not found (absent or already
/// concealed), errors with [`LeafNotKnown`] error.
pub fn conceal_other(&mut self, protocol: ProtocolId) -> Result<(), LeafNotKnown> {
self.conceal_except([protocol])?;
Ok(())
}

/// Conceals all commitments in the block except for the commitment under
/// given `protocol_id`s. Also removes information about the entropy value
/// used.
Expand Down Expand Up @@ -516,7 +529,7 @@ Changed commitment id: {}",
mut self,
protocol_id: ProtocolId,
) -> Result<MerkleProof, LeafNotKnown> {
self.conceal_except([protocol_id])?;
self.conceal_other(protocol_id)?;
let mut map = BTreeMap::<u5, MerkleHash>::new();
for node in &self.cross_section {
match node {
Expand Down

0 comments on commit 4ab7d0d

Please sign in to comment.