Skip to content

Commit bd479c6

Browse files
committed
Merge #47: update to rust-elements 0.22.0 and rust-bitcoin 0.30.0
a94fa54 pull `bitcoind-tests` into the main workspace (Andrew Poelstra) fab34ba release 0.2.0 (Andrew Poelstra) 408cd3b fuzz: bring in new scripts and CI stuff from rust-bitcoin (Andrew Poelstra) 78191ea fuzz: clean up all fuzz targets, remove `honggfuzz` feature (Andrew Poelstra) abdd5bb update coding conventions; remove #![deny] from lib.rs (Andrew Poelstra) a7b49cc bench: move bench behind cfg flag rather than Cargo feature (Andrew Poelstra) b39aa2a update MSRV from 1.41.1 to 1.48.0 (Andrew Poelstra) e5d4593 cargo fmt (Andrew Poelstra) 9992bee more clippy lol: bitcoind-tests (Andrew Poelstra) f7e96e5 clippy: final checks (with --all-features and --all-targets) (Andrew Poelstra) 7cd2e19 clippy: compiler fixes (Andrew Poelstra) 3ccc535 clippy: replace () error with custom error type (Andrew Poelstra) 8fdc5ba clippy fixes: round 1 (Andrew Poelstra) b1da1c9 bitcoind-tests: update dependencies (Andrew Poelstra) 1a00d31 update bitcoin to 0.30.0, elements to 0.22.0, miniscript to 10.0 (Andrew Poelstra) Pull request description: A fair bit easier than the rust-elements upgrade, but still not entirely trivial. ACKs for top commit: sanket1729: code review ACK a94fa54 Tree-SHA512: 9454acbb219d21d992e813a8884b038012758d309d47ce2fd1f5fadb3f0b8155f4eb674f32d4e250e38f82ae8119f69f1da710373e6350d84d0c34cc064f4cb0
2 parents 955f380 + a94fa54 commit bd479c6

Some content is hidden

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

75 files changed

+1229
-1102
lines changed

.github/workflows/fuzz.yml

+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# Automatically generated by fuzz/generate-files.sh
2+
name: Fuzz
3+
4+
on:
5+
push:
6+
branches:
7+
- master
8+
- 'test-ci/**'
9+
pull_request:
10+
11+
jobs:
12+
fuzz:
13+
if: ${{ !github.event.act }}
14+
runs-on: ubuntu-20.04
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
fuzz_target: [
19+
roundtrip_miniscript_str,
20+
roundtrip_miniscript_script,
21+
parse_descriptor,
22+
roundtrip_semantic,
23+
parse_descriptor_secret,
24+
roundtrip_descriptor,
25+
roundtrip_concrete,
26+
compile_descriptor,
27+
]
28+
steps:
29+
- name: Install test dependencies
30+
run: sudo apt-get update -y && sudo apt-get install -y binutils-dev libunwind8-dev libcurl4-openssl-dev libelf-dev libdw-dev cmake gcc libiberty-dev
31+
- uses: actions/checkout@v2
32+
- uses: actions/cache@v2
33+
id: cache-fuzz
34+
with:
35+
path: |
36+
~/.cargo/bin
37+
fuzz/target
38+
target
39+
key: cache-${{ matrix.target }}-${{ hashFiles('**/Cargo.toml','**/Cargo.lock') }}
40+
- uses: actions-rs/toolchain@v1
41+
with:
42+
toolchain: 1.58
43+
override: true
44+
profile: minimal
45+
- name: fuzz
46+
run: |
47+
if [[ "${{ matrix.fuzz_target }}" =~ ^bitcoin ]]; then
48+
export RUSTFLAGS='--cfg=hashes_fuzz --cfg=secp256k1_fuzz'
49+
fi
50+
echo "Using RUSTFLAGS $RUSTFLAGS"
51+
cd fuzz && ./fuzz.sh "${{ matrix.fuzz_target }}"
52+
- run: echo "${{ matrix.fuzz_target }}" >executed_${{ matrix.fuzz_target }}
53+
- uses: actions/upload-artifact@v2
54+
with:
55+
name: executed_${{ matrix.fuzz_target }}
56+
path: executed_${{ matrix.fuzz_target }}
57+
58+
verify-execution:
59+
if: ${{ !github.event.act }}
60+
needs: fuzz
61+
runs-on: ubuntu-latest
62+
steps:
63+
- uses: actions/checkout@v2
64+
- uses: actions/download-artifact@v2
65+
- name: Display structure of downloaded files
66+
run: ls -R
67+
- run: find executed_* -type f -exec cat {} + | sort > executed
68+
- run: source ./fuzz/fuzz-util.sh && listTargetNames | sort | diff - executed

.github/workflows/rust.yml

+7-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
1-
on: [push, pull_request]
1+
on:
2+
push:
3+
branches:
4+
- master
5+
pull_request: {}
26

37
name: Continuous integration
48

59
jobs:
610
lint_fuzz_stable:
7-
name: Lint + Fuzz
11+
name: Lint
812
runs-on: ubuntu-latest
913
steps:
1014
- name: Checkout Crate
@@ -19,7 +23,6 @@ jobs:
1923
override: true
2024
- name: Running fuzzer
2125
env:
22-
DO_FUZZ: true
2326
DO_LINT: true
2427
run: ./contrib/test.sh
2528

@@ -66,7 +69,7 @@ jobs:
6669
runs-on: ubuntu-latest
6770
strategy:
6871
matrix:
69-
rust: [stable, beta, nightly, 1.41.1]
72+
rust: [stable, beta, nightly, 1.48.0]
7073
steps:
7174
- name: Checkout Crate
7275
uses: actions/checkout@v2

CHANGELOG.md

+2-119
Original file line numberDiff line numberDiff line change
@@ -1,121 +1,4 @@
1-
# 9.0.0 - November 5, 2022
1+
# 0.2.0 - June 15, 2023
22

3-
- Fixed a bug dealing with dissatisfying pkh inside thresh
4-
- Changed the signature of `Satisfier::lookup_raw_pkh_pk` API. Only custom implementations
5-
of `Satisfier` need to be updated. The psbt APIs are unchanged.
6-
- Fixed a bug related to display of `raw_pk_h`. These descriptors are experimental
7-
and only usable by opting via `ExtParams` while parsing string.
8-
# 8.0.0 - October 20, 2022
9-
10-
This release contains several significant API overhauls, as well as a bump
11-
of our MSRV from 1.29 to 1.41. Users are encouraged to update their compiler
12-
to 1.41 *before* updating to this version.
13-
14-
It includes more Taproot support, but users should be aware that Taproot
15-
support for Miniscript is **not** standardized and is subject to change in
16-
the future. See [this gist](https://gist.github.com/sipa/06c5c844df155d4e5044c2c8cac9c05e)
17-
for our thinking regarding this at the time of release.
18-
19-
- Works with bitcoin crate 0.29
20-
- Correctly [return an error when `SortedMulti` is constructed with too many keys](https://github.com/rust-bitcoin/rust-miniscript/pull/366/)
21-
- Cleanly separate [`experimental/insane miniscripts`](https://github.com/rust-bitcoin/rust-miniscript/pull/461) from sane miniscripts.
22-
- allow disabling the checksum with [`alternate Display`](https://github.com/rust-bitcoin/rust-miniscript/pull/478)
23-
- Correct [`max_satisfaction_size` of `from_multi_a` fragment](https://github.com/rust-bitcoin/rust-miniscript/pull/346/)
24-
- [Add `PsbtInputExt` trait with `update_with_descriptor` method](https://github.com/rust-bitcoin/rust-miniscript/pull/339/) and [`PsbtOutputExt` trait](https://github.com/rust-bitcoin/rust-miniscript/pull/465/)
25-
- Rename [several descriptor types](https://github.com/rust-bitcoin/rust-miniscript/pull/376/) to reduce redundancy
26-
- [**Bump MSRV to 1.41** and edition to 2018](https://github.com/rust-bitcoin/rust-miniscript/pull/365/)
27-
- Rename [`as_public` to `to_public` on some descriptor key types](https://github.com/rust-bitcoin/rust-miniscript/pull/377/)
28-
- Split fully derived `DescriptorPublicKey`s [into their own type](https://github.com/rust-bitcoin/rust-miniscript/pull/345/) [followup](https://github.com/rust-bitcoin/rust-miniscript/pull/448/)
29-
- [Remove the `DescriptorTrait`](https://github.com/rust-bitcoin/rust-miniscript/pull/386/) in favor of the `Descriptor` enum
30-
- Fix signature costing [to account for ECDSA vs Schnorr](https://github.com/rust-bitcoin/rust-miniscript/pull/340/)
31-
- **Add a Taproot-enabled compiler** [v1](https://github.com/rust-bitcoin/rust-miniscript/pull/291/) [v2](https://github.com/rust-bitcoin/rust-miniscript/pull/342/) [v3](https://github.com/rust-bitcoin/rust-miniscript/pull/418/)
32-
- Rename [`stackelem` to `stack_elem`](https://github.com/rust-bitcoin/rust-miniscript/pull/411/) in the interpreter
33-
- Add [`no-std`](https://github.com/rust-bitcoin/rust-miniscript/pull/277)
34-
- Reworked the [`TranslatePk`](https://github.com/rust-bitcoin/rust-miniscript/pull/426) APIs. Add a Translator trait to cleanly allow downstream users without dealing with APIs that accept function pointers. Also provides `translate_assoc_clone` and `translate_assoc_fail` macros for helping in writing code.
35-
- Updated [`MiniscriptKey trait`](https://github.com/rust-bitcoin/rust-miniscript/pull/434),https://github.com/rust-bitcoin/rust-miniscript/pull/439 to accept associated types for Sha256, Hash256, Ripemd160 and
36-
Hash160. This allows users to write abstract miniscripts hashes as "sha256(H)" instead of specifying the entire hash in the string.
37-
that updates the psbt with descriptor bip32 paths.
38-
- Re-name [`as_public`](https://github.com/rust-bitcoin/rust-miniscript/pull/377) APIs -> `to_public`
39-
- Significantly improve the [timelock](https://github.com/rust-bitcoin/rust-miniscript/pull/414) code with new rust-bitcoin APIs.
40-
- rust-miniscript minor implementation detail: `PkH` fragment now has `Pk` generic instead of `Pk::Hash`. This only concerns users
41-
that operate with `MiniscriptKey = bitcoin::PublicKey` or users that use custom implementation of `MiniscriptKey`. Users that use
42-
`DescriptorPublicKey` need not be concerned. See [PR](https://github.com/rust-bitcoin/rust-miniscript/pull/431) for details.
43-
- To elaborate, "pkh(<20-byte-hex>)" is no longer parsed by the `MiniscriptKey = bitcoin::PublicKey`.
44-
This is consistent with the descriptor spec as defined. Parsing from `bitcoin::Script` for pkh<20-byte-hex> is still supported, but the library would not analyze them. These raw descriptors are still in spec discussions. Rust-miniscript will support them once they are completely specified.
45-
46-
# 7.0.0 - April 20, 2022
47-
48-
- Support for `tr` descriptors with miniscript leaves and multi_a fragment
49-
- Changes to MiniscriptKey and ToPublicKey traits for x-only keys support
50-
- Add `PsbtExt` trait for psbt operations
51-
- `Psbt::update_desc` adds information from a descriptor to a psbt. This figures
52-
out the type of the descriptor and adds corresponding redeem script/witness script
53-
and tap tree information
54-
- Add `derived_descriptor` API to Descriptor so that users no longer need to use
55-
`translate` APIs. See examples/`xpub_descriptor` for usage
56-
- Update `DescriptorTrait`: `script_code` and `explicit_script` can now fail because
57-
of taproot descriptors
58-
- Add `PreTaprootDescriptor` and `PreTaprootDescriptorTrait` to support non-failing versions
59-
of `script_code` and `explicit_script` for non taproot descriptors
60-
- Overhaul the interpreter API to provide simpler APIs `iter(prevouts)` and `iter_assume_sig()`
61-
so that it no longer takes a closure input.
62-
- Add interpreter support for taproot transactions.
63-
- Works with rust-bitcoin 0.28.0-rc.1
64-
# 6.0.1 - Aug 5, 2021
65-
66-
- The `lift` method on a Miniscript node was fixed. It would previously mix up
67-
the `X` and `Y` argument of an `andor` fragment.
68-
69-
# 6.0.0 - Jul 29, 2021
70-
71-
- bump `rust-bitcoin` to 0.27
72-
- several bugfixes
73-
74-
# 5.0.0 - Jan 14, 2021
75-
76-
- Remove `PkCtx` from the API
77-
- Move descriptors into their own types, with an enum containing all of them
78-
- Move descriptor functionality into a trait
79-
- Remove `FromStr` bound from `MiniscriptKey`and `MiniscriptKey::Hash`
80-
- Various `DescriptorPublicKey` improvements
81-
- Allow hardened paths in `DescriptorPublicKey`, remove direct `ToPublicKey` implementation
82-
- Change `Option` to `Result` in all APIs
83-
- bump `rust-bitcoin` to 0.26
84-
85-
# 4.0.0 - Nov 23, 2020
86-
87-
- Add support for parsing secret keys
88-
- Add sortedmulti descriptor
89-
- Added standardness and other sanity checks
90-
- Cleaned up `Error` type and return values of most of the API
91-
- Overhauled `satisfied_constraints` module into a new `Iterpreter` API
92-
93-
# 3.0.0 - Oct 13, 2020
94-
95-
- **Bump MSRV to 1.29**
96-
97-
# 2.0.0 - Oct 1, 2020
98-
99-
- Changes to the miniscript type system to detect an invalid
100-
combination of heightlocks and timelocks
101-
- Lift miniscripts can now fail. Earlier it always succeeded and gave
102-
the resulting Semantic Policy
103-
- Compiler will not compile policies that contain at least one
104-
unspendable path
105-
- Added support for Descriptor PublicKeys(xpub)
106-
- Added a generic psbt finalizer and extractor
107-
- Updated Satisfaction API for checking time/height before setting satisfaction
108-
- Added a policy entailment API for more miniscript semantic analysis
109-
110-
# 1.0.0 - July 6, 2020
111-
112-
- Added the following aliases to miniscript for ease of operations
113-
- Rename `pk` to `pk_k`
114-
- Rename `thresh_m` to `multi`
115-
- Add alias `pk(K)` = `c:pk_k(K)`
116-
- Add alias `pkh(K)` = `c:pk_h(K)`
117-
- Fixed Miniscript parser bugs when decoding Hashlocks
118-
- Added scriptContext(`Legacy` and `Segwitv0`) to Miniscript.
119-
- Miscellaneous fixes against DoS attacks for heavy nesting.
120-
- Fixed Satisfier bug that caused flipping of arguments for `and_v` and `and_n` and `and_or`
3+
- Still rapid iteration, very unstable.
1214

Cargo.toml

+10-8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "elements-miniscript"
3-
version = "0.1.0"
3+
version = "0.2.0"
44
authors = ["Andrew Poelstra <[email protected]>, Sanket Kanjalkar <[email protected]>"]
55
repository = "https://github.com/ElementsProject/elements-miniscript"
66
description = "Elements Miniscript: Miniscript, but for elements"
@@ -14,15 +14,14 @@ edition = "2018"
1414
compiler = []
1515
trace = []
1616

17-
unstable = []
1817
serde = ["actual-serde", "bitcoin/serde", "elements/serde"]
1918
rand = ["bitcoin/rand"]
2019
base64 = ["bitcoin/base64"]
2120

2221
[dependencies]
23-
bitcoin = "0.29.1"
24-
elements = "0.21.0"
25-
bitcoin-miniscript = { package = "miniscript", version = "9.0", git = "https://github.com/rust-bitcoin/rust-miniscript", rev = "1351c20a5ead4f308e18bce88cc01983c7d0e876" }
22+
bitcoin = "0.30.0"
23+
elements = "0.22.0"
24+
bitcoin-miniscript = { package = "miniscript", version = "10.0" }
2625

2726
# Do NOT use this as a feature! Use the `serde` feature instead.
2827
actual-serde = { package = "serde", version = "1.0", optional = true }
@@ -31,8 +30,8 @@ actual-serde = { package = "serde", version = "1.0", optional = true }
3130
serde_json = "1.0"
3231
actual-rand = { package = "rand", version = "0.8.4"}
3332
serde_test = "1.0.147"
34-
bitcoin = { version = "0.29.2", features = ["base64"] }
35-
secp256k1 = {version = "0.24.0", features = ["rand-std"]}
33+
bitcoin = { version = "0.30.0", features = ["base64"] }
34+
secp256k1 = {version = "0.27.0", features = ["rand-std"]}
3635
actual-base64 = { package = "base64", version = "0.13.0" }
3736

3837

@@ -58,4 +57,7 @@ required-features = ["compiler"]
5857

5958
[[example]]
6059
name = "psbt_sign_finalize"
61-
required-features = ["base64"]
60+
required-features = ["base64"]
61+
62+
[workspace]
63+
members = ["bitcoind-tests", "fuzz"]

README.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
![Build](https://github.com/ElementsProject/elements-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
*This crate uses "2018" edition
66

@@ -35,19 +35,19 @@ The cargo feature `std` is enabled by default. At least one of the features `std
3535

3636
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.
3737

38+
## Benchmarking
39+
40+
To run the benchmarks run `RUSTFLAGS=--cfg=miniscript_bench cargo +nightly bench --all-features`.
41+
3842
## Minimum Supported Rust Version (MSRV)
39-
This library should always compile with any combination of features on **Rust 1.41.1**.
43+
This library should always compile with any combination of features on **Rust 1.48.0**.
4044

4145

4246
Some dependencies do not play nicely with our MSRV, if you are running the tests
4347
you may need to pin as follows:
4448

4549
```
46-
cargo update --package url --precise 2.2.2
47-
cargo update --package form_urlencoded --precise 1.0.1
48-
cargo update -p once_cell --precise 1.13.1
49-
cargo update -p bzip2 --precise 0.4.2
50-
cargo update -p which --precise 4.3.0
50+
cargo update -p serde --precise 1.0.156
5151
```
5252

5353
## Contributing

bitcoind-tests/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ edition = "2018"
1010
elements-miniscript = {path = "../"}
1111
elementsd = {version = "0.6.0"}
1212
actual-rand = { package = "rand", version = "0.8.4"}
13-
secp256k1 = {version = "0.24.0", features = ["rand-std"]}
13+
secp256k1 = {version = "0.27.0", features = ["rand-std"]}

bitcoind-tests/tests/setup/mod.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ pub extern crate elements_miniscript;
33
use std::str::FromStr;
44
use miniscript::elements;
55
use elements::encode::{deserialize, serialize_hex};
6-
use elements::hashes::hex::FromHex;
6+
use elements::hex::FromHex;
77
use elements::BlockHash;
88
pub use elements_miniscript as miniscript;
99
use elementsd::bitcoincore_rpc::jsonrpc::serde_json::{json, Value};
@@ -18,8 +18,8 @@ pub mod test_util;
1818
pub fn setup(validate_pegin: bool) -> (ElementsD, Option<BitcoinD>, elements::BlockHash) {
1919
// Lookup bitcoind binary path
2020
let curr_dir = std::env::current_dir().unwrap();
21-
let bitcoind_path = curr_dir.clone().join("bin/bitcoind");
22-
let elementsd_path = curr_dir.clone().join("bin/elementsd");
21+
let bitcoind_path = curr_dir.join("bin/bitcoind");
22+
let elementsd_path = curr_dir.join("bin/elementsd");
2323

2424
std::env::set_var("BITCOIND_EXE", bitcoind_path);
2525
std::env::set_var("ELEMENTSD_EXE", elementsd_path);
@@ -28,7 +28,7 @@ pub fn setup(validate_pegin: bool) -> (ElementsD, Option<BitcoinD>, elements::Bl
2828
if validate_pegin {
2929
let bitcoind_exe = bitcoind::exe_path().unwrap();
3030
let bitcoind_conf = bitcoind::Conf::default();
31-
bitcoind = Some(bitcoind::BitcoinD::with_conf(&bitcoind_exe, &bitcoind_conf).unwrap());
31+
bitcoind = Some(bitcoind::BitcoinD::with_conf(bitcoind_exe, &bitcoind_conf).unwrap());
3232
}
3333

3434
let mut conf = elementsd::Conf::new(bitcoind.as_ref());

0 commit comments

Comments
 (0)