Skip to content

Commit 0f8550c

Browse files
authored
Merge branch 'master' into plan_spend_example_branch
2 parents b4b7d09 + 1f645ad commit 0f8550c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+1083
-864
lines changed

.github/workflows/fuzz.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ compile_descriptor,
3939
key: cache-${{ matrix.target }}-${{ hashFiles('**/Cargo.toml','**/Cargo.lock') }}
4040
- uses: actions-rs/toolchain@v1
4141
with:
42-
toolchain: 1.58
42+
toolchain: 1.64
4343
override: true
4444
profile: minimal
4545
- name: fuzz

.github/workflows/rust.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,7 @@ jobs:
5454
- rust: stable
5555
- rust: beta
5656
- rust: nightly
57-
- rust: 1.41.1
58-
- rust: 1.47
57+
- rust: 1.48
5958
steps:
6059
- name: Checkout Crate
6160
uses: actions/checkout@v2

Cargo.toml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ no-std = ["hashbrown", "bitcoin/no-std"]
1717
compiler = []
1818
trace = []
1919

20-
unstable = []
2120
serde = ["actual-serde", "bitcoin/serde"]
2221
rand = ["bitcoin/rand"]
2322
base64 = ["bitcoin/base64"]
@@ -34,7 +33,6 @@ actual-serde = { package = "serde", version = "1.0.103", optional = true }
3433
serde_test = "1.0.147"
3534
bitcoin = { version = "0.30.0", features = ["base64"] }
3635
secp256k1 = {version = "0.27.0", features = ["rand-std"]}
37-
actual-base64 = { package = "base64", version = "0.13.0" }
3836

3937
[[example]]
4038
name = "htlc"
@@ -52,10 +50,6 @@ required-features = ["std"]
5250
name = "verify_tx"
5351
required-features = ["std"]
5452

55-
[[example]]
56-
name = "psbt"
57-
required-features = ["std"]
58-
5953
[[example]]
6054
name = "xpub_descriptors"
6155
required-features = ["std"]

README.md

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
![Build](https://github.com/rust-bitcoin/rust-miniscript/workflows/Continuous%20integration/badge.svg)
22

3-
**Minimum Supported Rust Version:** 1.41.1
3+
**Minimum Supported Rust Version:** 1.48.0
44

55
# Miniscript
66

@@ -40,18 +40,10 @@ The cargo feature `std` is enabled by default. At least one of the features `std
4040
Enabling the `no-std` feature does not disable `std`. To disable the `std` feature you must disable default features. The `no-std` feature only enables additional features required for this crate to be usable without `std`. Both can be enabled without conflict.
4141

4242
## Minimum Supported Rust Version (MSRV)
43-
This library should always compile with any combination of features (minus
44-
`no-std`) on **Rust 1.41.1** or **Rust 1.47** with `no-std`.
43+
This library should always compile with any combination of features on **Rust 1.48.0**.
4544

4645
Some dependencies do not play nicely with our MSRV, if you are running the tests
47-
you may need to pin as follows:
48-
49-
```
50-
cargo update --package url --precise 2.2.2
51-
cargo update --package form_urlencoded --precise 1.0.1
52-
cargo update -p once_cell --precise 1.13.1
53-
cargo update -p bzip2 --precise 0.4.2
54-
```
46+
you may need to pin some dependencies. See `./contrib/test.sh` for current pinning.
5547

5648
## Contributing
5749

@@ -61,6 +53,11 @@ architectural mismatches. If you have any questions or ideas you want to discuss
6153
please join us in
6254
[##miniscript](https://web.libera.chat/?channels=##miniscript) on Libera.
6355

56+
## Benchmarks
57+
58+
We use a custom Rust compiler configuration conditional to guard the bench mark code. To run the
59+
bench marks use: `RUSTFLAGS='--cfg=bench' cargo +nightly bench`.
60+
6461

6562
## Release Notes
6663

clippy.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
msrv = "1.41.1"
1+
msrv = "1.48.0"

contrib/test.sh

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,28 @@ FEATURES="compiler serde rand base64"
77
cargo --version
88
rustc --version
99

10+
# Cache the toolchain we are using.
11+
NIGHTLY=false
12+
if cargo --version | grep nightly; then
13+
NIGHTLY=true
14+
fi
15+
1016
# Format if told to
1117
if [ "$DO_FMT" = true ]
1218
then
1319
rustup component add rustfmt
1420
cargo fmt -- --check
1521
fi
1622

17-
# Pin dependencies required to build with Rust 1.41.1
18-
if cargo --version | grep "1\.41\.0"; then
19-
cargo update -p once_cell --precise 1.13.1
20-
cargo update -p serde --precise 1.0.156
21-
fi
22-
23-
# Pin dependencies required to build with Rust 1.47.0
24-
if cargo --version | grep "1\.47\.0"; then
23+
# Pin dependencies required to build with Rust 1.48.0
24+
if cargo --version | grep "1\.48\.0"; then
2525
cargo update -p once_cell --precise 1.13.1
26-
cargo update -p serde --precise 1.0.156
26+
cargo update -p quote --precise 1.0.28
27+
cargo update -p proc-macro2 --precise 1.0.63
28+
cargo update -p serde_json --precise 1.0.99
29+
cargo update -p serde --precise 1.0.152
30+
cargo update -p log --precise 0.4.18
31+
cargo update -p serde_test --precise 1.0.152
2732
fi
2833

2934
# Test bitcoind integration tests if told to (this only works with the stable toolchain)
@@ -56,7 +61,6 @@ then
5661
cargo run --example parse
5762
cargo run --example sign_multisig
5863
cargo run --example verify_tx > /dev/null
59-
cargo run --example psbt
6064
cargo run --example xpub_descriptors
6165
cargo run --example taproot --features=compiler
6266
cargo run --example psbt_sign_finalize --features=base64
@@ -80,10 +84,18 @@ then
8084
done
8185
fi
8286

83-
# Bench if told to (this only works with the nightly toolchain)
87+
# Bench if told to, only works with non-stable toolchain (nightly, beta).
8488
if [ "$DO_BENCH" = true ]
8589
then
86-
cargo bench --features="unstable compiler"
90+
if [ "$NIGHTLY" = false ]; then
91+
if [ -n "$RUSTUP_TOOLCHAIN" ]; then
92+
echo "RUSTUP_TOOLCHAIN is set to a non-nightly toolchain but DO_BENCH requires a nightly toolchain"
93+
else
94+
echo "DO_BENCH requires a nightly toolchain"
95+
fi
96+
exit 1
97+
fi
98+
RUSTFLAGS='--cfg=bench' cargo bench
8799
fi
88100

89101
# Build the docs if told to (this only works with the nightly toolchain)

examples/htlc.rs

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,11 @@
1-
// Miniscript
2-
// Written in 2019 by
3-
// Thomas Eizinger <[email protected]>
4-
//
5-
// To the extent possible under law, the author(s) have dedicated all
6-
// copyright and related and neighboring rights to this software to
7-
// the public domain worldwide. This software is distributed without
8-
// any warranty.
9-
//
10-
// You should have received a copy of the CC0 Public Domain Dedication
11-
// along with this software.
12-
// If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
13-
//
1+
// Written by Thomas Eizinger <[email protected]>
2+
// SPDX-License-Identifier: CC0-1.0
143

154
//! Example: Create an HTLC with miniscript using the policy compiler
165
176
use std::str::FromStr;
187

19-
use bitcoin::Network;
8+
use miniscript::bitcoin::Network;
209
use miniscript::descriptor::Wsh;
2110
use miniscript::policy::{Concrete, Liftable};
2211

@@ -51,7 +40,7 @@ fn main() {
5140
"or(and(pk(022222222222222222222222222222222222222222222222222222222222222222),sha256(1111111111111111111111111111111111111111111111111111111111111111)),and(pk(020202020202020202020202020202020202020202020202020202020202020202),older(4444)))"
5241
);
5342

54-
// Get the scriptPpubkey for this Wsh descriptor.
43+
// Get the scriptPubkey for this Wsh descriptor.
5544
assert_eq!(
5645
format!("{:x}", htlc_descriptor.script_pubkey()),
5746
"0020d853877af928a8d2a569c9c0ed14bd16f6a80ce9cccaf8a6150fd8f7f8867ae2"
@@ -63,7 +52,7 @@ fn main() {
6352
"21022222222222222222222222222222222222222222222222222222222222222222ac6476a91451814f108670aced2d77c1805ddd6634bc9d473188ad025c11b26782012088a82011111111111111111111111111111111111111111111111111111111111111118768"
6453
);
6554

66-
// Get the address for this Wsh descriptor.v
55+
// Get the address for this Wsh descriptor.
6756
assert_eq!(
6857
format!("{}", htlc_descriptor.address(Network::Bitcoin)),
6958
"bc1qmpfcw7he9z5d9ftfe8qw699azmm2sr8fen903fs4plv007yx0t3qxfmqv5"

examples/parse.rs

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,4 @@
1-
// Miniscript
2-
// Written in 2019 by
3-
// Andrew Poelstra <[email protected]>
4-
//
5-
// To the extent possible under law, the author(s) have dedicated all
6-
// copyright and related and neighboring rights to this software to
7-
// the public domain worldwide. This software is distributed without
8-
// any warranty.
9-
//
10-
// You should have received a copy of the CC0 Public Domain Dedication
11-
// along with this software.
12-
// If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
13-
//
1+
// SPDX-License-Identifier: CC0-1.0
142

153
//! Example: Parsing a descriptor from a string.
164

examples/psbt_sign_finalize.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
1+
// SPDX-License-Identifier: CC0-1.0
2+
13
use std::collections::BTreeMap;
24
use std::str::FromStr;
35

4-
use actual_base64 as base64;
5-
use bitcoin::sighash::SighashCache;
6-
use bitcoin::PrivateKey;
76
use miniscript::bitcoin::consensus::encode::deserialize;
87
use miniscript::bitcoin::hashes::hex::FromHex;
9-
use miniscript::bitcoin::psbt::PartiallySignedTransaction as Psbt;
8+
use miniscript::bitcoin::psbt::{self, Psbt};
9+
use miniscript::bitcoin::sighash::SighashCache;
1010
use miniscript::bitcoin::{
11-
self, psbt, secp256k1, Address, Network, OutPoint, Script, Sequence, Transaction, TxIn, TxOut,
11+
self, base64, secp256k1, Address, Network, OutPoint, PrivateKey, Script, Sequence, Transaction,
12+
TxIn, TxOut,
1213
};
1314
use miniscript::plan::Assets;
1415
use miniscript::psbt::{PsbtExt, PsbtInputExt};

examples/sign_multisig.rs

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,4 @@
1-
// Miniscript
2-
// Written in 2019 by
3-
// Andrew Poelstra <[email protected]>
4-
//
5-
// To the extent possible under law, the author(s) have dedicated all
6-
// copyright and related and neighboring rights to this software to
7-
// the public domain worldwide. This software is distributed without
8-
// any warranty.
9-
//
10-
// You should have received a copy of the CC0 Public Domain Dedication
11-
// along with this software.
12-
// If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
13-
//
1+
// SPDX-License-Identifier: CC0-1.0
142

153
//! Example: Signing a 2-of-3 multisignature.
164

0 commit comments

Comments
 (0)