Skip to content

Commit de74dc0

Browse files
committed
Merge #365: Enable edition 2018
c60bf1e Fix edition-idioms (Tobin C. Harding) 08bce7a Update to use edition 2018 (Tobin C. Harding) 2a83fa0 Update MSRV in CI and Readme from 1.29 to 1.41.1 (Tobin C. Harding) 2b73bb2 integration_test: Use latest bitcoin release (Tobin C. Harding) Pull request description: Update the MSRV to Rust 1.41.1 and enable edition 2018. I'm not sure how we want to merge these MSRV PRs across the stack but here is the `rust-miniscript` one. Discussion: rust-bitcoin/rust-bitcoin#510 (comment) ACKs for top commit: sanket1729: ACK c60bf1e. redid the entire process to match the diff. Tree-SHA512: 353cd793df4ba91b897e0dc58547b074ade7c23e7d75447c957ba947a12ff72c4504cb46036fdffea1591e429ee9eb056182dcffc89e301c72e3c5c433e8de16
2 parents 2468b35 + c60bf1e commit de74dc0

Some content is hidden

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

42 files changed

+222
-247
lines changed

.github/workflows/rust.yml

+1-8
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ jobs:
5454
strategy:
5555
matrix:
5656
rust:
57-
- 1.29.0
57+
- 1.41.1
5858
- beta
5959
steps:
6060
- name: Checkout Crate
@@ -65,13 +65,6 @@ jobs:
6565
profile: minimal
6666
toolchain: ${{ matrix.rust }}
6767
override: true
68-
- name: Pin deps if rust 1.29
69-
if: matrix.rust == '1.29.0'
70-
run: |
71-
cargo generate-lockfile --verbose && \
72-
cargo update --verbose --package "cc" --precise "1.0.41" && \
73-
cargo update --verbose --package "serde" --precise "1.0.98" && \
74-
cargo update --verbose --package "serde_derive" --precise "1.0.98"
7568
- name: Running cargo
7669
run: ./contrib/test.sh
7770

Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ repository = "https://github.com/rust-bitcoin/rust-miniscript/"
88
description = "Miniscript: a subset of Bitcoin Script designed for analysis"
99
keywords = [ "crypto", "bitcoin"]
1010
readme = "README.md"
11+
edition = "2018"
1112

1213
[features]
1314
compiler = []

README.md

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

3-
**Minimum Supported Rust Version:** 1.29.0
4-
5-
*This crate uses "2015" edition and won't be ported over "2018" edition
6-
in the near future as this will change the MSRV to 1.31.*
3+
**Minimum Supported Rust Version:** 1.41.1
74

85
# Miniscript
96

@@ -36,22 +33,7 @@ or in [the `examples/` directory](https://github.com/apoelstra/rust-miniscript/t
3633

3734

3835
## Minimum Supported Rust Version (MSRV)
39-
This library should always compile with any combination of features on **Rust 1.29**.
40-
41-
Because some dependencies have broken the build in minor/patch releases, to compile with 1.29.0 you will need to
42-
generate the lockfile and run the following version-pinning command:
43-
```
44-
cargo generate-lockfile --verbose
45-
cargo update -p cc --precise "1.0.41" --verbose
46-
```
47-
48-
In order to use the `use-serde` feature or to build the unit tests with 1.29.0,
49-
the following version-pinning commands are also needed:
50-
```
51-
cargo update --package "serde" --precise "1.0.98"
52-
cargo update --package "serde_derive" --precise "1.0.98"
53-
```
54-
36+
This library should always compile with any combination of features on **Rust 1.41.1**.
5537

5638
## Contributing
5739
Contributions are generally welcome. If you intend to make larger changes please

examples/parse.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414

1515
//! Example: Parsing a descriptor from a string
1616
17-
extern crate bitcoin;
18-
extern crate miniscript;
17+
use bitcoin;
18+
use miniscript;
1919

2020
use miniscript::{descriptor::DescriptorType, Descriptor, DescriptorTrait};
2121
use std::str::FromStr;

examples/psbt.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
extern crate bitcoin;
2-
extern crate miniscript;
1+
use bitcoin;
32

43
use bitcoin::consensus::encode::deserialize;
54
use bitcoin::hashes::hex::FromHex;

examples/sign_multisig.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414

1515
//! Example: Signing a 2-of-3 multisignature
1616
17-
extern crate bitcoin;
18-
extern crate miniscript;
17+
use bitcoin;
18+
use miniscript;
1919

2020
use bitcoin::blockdata::witness::Witness;
2121
use bitcoin::secp256k1; // secp256k1 re-exported from rust-bitcoin

examples/verify_tx.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414

1515
//! Example: Verifying a signed transaction
1616
17-
extern crate bitcoin;
18-
extern crate miniscript;
17+
use bitcoin;
18+
use miniscript;
1919

2020
use bitcoin::consensus::Decodable;
2121
use bitcoin::util::sighash;

examples/xpub_descriptors.rs

-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414

1515
//! Example: Parsing a xpub and getting address
1616
17-
extern crate miniscript;
18-
1917
use miniscript::bitcoin::{self, secp256k1};
2018
use miniscript::{Descriptor, DescriptorPublicKey, DescriptorTrait, TranslatePk2};
2119

integration_test/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ miniscript = {path = "../"}
88

99
# Until 0.26 support is released on rust-bitcoincore-rpc
1010
bitcoincore-rpc = {git = "https://github.com/sanket1729/rust-bitcoincore-rpc",rev = "1ee9a3e808815702ac1a4b974689fcb33b5648c3"}
11-
bitcoin = {ver = "0.28.0-rc.1", features = ["rand"]}
11+
bitcoin = { version = "0.28", features = ["rand"]}
1212
log = "0.4"
1313
rand = "0.8.4"

integration_test/src/main.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use bitcoincore_rpc::{Auth, Client, RpcApi};
1313
mod test_cpp;
1414
mod test_desc;
1515
mod test_util;
16-
use test_util::TestData;
16+
use crate::test_util::TestData;
1717

1818
struct StdLogger;
1919

src/descriptor/bare.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ use std::{fmt, str::FromStr};
2222

2323
use bitcoin::{self, blockdata::script, Script};
2424

25-
use expression::{self, FromTree};
26-
use miniscript::context::ScriptContext;
27-
use policy::{semantic, Liftable};
28-
use util::{varint_len, witness_to_scriptsig};
29-
use {
25+
use crate::expression::{self, FromTree};
26+
use crate::miniscript::context::ScriptContext;
27+
use crate::policy::{semantic, Liftable};
28+
use crate::util::{varint_len, witness_to_scriptsig};
29+
use crate::{
3030
BareCtx, Error, ForEach, ForEachKey, Miniscript, MiniscriptKey, Satisfier, ToPublicKey,
3131
TranslatePk,
3232
};

src/descriptor/checksum.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
66
use std::iter::FromIterator;
77

8-
use Error;
8+
use crate::Error;
99

1010
const INPUT_CHARSET: &str = "0123456789()[],'/*abcdefgh@:$%{}IJKLMNOPQRSTUVWXYZ&+-.;<=>?!^_|~ijklmnopqrstuvwxyzABCDEFGH`#\"\\ ";
1111
const CHECKSUM_CHARSET: &str = "qpzry9x8gf2tvdw0s3jn54khce6mua7l";

src/descriptor/key.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use bitcoin::{
1010
XOnlyPublicKey, XpubIdentifier,
1111
};
1212

13-
use {MiniscriptKey, ToPublicKey};
13+
use crate::{MiniscriptKey, ToPublicKey};
1414

1515
/// The descriptor pubkey, either a single pubkey or an xpub.
1616
#[derive(Debug, Eq, PartialEq, Clone, Ord, PartialOrd, Hash)]

src/descriptor/mod.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ use bitcoin::util::address::WitnessVersion;
3535
use bitcoin::{self, secp256k1, Script};
3636

3737
use self::checksum::verify_checksum;
38-
use expression;
39-
use miniscript;
40-
use miniscript::{Legacy, Miniscript, Segwitv0};
41-
use {
38+
use crate::expression;
39+
use crate::miniscript;
40+
use crate::miniscript::{Legacy, Miniscript, Segwitv0};
41+
use crate::{
4242
BareCtx, Error, ForEach, ForEachKey, MiniscriptKey, Satisfier, ToPublicKey, TranslatePk,
4343
TranslatePk2,
4444
};
@@ -870,23 +870,23 @@ mod tests {
870870
use super::checksum::desc_checksum;
871871
use super::tr::Tr;
872872
use super::*;
873+
use crate::descriptor::key::Wildcard;
874+
use crate::descriptor::{DescriptorPublicKey, DescriptorSecretKey, DescriptorXKey, SinglePub};
875+
use crate::hex_script;
876+
use crate::{Descriptor, DummyKey, Error, Miniscript, Satisfier, TranslatePk2};
873877
use bitcoin::blockdata::opcodes::all::{OP_CLTV, OP_CSV};
874878
use bitcoin::blockdata::script::Instruction;
875879
use bitcoin::blockdata::{opcodes, script};
876880
use bitcoin::hashes::hex::{FromHex, ToHex};
877881
use bitcoin::hashes::{hash160, sha256};
878882
use bitcoin::util::bip32;
879883
use bitcoin::{self, secp256k1, EcdsaSighashType, PublicKey};
880-
use descriptor::key::Wildcard;
881-
use descriptor::{DescriptorPublicKey, DescriptorSecretKey, DescriptorXKey, SinglePub};
882-
use hex_script;
883884
use std::cmp;
884885
use std::collections::HashMap;
885886
use std::str::FromStr;
886-
use {Descriptor, DummyKey, Error, Miniscript, Satisfier, TranslatePk2};
887887

888888
#[cfg(feature = "compiler")]
889-
use policy;
889+
use crate::policy;
890890

891891
type StdDescriptor = Descriptor<PublicKey>;
892892
const TEST_PK: &'static str =

src/descriptor/pretaproot.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use std::{
66
use bitcoin::{self, Script};
77

88
use super::{checksum::verify_checksum, Bare, Pkh, Sh, Wpkh, Wsh};
9-
use {expression, DescriptorTrait, Error, MiniscriptKey, Satisfier, ToPublicKey};
9+
use crate::{expression, DescriptorTrait, Error, MiniscriptKey, Satisfier, ToPublicKey};
1010

1111
/// Script descriptor
1212
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
@@ -241,7 +241,7 @@ serde_string_impl_pk!(PreTaprootDescriptor, "a pre-taproot script descriptor");
241241
pub(crate) mod traits {
242242
use bitcoin::Script;
243243

244-
use {
244+
use crate::{
245245
descriptor::{Pkh, Sh, Wpkh, Wsh},
246246
DescriptorTrait, MiniscriptKey, ToPublicKey,
247247
};

src/descriptor/segwitv0.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ use std::{fmt, str::FromStr};
2020

2121
use bitcoin::{self, Script};
2222

23-
use expression::{self, FromTree};
24-
use miniscript::context::{ScriptContext, ScriptContextError};
25-
use policy::{semantic, Liftable};
26-
use util::varint_len;
27-
use {
23+
use crate::expression::{self, FromTree};
24+
use crate::miniscript::context::{ScriptContext, ScriptContextError};
25+
use crate::policy::{semantic, Liftable};
26+
use crate::util::varint_len;
27+
use crate::{
2828
Error, ForEach, ForEachKey, Miniscript, MiniscriptKey, Satisfier, Segwitv0, ToPublicKey,
2929
TranslatePk,
3030
};

src/descriptor/sh.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ use std::{fmt, str::FromStr};
2222

2323
use bitcoin::{self, blockdata::script, Script};
2424

25-
use expression::{self, FromTree};
26-
use miniscript::context::ScriptContext;
27-
use policy::{semantic, Liftable};
28-
use push_opcode_size;
29-
use util::{varint_len, witness_to_scriptsig};
30-
use {
25+
use crate::expression::{self, FromTree};
26+
use crate::miniscript::context::ScriptContext;
27+
use crate::policy::{semantic, Liftable};
28+
use crate::push_opcode_size;
29+
use crate::util::{varint_len, witness_to_scriptsig};
30+
use crate::{
3131
Error, ForEach, ForEachKey, Legacy, Miniscript, MiniscriptKey, Satisfier, Segwitv0,
3232
ToPublicKey, TranslatePk,
3333
};

src/descriptor/sortedmulti.rs

+7-5
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,15 @@ use std::{fmt, marker::PhantomData, str::FromStr};
2020

2121
use bitcoin::blockdata::script;
2222

23-
use expression;
24-
use miniscript::{
23+
use crate::expression;
24+
use crate::miniscript::{
2525
self, context::ScriptContext, decode::Terminal, limits::MAX_PUBKEYS_PER_MULTISIG,
2626
};
27-
use policy;
28-
use script_num_size;
29-
use {errstr, Error, ForEach, ForEachKey, Miniscript, MiniscriptKey, Satisfier, ToPublicKey};
27+
use crate::policy;
28+
use crate::script_num_size;
29+
use crate::{
30+
errstr, Error, ForEach, ForEachKey, Miniscript, MiniscriptKey, Satisfier, ToPublicKey,
31+
};
3032

3133
/// Contents of a "sortedmulti" descriptor
3234
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]

src/descriptor/tr.rs

+11-14
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
// Tapscript
22

3-
use policy::semantic::Policy;
4-
use policy::Liftable;
5-
use util::{varint_len, witness_size};
6-
use {DescriptorTrait, ForEach, ForEachKey, Satisfier, ToPublicKey, TranslatePk};
3+
use crate::policy::semantic::Policy;
4+
use crate::policy::Liftable;
5+
use crate::util::{varint_len, witness_size};
6+
use crate::{DescriptorTrait, ForEach, ForEachKey, Satisfier, ToPublicKey, TranslatePk};
77

88
use super::checksum::{desc_checksum, verify_checksum};
9+
use crate::errstr;
10+
use crate::expression::{self, FromTree};
11+
use crate::miniscript::Miniscript;
12+
use crate::Tap;
13+
use crate::{Error, MiniscriptKey};
914
use bitcoin::blockdata::opcodes;
1015
use bitcoin::util::taproot::{
1116
LeafVersion, TaprootBuilder, TaprootBuilderError, TaprootSpendInfo, TAPROOT_CONTROL_BASE_SIZE,
1217
TAPROOT_CONTROL_MAX_NODE_COUNT, TAPROOT_CONTROL_NODE_SIZE,
1318
};
1419
use bitcoin::{self, secp256k1, Script};
15-
use errstr;
16-
use expression::{self, FromTree};
17-
use miniscript::Miniscript;
1820
use std::cmp::{self, max};
1921
use std::hash;
2022
use std::sync::{Arc, Mutex};
2123
use std::{fmt, str::FromStr};
22-
use Tap;
23-
use {Error, MiniscriptKey};
2424

2525
/// A Taproot Tree representation.
2626
// Hidden leaves are not yet supported in descriptor spec. Conceptually, it should
@@ -309,10 +309,7 @@ impl<Pk: MiniscriptKey + ToPublicKey> Tr<Pk> {
309309
/// would yield (2, A), (2, B), (2,C), (3, D), (3, E).
310310
///
311311
#[derive(Debug, Clone)]
312-
pub struct TapTreeIter<'a, Pk: MiniscriptKey>
313-
where
314-
Pk: 'a,
315-
{
312+
pub struct TapTreeIter<'a, Pk: MiniscriptKey> {
316313
stack: Vec<(u8, &'a TapTree<Pk>)>,
317314
}
318315

@@ -749,7 +746,7 @@ where
749746
#[cfg(test)]
750747
mod tests {
751748
use super::*;
752-
use ForEachKey;
749+
use crate::ForEachKey;
753750

754751
#[test]
755752
fn test_for_each() {

src/expression.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@
1717
1818
use std::str::FromStr;
1919

20-
use errstr;
21-
use Error;
20+
use crate::errstr;
21+
use crate::Error;
2222

23-
use MAX_RECURSION_DEPTH;
23+
use crate::MAX_RECURSION_DEPTH;
2424

2525
#[derive(Debug)]
2626
/// A token of the form `x(...)` or `x`

src/interpreter/error.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ pub enum Error {
6060
/// Last byte of this signature isn't a standard sighash type
6161
NonStandardSighash(Vec<u8>),
6262
/// Miniscript error
63-
Miniscript(::Error),
63+
Miniscript(crate::Error),
6464
/// MultiSig requires 1 extra zero element apart from the `k` signatures
6565
MissingExtraZeroMultiSig,
6666
/// Script abortion because of incorrect dissatisfaction for multisig.
@@ -173,8 +173,8 @@ impl From<bitcoin::SchnorrSigError> for Error {
173173
}
174174

175175
#[doc(hidden)]
176-
impl From<::Error> for Error {
177-
fn from(e: ::Error) -> Error {
176+
impl From<crate::Error> for Error {
177+
fn from(e: crate::Error) -> Error {
178178
Error::Miniscript(e)
179179
}
180180
}

0 commit comments

Comments
 (0)