Skip to content

Commit c763fee

Browse files
authored
Merge pull request #94 from LNP-BP/bitcoin-0.29
Upgrade for bitcoin 0.29 & miniscript 8.0
2 parents 51aaf19 + cbb62f0 commit c763fee

File tree

12 files changed

+494
-224
lines changed

12 files changed

+494
-224
lines changed

Cargo.lock

Lines changed: 247 additions & 95 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
[package]
22
name = "client_side_validation"
3-
version = "0.8.0"
3+
version = "0.9.0"
44
license = "Apache-2.0"
5-
authors = ["Dr. Maxim Orlovsky <orlovsky@pandoracore.com>"]
5+
authors = ["Dr. Maxim Orlovsky <orlovsky@lnp-bp.org>"]
66
description = "Client-side validation foundation library"
77
repository = "https://github.com/LNP-BP/client_side_validation"
88
homepage = "https://github.com/LNP-BP"
@@ -18,9 +18,9 @@ name = "client_side_validation"
1818
path = "src/lib.rs"
1919

2020
[dependencies]
21-
strict_encoding = { version = "0.8.0", path = "./strict_encoding" }
22-
commit_verify = { version = "0.8.0", path = "./commit_verify" }
23-
single_use_seals = { version = "0.8.0", path = "./single_use_seals" }
21+
strict_encoding = { version = "0.9.0", path = "./strict_encoding" }
22+
commit_verify = { version = "0.9.0", path = "./commit_verify" }
23+
single_use_seals = { version = "0.9.0", path = "./single_use_seals" }
2424

2525
[dev-dependencies]
2626
async-trait = "0.1.51"

commit_verify/Cargo.toml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
[package]
22
name = "commit_verify"
3-
version = "0.8.0"
3+
version = "0.9.0"
44
license = "Apache-2.0"
5-
authors = ["Dr. Maxim Orlovsky <orlovsky@pandoracore.com>"]
5+
authors = ["Dr. Maxim Orlovsky <orlovsky@lnp-bp.org>"]
66
description = "Commit-verify API for client-side validation"
77
repository = "https://github.com/LNP-BP/client_side_validation"
88
homepage = "https://github.com/LNP-BP"
@@ -17,16 +17,16 @@ name = "commit_verify"
1717
path = "src/lib.rs"
1818

1919
[dependencies]
20-
amplify = { version = "3.12.0", features = ["hex"] }
21-
bitcoin_hashes = "0.10"
22-
strict_encoding = { version = "0.8.0", path = "../strict_encoding" }
23-
rand = { version = "0.8.4", optional = true }
24-
serde_crate = { version = "1", package = "serde", optional = true }
25-
serde_with = { version = "1.8", optional = true }
20+
amplify = { version = "3.13.0", features = ["hex"] }
21+
bitcoin_hashes = "0.11.0"
22+
strict_encoding = { version = "0.9.0", path = "../strict_encoding" }
23+
rand = { version = "0.8.5", optional = true }
24+
serde_crate = { version = "1.0", package = "serde", optional = true }
25+
serde_with = { version = "1.14", optional = true }
2626
grin_secp256k1zkp = { version = "0.7", optional = true }
2727

2828
[dev-dependencies]
29-
rand = "0.8.4"
29+
rand = "0.8.5"
3030

3131
[features]
3232
default = []

commit_verify/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ extern crate amplify;
2929
#[macro_use]
3030
extern crate bitcoin_hashes;
3131
#[cfg(feature = "serde")]
32+
#[macro_use]
3233
extern crate serde_crate as serde;
3334
#[cfg(feature = "serde")]
34-
#[macro_use]
3535
extern crate serde_with;
3636

3737
pub mod commit_encode;

single_use_seals/Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
[package]
22
name = "single_use_seals"
3-
version = "0.8.0"
3+
version = "0.9.0"
44
license = "Apache-2.0"
5-
authors = ["Dr. Maxim Orlovsky <orlovsky@pandoracore.com>"]
5+
authors = ["Dr. Maxim Orlovsky <orlovsky@lnp-bp.org>"]
66
description = "Single-use-seals foundation API. For bitcoin-specific implementation check bp-seals"
77
repository = "https://github.com/LNP-BP/client_side_validation"
88
homepage = "https://github.com/LNP-BP"
@@ -17,8 +17,8 @@ name = "single_use_seals"
1717
path = "src/lib.rs"
1818

1919
[dependencies]
20-
amplify_derive = "2.9"
21-
async-trait = { version = "0.1.51", optional = true }
20+
amplify_derive = "2.11"
21+
async-trait = { version = "0.1.57", optional = true }
2222

2323
[features]
2424
default = []

strict_encoding/Cargo.toml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
[package]
22
name = "strict_encoding"
3-
version = "0.8.1"
3+
version = "0.9.0"
44
license = "Apache-2.0"
5-
authors = ["Dr. Maxim Orlovsky <orlovsky@pandoracore.com>"]
5+
authors = ["Dr. Maxim Orlovsky <orlovsky@lnp-bp.org>"]
66
description = "Strict encoding: deterministic binary serialization for networking & client-side validation"
77
repository = "https://github.com/LNP-BP/client_side_validation"
88
homepage = "https://github.com/LNP-BP"
@@ -19,22 +19,22 @@ path = "src/lib.rs"
1919
crate-type = ["rlib", "staticlib"]
2020

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

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

3939
[features]
4040
default = ["chrono", "derive", "bitcoin"]

strict_encoding/derive/Cargo.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
[package]
22
name = "strict_encoding_derive"
3-
version = "0.8.0"
3+
version = "0.9.0"
44
license = "Apache-2.0"
5-
authors = ["Dr. Maxim Orlovsky <orlovsky@pandoracore.com>"]
5+
authors = ["Dr. Maxim Orlovsky <orlovsky@lnp-bp.org>"]
66
description = "Strict encoding derivation macros"
77
repository = "https://github.com/LNP-BP/client_side_validation"
88
homepage = "https://github.com/LNP-BP"
@@ -18,11 +18,11 @@ proc-macro = true
1818
[dependencies]
1919
syn = "1"
2020
proc-macro2 = "1"
21-
encoding_derive_helpers = { version = "0.8.0", path = "../derive_helpers" }
21+
encoding_derive_helpers = { version = "0.9.0", path = "../derive_helpers" }
2222
amplify_syn = "1.1.6"
2323

2424
[dev-dependencies]
2525
strict_encoding = { path = ".." }
2626
strict_encoding_test = { path = "../test_helpers" }
27-
amplify = "3.9.1"
28-
compiletest_rs = "0.7.0"
27+
amplify = "3.13.0"
28+
compiletest_rs = "0.9.0"

strict_encoding/derive_helpers/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
[package]
22
name = "encoding_derive_helpers"
3-
version = "0.8.1"
3+
version = "0.9.0"
44
license = "Apache-2.0"
5-
authors = ["Dr. Maxim Orlovsky <orlovsky@pandoracore.com>"]
5+
authors = ["Dr. Maxim Orlovsky <orlovsky@lnp-bp.org>"]
66
description = "Helper functions for creating different encoding derivation macros"
77
repository = "https://github.com/LNP-BP/client_side_validation"
88
homepage = "https://github.com/LNP-BP"
@@ -18,4 +18,4 @@ rust-version = "1.59.0"
1818
quote = "1"
1919
syn = "1"
2020
proc-macro2 = "1"
21-
amplify = { version = "3.7.1", features = [ "proc_attr" ] }
21+
amplify = { version = "3.13.0", features = [ "proc_attr" ] }

strict_encoding/src/bitcoin.rs

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ use bitcoin::util::taproot::{
2626
};
2727
use bitcoin::{
2828
schnorr as bip340, secp256k1, Amount, BlockHash, EcdsaSig,
29-
EcdsaSighashType, KeyPair, OutPoint, PubkeyHash, SchnorrSig,
30-
SchnorrSighashType, Script, ScriptHash, Sighash, Transaction, TxIn, TxOut,
31-
Txid, WPubkeyHash, WScriptHash, Witness, Wtxid, XOnlyPublicKey,
32-
XpubIdentifier,
29+
EcdsaSighashType, KeyPair, LockTime, OutPoint, PackedLockTime, PubkeyHash,
30+
SchnorrSig, SchnorrSighashType, Script, ScriptHash, Sequence, Sighash,
31+
Transaction, TxIn, TxOut, Txid, WPubkeyHash, WScriptHash, Witness, Wtxid,
32+
XOnlyPublicKey, XpubIdentifier,
3333
};
3434
use bitcoin_hashes::sha256;
3535

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

@@ -332,9 +332,13 @@ impl StrictEncode for SchnorrSighashType {
332332
impl StrictDecode for SchnorrSighashType {
333333
#[inline]
334334
fn strict_decode<D: Read>(d: D) -> Result<Self, Error> {
335-
SchnorrSighashType::from_u8(u8::strict_decode(d)?).map_err(|_| {
336-
Error::DataIntegrityError(s!("invalid BIP431 SighashType value"))
337-
})
335+
SchnorrSighashType::from_consensus_u8(u8::strict_decode(d)?).map_err(
336+
|_| {
337+
Error::DataIntegrityError(
338+
s!("invalid BIP431 SighashType value"),
339+
)
340+
},
341+
)
338342
}
339343
}
340344

@@ -436,6 +440,15 @@ impl Strategy for OutPoint {
436440
impl Strategy for Witness {
437441
type Strategy = strategies::BitcoinConsensus;
438442
}
443+
impl Strategy for LockTime {
444+
type Strategy = strategies::BitcoinConsensus;
445+
}
446+
impl Strategy for PackedLockTime {
447+
type Strategy = strategies::BitcoinConsensus;
448+
}
449+
impl Strategy for Sequence {
450+
type Strategy = strategies::BitcoinConsensus;
451+
}
439452
impl Strategy for TxOut {
440453
type Strategy = strategies::BitcoinConsensus;
441454
}
@@ -456,7 +469,7 @@ impl StrictEncode for address::Payload {
456469
33u8.strict_encode(&mut e)? + sh.strict_encode(&mut e)?
457470
}
458471
address::Payload::WitnessProgram { version, program } => {
459-
version.into_num().strict_encode(&mut e)?
472+
version.to_num().strict_encode(&mut e)?
460473
+ program.strict_encode(&mut e)?
461474
}
462475
})
@@ -473,7 +486,7 @@ impl StrictDecode for address::Payload {
473486
address::Payload::ScriptHash(ScriptHash::strict_decode(&mut d)?)
474487
}
475488
version if version <= 16 => address::Payload::WitnessProgram {
476-
version: WitnessVersion::from_num(version)
489+
version: WitnessVersion::try_from(version)
477490
.expect("bech32::u8 decider is broken"),
478491
program: StrictDecode::strict_decode(&mut d)?,
479492
},
@@ -502,7 +515,7 @@ impl StrictDecode for Address {
502515

503516
impl StrictEncode for Amount {
504517
fn strict_encode<E: io::Write>(&self, e: E) -> Result<usize, Error> {
505-
self.as_sat().strict_encode(e)
518+
self.to_sat().strict_encode(e)
506519
}
507520
}
508521

@@ -749,7 +762,7 @@ impl StrictDecode for TapTree {
749762
builder.add_leaf(depth, script)
750763
})
751764
.map_err(|err| Error::DataIntegrityError(err.to_string()))?;
752-
TapTree::from_builder(builder)
765+
TapTree::try_from(builder)
753766
.map_err(|_| Error::DataIntegrityError(s!("incomplete tree")))
754767
}
755768
}
@@ -1023,7 +1036,7 @@ pub(crate) mod test {
10231036
secp256k1::KeyPair::from_seckey_slice(&secp, &KEY).unwrap();
10241037

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

10291042
let ecdsa = secp.sign_ecdsa(&msg, &sk_ecdsa);

0 commit comments

Comments
 (0)