Skip to content
Merged
Show file tree
Hide file tree
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
342 changes: 247 additions & 95 deletions Cargo.lock

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[package]
name = "client_side_validation"
version = "0.8.0"
version = "0.9.0"
license = "Apache-2.0"
authors = ["Dr. Maxim Orlovsky <orlovsky@pandoracore.com>"]
authors = ["Dr. Maxim Orlovsky <orlovsky@lnp-bp.org>"]
description = "Client-side validation foundation library"
repository = "https://github.com/LNP-BP/client_side_validation"
homepage = "https://github.com/LNP-BP"
Expand All @@ -18,9 +18,9 @@ name = "client_side_validation"
path = "src/lib.rs"

[dependencies]
strict_encoding = { version = "0.8.0", path = "./strict_encoding" }
commit_verify = { version = "0.8.0", path = "./commit_verify" }
single_use_seals = { version = "0.8.0", path = "./single_use_seals" }
strict_encoding = { version = "0.9.0", path = "./strict_encoding" }
commit_verify = { version = "0.9.0", path = "./commit_verify" }
single_use_seals = { version = "0.9.0", path = "./single_use_seals" }

[dev-dependencies]
async-trait = "0.1.51"
Expand Down
18 changes: 9 additions & 9 deletions commit_verify/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[package]
name = "commit_verify"
version = "0.8.0"
version = "0.9.0"
license = "Apache-2.0"
authors = ["Dr. Maxim Orlovsky <orlovsky@pandoracore.com>"]
authors = ["Dr. Maxim Orlovsky <orlovsky@lnp-bp.org>"]
description = "Commit-verify API for client-side validation"
repository = "https://github.com/LNP-BP/client_side_validation"
homepage = "https://github.com/LNP-BP"
Expand All @@ -17,16 +17,16 @@ name = "commit_verify"
path = "src/lib.rs"

[dependencies]
amplify = { version = "3.12.0", features = ["hex"] }
bitcoin_hashes = "0.10"
strict_encoding = { version = "0.8.0", path = "../strict_encoding" }
rand = { version = "0.8.4", optional = true }
serde_crate = { version = "1", package = "serde", optional = true }
serde_with = { version = "1.8", optional = true }
amplify = { version = "3.13.0", features = ["hex"] }
bitcoin_hashes = "0.11.0"
strict_encoding = { version = "0.9.0", path = "../strict_encoding" }
rand = { version = "0.8.5", optional = true }
serde_crate = { version = "1.0", package = "serde", optional = true }
serde_with = { version = "1.14", optional = true }
grin_secp256k1zkp = { version = "0.7", optional = true }

[dev-dependencies]
rand = "0.8.4"
rand = "0.8.5"

[features]
default = []
Expand Down
2 changes: 1 addition & 1 deletion commit_verify/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ extern crate amplify;
#[macro_use]
extern crate bitcoin_hashes;
#[cfg(feature = "serde")]
#[macro_use]
extern crate serde_crate as serde;
#[cfg(feature = "serde")]
#[macro_use]
extern crate serde_with;

pub mod commit_encode;
Expand Down
8 changes: 4 additions & 4 deletions single_use_seals/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[package]
name = "single_use_seals"
version = "0.8.0"
version = "0.9.0"
license = "Apache-2.0"
authors = ["Dr. Maxim Orlovsky <orlovsky@pandoracore.com>"]
authors = ["Dr. Maxim Orlovsky <orlovsky@lnp-bp.org>"]
description = "Single-use-seals foundation API. For bitcoin-specific implementation check bp-seals"
repository = "https://github.com/LNP-BP/client_side_validation"
homepage = "https://github.com/LNP-BP"
Expand All @@ -17,8 +17,8 @@ name = "single_use_seals"
path = "src/lib.rs"

[dependencies]
amplify_derive = "2.9"
async-trait = { version = "0.1.51", optional = true }
amplify_derive = "2.11"
async-trait = { version = "0.1.57", optional = true }

[features]
default = []
Expand Down
26 changes: 13 additions & 13 deletions strict_encoding/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[package]
name = "strict_encoding"
version = "0.8.1"
version = "0.9.0"
license = "Apache-2.0"
authors = ["Dr. Maxim Orlovsky <orlovsky@pandoracore.com>"]
authors = ["Dr. Maxim Orlovsky <orlovsky@lnp-bp.org>"]
description = "Strict encoding: deterministic binary serialization for networking & client-side validation"
repository = "https://github.com/LNP-BP/client_side_validation"
homepage = "https://github.com/LNP-BP"
Expand All @@ -19,22 +19,22 @@ path = "src/lib.rs"
crate-type = ["rlib", "staticlib"]

[dependencies]
amplify = { version = "3.12.0", features = ["proc_attr"] }
strict_encoding_derive = { version = "0.8.0", path = "./derive", optional = true }
bitcoin_hashes = "0.10" # We need this separately since bitcoin is an optional dependency
bitcoin = { version = "0.28.0", optional = true }
miniscript = { version = "7.0.0", optional = true }
ed25519-dalek = { version = "1", optional = true }
amplify = { version = "3.13.0", features = ["proc_attr"] }
strict_encoding_derive = { version = "0.9.0", path = "./derive", optional = true }
bitcoin_hashes = "0.11.0" # We need this separately since bitcoin is an optional dependency
bitcoin = { version = "0.29.1", optional = true }
miniscript = { version = "8.0.0", optional = true }
ed25519-dalek = { version = "1.0", optional = true }
grin_secp256k1zkp = { version = "0.7", optional = true }
chrono = { version = "0.4", optional = true }
half = { version = "1.8", optional = true }
serde = { version = "1", optional = true }
monero = { version = "0.17", optional = true }
half = { version = "2.1", optional = true }
serde = { version = "1.0", optional = true }
monero = { version = "0.18", optional = true }

[dev-dependencies]
rand = "0.7"
amplify = { version = "3.12.0", features = ["proc_attr", "hex"] }
strict_encoding_test = { version = "0.8.0", path = "./test_helpers" }
amplify = { version = "3.13.0", features = ["proc_attr", "hex"] }
strict_encoding_test = { version = "0.9.0", path = "./test_helpers" }

[features]
default = ["chrono", "derive", "bitcoin"]
Expand Down
10 changes: 5 additions & 5 deletions strict_encoding/derive/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[package]
name = "strict_encoding_derive"
version = "0.8.0"
version = "0.9.0"
license = "Apache-2.0"
authors = ["Dr. Maxim Orlovsky <orlovsky@pandoracore.com>"]
authors = ["Dr. Maxim Orlovsky <orlovsky@lnp-bp.org>"]
description = "Strict encoding derivation macros"
repository = "https://github.com/LNP-BP/client_side_validation"
homepage = "https://github.com/LNP-BP"
Expand All @@ -18,11 +18,11 @@ proc-macro = true
[dependencies]
syn = "1"
proc-macro2 = "1"
encoding_derive_helpers = { version = "0.8.0", path = "../derive_helpers" }
encoding_derive_helpers = { version = "0.9.0", path = "../derive_helpers" }
amplify_syn = "1.1.6"

[dev-dependencies]
strict_encoding = { path = ".." }
strict_encoding_test = { path = "../test_helpers" }
amplify = "3.9.1"
compiletest_rs = "0.7.0"
amplify = "3.13.0"
compiletest_rs = "0.9.0"
6 changes: 3 additions & 3 deletions strict_encoding/derive_helpers/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[package]
name = "encoding_derive_helpers"
version = "0.8.1"
version = "0.9.0"
license = "Apache-2.0"
authors = ["Dr. Maxim Orlovsky <orlovsky@pandoracore.com>"]
authors = ["Dr. Maxim Orlovsky <orlovsky@lnp-bp.org>"]
description = "Helper functions for creating different encoding derivation macros"
repository = "https://github.com/LNP-BP/client_side_validation"
homepage = "https://github.com/LNP-BP"
Expand All @@ -18,4 +18,4 @@ rust-version = "1.59.0"
quote = "1"
syn = "1"
proc-macro2 = "1"
amplify = { version = "3.7.1", features = [ "proc_attr" ] }
amplify = { version = "3.13.0", features = [ "proc_attr" ] }
41 changes: 27 additions & 14 deletions strict_encoding/src/bitcoin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ use bitcoin::util::taproot::{
};
use bitcoin::{
schnorr as bip340, secp256k1, Amount, BlockHash, EcdsaSig,
EcdsaSighashType, KeyPair, OutPoint, PubkeyHash, SchnorrSig,
SchnorrSighashType, Script, ScriptHash, Sighash, Transaction, TxIn, TxOut,
Txid, WPubkeyHash, WScriptHash, Witness, Wtxid, XOnlyPublicKey,
XpubIdentifier,
EcdsaSighashType, KeyPair, LockTime, OutPoint, PackedLockTime, PubkeyHash,
SchnorrSig, SchnorrSighashType, Script, ScriptHash, Sequence, Sighash,
Transaction, TxIn, TxOut, Txid, WPubkeyHash, WScriptHash, Witness, Wtxid,
XOnlyPublicKey, XpubIdentifier,
};
use bitcoin_hashes::sha256;

Expand Down Expand Up @@ -121,7 +121,7 @@ impl StrictEncode for TaprootMerkleBranch {
impl StrictDecode for TaprootMerkleBranch {
fn strict_decode<D: Read>(d: D) -> Result<Self, Error> {
let data = Vec::<sha256::Hash>::strict_decode(d)?;
TaprootMerkleBranch::from_inner(data).map_err(|_| {
TaprootMerkleBranch::try_from(data).map_err(|_| {
Error::DataIntegrityError(s!(
"taproot merkle branch length exceeds 128 consensus limit"
))
Expand Down Expand Up @@ -150,7 +150,7 @@ impl StrictDecode for secp256k1::SecretKey {
impl StrictEncode for bip340::TweakedKeyPair {
#[inline]
fn strict_encode<E: io::Write>(&self, e: E) -> Result<usize, Error> {
self.into_inner().strict_encode(e)
self.to_inner().strict_encode(e)
}
}

Expand Down Expand Up @@ -332,9 +332,13 @@ impl StrictEncode for SchnorrSighashType {
impl StrictDecode for SchnorrSighashType {
#[inline]
fn strict_decode<D: Read>(d: D) -> Result<Self, Error> {
SchnorrSighashType::from_u8(u8::strict_decode(d)?).map_err(|_| {
Error::DataIntegrityError(s!("invalid BIP431 SighashType value"))
})
SchnorrSighashType::from_consensus_u8(u8::strict_decode(d)?).map_err(
|_| {
Error::DataIntegrityError(
s!("invalid BIP431 SighashType value"),
)
},
)
}
}

Expand Down Expand Up @@ -436,6 +440,15 @@ impl Strategy for OutPoint {
impl Strategy for Witness {
type Strategy = strategies::BitcoinConsensus;
}
impl Strategy for LockTime {
type Strategy = strategies::BitcoinConsensus;
}
impl Strategy for PackedLockTime {
type Strategy = strategies::BitcoinConsensus;
}
impl Strategy for Sequence {
type Strategy = strategies::BitcoinConsensus;
}
impl Strategy for TxOut {
type Strategy = strategies::BitcoinConsensus;
}
Expand All @@ -456,7 +469,7 @@ impl StrictEncode for address::Payload {
33u8.strict_encode(&mut e)? + sh.strict_encode(&mut e)?
}
address::Payload::WitnessProgram { version, program } => {
version.into_num().strict_encode(&mut e)?
version.to_num().strict_encode(&mut e)?
+ program.strict_encode(&mut e)?
}
})
Expand All @@ -473,7 +486,7 @@ impl StrictDecode for address::Payload {
address::Payload::ScriptHash(ScriptHash::strict_decode(&mut d)?)
}
version if version <= 16 => address::Payload::WitnessProgram {
version: WitnessVersion::from_num(version)
version: WitnessVersion::try_from(version)
.expect("bech32::u8 decider is broken"),
program: StrictDecode::strict_decode(&mut d)?,
},
Expand Down Expand Up @@ -502,7 +515,7 @@ impl StrictDecode for Address {

impl StrictEncode for Amount {
fn strict_encode<E: io::Write>(&self, e: E) -> Result<usize, Error> {
self.as_sat().strict_encode(e)
self.to_sat().strict_encode(e)
}
}

Expand Down Expand Up @@ -749,7 +762,7 @@ impl StrictDecode for TapTree {
builder.add_leaf(depth, script)
})
.map_err(|err| Error::DataIntegrityError(err.to_string()))?;
TapTree::from_builder(builder)
TapTree::try_from(builder)
.map_err(|_| Error::DataIntegrityError(s!("incomplete tree")))
}
}
Expand Down Expand Up @@ -1023,7 +1036,7 @@ pub(crate) mod test {
secp256k1::KeyPair::from_seckey_slice(&secp, &KEY).unwrap();

let pk_ecdsa = secp256k1::PublicKey::from_secret_key(&secp, &sk_ecdsa);
let pk_schnorr = XOnlyPublicKey::from_keypair(&sk_schnorr);
let (pk_schnorr, _parity) = XOnlyPublicKey::from_keypair(&sk_schnorr);
let msg = Message::from_slice(&[1u8; 32]).unwrap();

let ecdsa = secp.sign_ecdsa(&msg, &sk_ecdsa);
Expand Down
Loading