Skip to content

Commit

Permalink
Merge pull request #148 from LNP-BP/v0.11
Browse files Browse the repository at this point in the history
Version 0.11 release
  • Loading branch information
dr-orlovsky authored Dec 25, 2023
2 parents 08ef1be + 2d2a6bd commit 9a05f5c
Show file tree
Hide file tree
Showing 10 changed files with 151 additions and 152 deletions.
239 changes: 124 additions & 115 deletions Cargo.lock

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ default-members = [
]

[workspace.package]
version = "0.11.0-beta.2"
authors = ["Dr Maxim Orlovsky <[email protected]>"]
homepage = "https://github.com/LNP-BP"
repository = "https://github.com/LNP-BP/client_side_validation"
Expand All @@ -22,7 +23,7 @@ license = "Apache-2.0"

[package]
name = "client_side_validation"
version = "0.11.0-beta.1"
version = { workspace = true }
description = "Client-side validation foundation library"
keywords = ["lnp-bp", "smart-contracts", "blockchain"]
categories = ["cryptography"]
Expand All @@ -40,8 +41,8 @@ name = "client_side_validation"
path = "src/lib.rs"

[dependencies]
commit_verify = { version = "0.11.0-beta.1", path = "./commit_verify", default-features = false }
single_use_seals = { version = "0.11.0-beta.1", path = "./single_use_seals" }
commit_verify = { version = "0.11.0-beta.2", path = "./commit_verify", default-features = false }
single_use_seals = { version = "0.11.0-beta.2", path = "./single_use_seals" }
serde_crate = { package = "serde", version = "1", features = ["derive"], optional = true }

[features]
Expand Down
2 changes: 1 addition & 1 deletion commit_verify/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "commit_verify"
version = "0.11.0-beta.1"
version = { workspace = true }
description = "Commit-verify API for client-side validation"
keywords = ["lnp-bp", "smart-contracts", "blockchain", "commitments"]
categories = ["cryptography"]
Expand Down
5 changes: 2 additions & 3 deletions commit_verify/src/commit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,9 @@ use crate::CommitmentProtocol;
#[derive(Copy, Clone, Eq, PartialEq, Debug, Display, Error)]
#[display(doc_comments)]
pub enum VerifyError {
/// The verified commitment doesn't commit to the provided message.
/// commitment doesn't match the message.
InvalidCommitment,
/// The message is invalid since a commitment to it can't be created /
/// exist.
/// the message is invalid since a valid commitment to it can't be created.
InvalidMessage,
}

Expand Down
7 changes: 3 additions & 4 deletions commit_verify/src/convolve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,13 @@ use crate::{CommitEncode, CommitmentProtocol, VerifyEq};
serde(crate = "serde_crate", rename_all = "camelCase")
)]
pub enum ConvolveVerifyError {
/// The verified commitment doesn't commit to the provided message.
/// commitment doesn't match the message.
CommitmentMismatch,

/// The message is invalid since a valid commitment to it can't be created.
/// the message is invalid since a valid commitment to it can't be created.
ImpossibleMessage,

/// The proof of the commitment is invalid and the commitment can't be
/// verified.
/// the proof is invalid and the commitment can't be verified.
InvalidProof,
}

Expand Down
13 changes: 6 additions & 7 deletions commit_verify/src/embed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,21 @@ use crate::{CommitEncode, CommitmentProtocol};
#[derive(Copy, Clone, Eq, PartialEq, Debug, Display, Error, From)]
#[display(doc_comments)]
pub enum EmbedVerifyError<E: std::error::Error> {
/// The verified commitment doesn't commit to the provided message.
/// commitment doesn't match the message.
CommitmentMismatch,

/// The message is invalid since a commitment to it can't be created /
/// exist.
/// the message is invalid since a valid commitment to it can't be created.
///
/// Details: {0}
#[from]
InvalidMessage(E),

/// The proof of the commitment is invalid and the commitment can't be
/// verified since the original container can't be restored from it.
/// the proof is invalid and the commitment can't be verified since the
/// original container can't be restored from it.
InvalidProof,

/// The proof of the commitment does not match to the proof generated for
/// the same message during the verification.
/// the proof does not match to the proof generated for the same message
/// during the verification.
ProofMismatch,
}

Expand Down
16 changes: 3 additions & 13 deletions commit_verify/src/mpc/atoms.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ use crate::id::CommitmentId;
use crate::merkle::MerkleNode;
use crate::{strategies, CommitEncode, CommitStrategy};

pub const MPC_MINIMAL_DEPTH: u5 = u5::with(3);

/// Map from protocol ids to commitment messages.
pub type MessageMap = MediumOrdMap<ProtocolId, Message>;

Expand Down Expand Up @@ -56,10 +58,6 @@ impl CommitStrategy for ProtocolId {
}

impl ProtocolId {
#[deprecated(since = "0.10.6", note = "use copy_from_slice")]
pub fn from_slice(slice: &[u8]) -> Option<Self> {
Bytes32::copy_from_slice(slice).ok().map(Self)
}
pub fn copy_from_slice(slice: &[u8]) -> Result<Self, FromSliceError> {
Bytes32::copy_from_slice(slice).map(Self)
}
Expand All @@ -86,10 +84,6 @@ pub struct Message(
);

impl Message {
#[deprecated(since = "0.10.6", note = "use copy_from_slice")]
pub fn from_slice(slice: &[u8]) -> Option<Self> {
Bytes32::copy_from_slice(slice).ok().map(Self)
}
pub fn copy_from_slice(slice: &[u8]) -> Result<Self, FromSliceError> {
Bytes32::copy_from_slice(slice).map(Self)
}
Expand Down Expand Up @@ -165,10 +159,6 @@ impl CommitStrategy for Commitment {
}

impl Commitment {
#[deprecated(since = "0.10.6", note = "use copy_from_slice")]
pub fn from_slice(slice: &[u8]) -> Option<Self> {
Bytes32::copy_from_slice(slice).ok().map(Self)
}
pub fn copy_from_slice(slice: &[u8]) -> Result<Self, FromSliceError> {
Bytes32::copy_from_slice(slice).map(Self)
}
Expand All @@ -188,7 +178,7 @@ impl Default for MultiSource {
#[inline]
fn default() -> Self {
MultiSource {
min_depth: u5::with(3),
min_depth: MPC_MINIMAL_DEPTH,
messages: Default::default(),
static_entropy: None,
}
Expand Down
5 changes: 4 additions & 1 deletion commit_verify/src/mpc/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use std::collections::{BTreeMap, BTreeSet};

use amplify::confinement::{Confined, LargeVec};
use amplify::num::u5;
use strict_encoding::StrictEncode;
use strict_encoding::{StrictDeserialize, StrictEncode, StrictSerialize};

use crate::id::CommitmentId;
use crate::merkle::{MerkleBuoy, MerkleNode};
Expand Down Expand Up @@ -158,6 +158,9 @@ pub struct MerkleBlock {
entropy: Option<u64>,
}

impl StrictSerialize for MerkleBlock {}
impl StrictDeserialize for MerkleBlock {}

impl Proof for MerkleBlock {}

impl From<&MerkleTree> for MerkleBlock {
Expand Down
7 changes: 3 additions & 4 deletions commit_verify/src/mpc/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,12 @@ mod atoms;
mod tree;
mod block;

pub use atoms::{Commitment, Leaf, Message, MessageMap, MultiSource, ProtocolId};
pub use atoms::{
Commitment, Leaf, Message, MessageMap, MultiSource, ProtocolId, MPC_MINIMAL_DEPTH,
};
pub use block::{InvalidProof, LeafNotKnown, MergeError, MerkleBlock, MerkleProof};
pub use tree::{Error, MerkleTree};

#[deprecated(since = "0.10.6", note = "use commit_verify::merkle::MerkleBuoy instead")]
pub use crate::merkle::MerkleBuoy;

pub const MERKLE_LNPBP4_TAG: u128 = u128::from_le_bytes(*b"urn:lnpbp:lnpbp4");

/// Marker trait for variates of LNPBP-4 commitment proofs, which differ by the
Expand Down
2 changes: 1 addition & 1 deletion single_use_seals/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "single_use_seals"
version = "0.11.0-beta.1"
version = { workspace = true }
description = "Single-use-seals foundation API"
keywords = ["lnp-bp", "smart-contracts", "blockchain", "single-use-seals"]
categories = ["cryptography"]
Expand Down

0 comments on commit 9a05f5c

Please sign in to comment.