Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add MerkleBlock::conceal_other method #164

Merged
merged 1 commit into from
Apr 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading