Skip to content

Commit d3af6d9

Browse files
committed
Merge #569: Update MSRV to 1.48. Fixes CI
6b76997 Use a static map to lookup which characters are allowed (sanket1729) 60fde9e Check that we only accept INPUT_CHARSET in from_str (sanket1729) a396605 Fix taproot internal key parsing (sanket1729) 68c7c49 clippy warnings (sanket1729) b238366 Update MSRV to 1.48 (sanket1729) Pull request description: ACKs for top commit: apoelstra: ACK 6b76997 Tree-SHA512: 5b42b3a1d8156c5a7aa5924bfbc5d79f8196173b4f9a2b502480edbfa4d2f9e2cd74dd34839de76e12a74ad0ccfc335f816890db1b4b6705bdbb2e7bc81fcebc
2 parents aa1769c + 6b76997 commit d3af6d9

File tree

27 files changed

+170
-124
lines changed

27 files changed

+170
-124
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

README.md

Lines changed: 2 additions & 3 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,8 +40,7 @@ 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
4746
you may need to pin some dependencies. See `./contrib/test.sh` for current pinning.

bitcoind-tests/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ publish = false
99

1010
[dependencies]
1111
miniscript = {path = "../"}
12-
bitcoind = { version = "0.30.0" }
12+
bitcoind = { version = "0.32.0" }
1313
actual-rand = { package = "rand", version = "0.8.4"}
1414
secp256k1 = {version = "0.27.0", features = ["rand-std"]}
1515
internals = { package = "bitcoin-private", version = "0.1.0", default_features = false }

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: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,14 @@ then
1414
cargo fmt -- --check
1515
fi
1616

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

3127
# Test bitcoind integration tests if told to (this only works with the stable toolchain)

fuzz/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ cargo-fuzz = true
1212
honggfuzz = { version = "0.5.55", default-features = false }
1313
miniscript = { path = "..", features = [ "compiler" ] }
1414

15-
regex = "1.4"
15+
regex = "1.0"
1616

1717
[[bin]]
1818
name = "roundtrip_miniscript_str"

fuzz/fuzz_targets/roundtrip_descriptor.rs

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,27 @@ fn main() {
2323

2424
#[cfg(test)]
2525
mod tests {
26-
use super::*;
26+
fn extend_vec_from_hex(hex: &str, out: &mut Vec<u8>) {
27+
let mut b = 0;
28+
for (idx, c) in hex.as_bytes().iter().enumerate() {
29+
b <<= 4;
30+
match *c {
31+
b'A'..=b'F' => b |= c - b'A' + 10,
32+
b'a'..=b'f' => b |= c - b'a' + 10,
33+
b'0'..=b'9' => b |= c - b'0',
34+
_ => panic!("Bad hex"),
35+
}
36+
if (idx & 1) == 1 {
37+
out.push(b);
38+
b = 0;
39+
}
40+
}
41+
}
42+
2743
#[test]
28-
fn test() {
29-
do_test(b"pkh()");
44+
fn duplicate_crash3() {
45+
let mut a = Vec::new();
46+
extend_vec_from_hex("747228726970656d616e645f6e5b5c79647228726970656d616e645f6e5b5c7964646464646464646464646464646464646464646464646464646b5f6872702c29", &mut a);
47+
super::do_test(&a);
3048
}
3149
}

src/descriptor/bare.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ where
192192
where
193193
T: Translator<P, Q, E>,
194194
{
195-
Ok(Bare::new(self.ms.translate_pk(t)?).map_err(TranslateErr::OuterError)?)
195+
Bare::new(self.ms.translate_pk(t)?).map_err(TranslateErr::OuterError)
196196
}
197197
}
198198

src/descriptor/checksum.rs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88
use core::fmt;
99
use core::iter::FromIterator;
1010

11+
pub use crate::expression::VALID_CHARS;
1112
use crate::prelude::*;
1213
use crate::Error;
1314

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

1717
fn poly_mod(mut c: u64, val: u64) -> u64 {
@@ -101,9 +101,14 @@ impl Engine {
101101
/// state! It is safe to continue feeding it data but the result will not be meaningful.
102102
pub fn input(&mut self, s: &str) -> Result<(), Error> {
103103
for ch in s.chars() {
104-
let pos = INPUT_CHARSET.find(ch).ok_or_else(|| {
105-
Error::BadDescriptor(format!("Invalid character in checksum: '{}'", ch))
106-
})? as u64;
104+
let pos = VALID_CHARS
105+
.get(ch as usize)
106+
.ok_or_else(|| {
107+
Error::BadDescriptor(format!("Invalid character in checksum: '{}'", ch))
108+
})?
109+
.ok_or_else(|| {
110+
Error::BadDescriptor(format!("Invalid character in checksum: '{}'", ch))
111+
})? as u64;
107112
self.c = poly_mod(self.c, pos & 31);
108113
self.cls = self.cls * 3 + (pos >> 5);
109114
self.clscount += 1;

0 commit comments

Comments
 (0)