Skip to content

Commit

Permalink
Merge branch 'master' into v0.10
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-orlovsky committed Jul 27, 2023
2 parents 8027c2f + 8ed93fd commit ea32ca4
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 17 deletions.
33 changes: 28 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ single_use_seals = "0.10.0"

[package]
name = "bp-core"
version = "0.10.7"
version = "0.10.8"
description = "Bitcoin protocol core library (BP Core Lib)"
keywords = ["lnp-bp", "smart-contracts", "bitcoin", "blockchain"]
categories = ["cryptography"]
Expand Down Expand Up @@ -56,8 +56,8 @@ strict_types = { version = "1.6.0", optional = true }
commit_verify = { workspace = true }
single_use_seals = { workspace = true }
bp-primitives = { version = "0.10.6", path = "./primitives" }
bp-dbc = { version = "0.10.7", path = "./dbc" }
bp-seals = { version = "0.10.7", path = "./seals" }
bp-dbc = { version = "0.10.8", path = "./dbc" }
bp-seals = { version = "0.10.8", path = "./seals" }
serde_crate = { package = "serde", version = "1", features = ["derive"], optional = true }

[features]
Expand Down
4 changes: 2 additions & 2 deletions dbc/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "bp-dbc"
version = "0.10.7"
version = "0.10.8"
description = "Deterministic bitcoin commitments library"
keywords = ["lnp-bp", "bitcoin", "blockchain", "smart-contracts", "single-use-seals"]
categories = ["cryptography", "encoding"]
Expand All @@ -18,7 +18,7 @@ path = "src/lib.rs"

[dependencies]
amplify = { workspace = true }
base85 = "1.1.1"
base85 = "1.2.1"
strict_encoding = { workspace = true }
commit_verify = { workspace = true, features = ["rand"] }
bp-primitives = { version = "0.10.6", path = "../primitives" }
Expand Down
5 changes: 3 additions & 2 deletions dbc/src/tapret/tapscript.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,10 @@ impl Display for TapretCommitment {
impl FromStr for TapretCommitment {
type Err = DeserializeError;
fn from_str(s: &str) -> Result<Self, Self::Err> {
let data = base85::decode(s).ok_or_else(|| {
let data = base85::decode(s).map_err(|err| {
DecodeError::DataIntegrityError(format!(
"invalid Base85 encoding of tapret data \"{s}\""
"invalid Base85 encoding of tapret data \"{s}\": {}",
err.to_string().to_lowercase()
))
})?;
let data = Confined::try_from(data).map_err(DecodeError::from)?;
Expand Down
2 changes: 1 addition & 1 deletion seals/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "bp-seals"
version = "0.10.7"
version = "0.10.8"
description = "Bitcoin protocol single-use-seals library"
keywords = ["lnp-bp", "bitcoin", "blockchain", "smart-contracts", "single-use-seals"]
categories = ["cryptography", "encoding"]
Expand Down
18 changes: 14 additions & 4 deletions seals/src/txout/blind.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,15 +170,25 @@ impl<Id: SealTxid> BlindSeal<Id> {
}

/// Creates new seal using TapretFirst closing method for the provided
/// outpoint and seal closing method. Uses `thread_rng` to initialize
/// blinding factor.
/// outpoint. Uses `thread_rng` to initialize blinding factor.
pub fn tapret_first_from(outpoint: Outpoint) -> Self {
BlindSeal::tapret_first(outpoint.txid, outpoint.vout)
}

/// Creates new seal using OpretFirst closing method for the provided
/// outpoint. Uses `thread_rng` to initialize blinding factor.
pub fn opret_first_from(outpoint: Outpoint) -> Self {
BlindSeal::opret_first(outpoint.txid, outpoint.vout)
}

/// Creates new seal using TapretFirst closing method for the provided
/// outpoint. Uses `thread_rng` to initialize blinding factor.
pub fn tapret_first(txid: impl Into<Id>, vout: impl Into<Vout>) -> Self {
BlindSeal::with_rng(CloseMethod::TapretFirst, txid, vout, &mut thread_rng())
}

/// Creates new seal using OpretFirst closing method for the provided
/// outpoint and seal closing method. Uses `thread_rng` to initialize
/// blinding factor.
/// outpoint. Uses `thread_rng` to initialize blinding factor.
pub fn opret_first(txid: impl Into<Id>, vout: impl Into<Vout>) -> Self {
BlindSeal::with_rng(CloseMethod::OpretFirst, txid, vout, &mut thread_rng())
}
Expand Down
5 changes: 5 additions & 0 deletions seals/src/txout/seal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,11 @@ impl From<&Txid> for TxPtr {
fn from(txid: &Txid) -> Self { TxPtr::Txid(*txid) }
}

impl From<[u8; 32]> for TxPtr {
#[inline]
fn from(txid: [u8; 32]) -> Self { TxPtr::Txid(txid.into()) }
}

impl SealTxid for TxPtr {
fn txid(&self) -> Option<Txid> {
match self {
Expand Down

0 comments on commit ea32ca4

Please sign in to comment.