Skip to content

Commit

Permalink
Merge #90: bump elements and related dep
Browse files Browse the repository at this point in the history
6ed3bbb avoid useless conversion of the same type (Riccardo Casatta)
79f3109 bump elements and related dep (Riccardo Casatta)
b6ffda3 ci: let other toolchain finish if one is failing (Riccardo Casatta)
42375e4 bump MSRV 1.58 -> 1.63 (Riccardo Casatta)

Pull request description:

  apoelstra, there are some places where I need guidance

  Also, I still need to check CI, just tested local `cargo check` and `cargo test` are working for now

ACKs for top commit:
  apoelstra:
    ACK 6ed3bbb

Tree-SHA512: 4d3d5a44c509a0df81527d73ccad1e384c251e28a351b01aae3c19b97b4ce75afa91c6f4cf3b987c7fb8feabfe5abe51fb103a8dfb27493eaa8bf3a74e0b6af4
  • Loading branch information
apoelstra committed Oct 8, 2024
2 parents afb5f48 + 6ed3bbb commit 6a045b5
Show file tree
Hide file tree
Showing 20 changed files with 115 additions and 165 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: 1.58.0
toolchain: 1.63.0
override: true
- name: Running fuzzer
env:
Expand Down Expand Up @@ -68,8 +68,9 @@ jobs:
name: Tests
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
rust: [stable, beta, nightly, 1.58.0]
rust: [stable, beta, nightly, 1.63.0]
steps:
- name: Checkout Crate
uses: actions/checkout@v2
Expand Down
12 changes: 6 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ rand = ["bitcoin/rand"]
base64 = ["bitcoin/base64", "elements/base64"]

[dependencies]
bitcoin = "0.31.0"
elements = "0.24.0"
bitcoin-miniscript = { package = "miniscript", version = "11.0" }
simplicity = { package = "simplicity-lang", version = "0.2.0", optional = true }
bitcoin = "0.32.0"
elements = "0.25.0"
bitcoin-miniscript = { package = "miniscript", version = "12.0" }
simplicity = { package = "simplicity-lang", version = "0.3.0", optional = true }

# Do NOT use this as a feature! Use the `serde` feature instead.
actual-serde = { package = "serde", version = "1.0", optional = true }
Expand All @@ -31,8 +31,8 @@ actual-serde = { package = "serde", version = "1.0", optional = true }
serde_json = "1.0"
actual-rand = { package = "rand", version = "0.8.4"}
serde_test = "1.0.147"
bitcoin = { version = "0.31.0", features = ["base64"] }
secp256k1 = {version = "0.28.0", features = ["rand-std"]}
bitcoin = { version = "0.32.0", features = ["base64"] }
secp256k1 = { version = "0.29.0", features = ["rand-std"] }
actual-base64 = { package = "base64", version = "0.13.0" }

[lints.rust]
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
![Build](https://github.com/ElementsProject/elements-miniscript/workflows/Continuous%20integration/badge.svg)

**Minimum Supported Rust Version:** 1.58.0
**Minimum Supported Rust Version:** 1.63.0

*This crate uses "2018" edition

Expand Down Expand Up @@ -40,7 +40,7 @@ Enabling the `no-std` feature does not disable `std`. To disable the `std` featu
To run the benchmarks run `RUSTFLAGS=--cfg=miniscript_bench cargo +nightly bench --all-features`.

## Minimum Supported Rust Version (MSRV)
This library should always compile with any combination of features on **Rust 1.58.0**.
This library should always compile with any combination of features on **Rust 1.63.0**.


Some dependencies do not play nicely with our MSRV, if you are running the tests
Expand Down
2 changes: 1 addition & 1 deletion bitcoind-tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ edition = "2018"
elements-miniscript = { path = "../" }
elementsd = { version = "0.9.0" }
actual-rand = { package = "rand", version = "0.8.4" }
secp256k1 = { version = "0.28.1", features = ["rand-std"] }
secp256k1 = { version = "0.29.0", features = ["rand-std"] }
2 changes: 1 addition & 1 deletion bitcoind-tests/tests/test_arith.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ pub fn test_desc_satisfy(cl: &ElementsD, testdata: &TestData, desc: &str) -> Vec
testdata.pubdata.genesis_hash,
)
.unwrap();
let msg = secp256k1::Message::from_slice(&sighash_msg[..]).unwrap();
let msg = secp256k1::Message::from_digest_slice(&sighash_msg[..]).unwrap();
let mut aux_rand = [0u8; 32];
rand::thread_rng().fill_bytes(&mut aux_rand);
let sig = secp.sign_schnorr_with_aux_rand(&msg, &keypair, &aux_rand);
Expand Down
2 changes: 1 addition & 1 deletion clippy.toml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
msrv = "1.58.0"
msrv = "1.63.0"
8 changes: 3 additions & 5 deletions contrib/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,9 @@ FEATURES="compiler serde rand base64 simplicity"
cargo --version
rustc --version

# Pin dependencies required to build with Rust 1.58
if cargo --version | grep "1\.58"; then
cargo update -p byteorder --precise 1.4.3
cargo update -p cc --precise 1.0.94
cargo update -p ppv-lite86 --precise 0.2.17
# Pin dependencies required to build with Rust 1.63
if cargo --version | grep "1\.63"; then
cargo update -p regex --precise 1.8.4
fi

# Format if told to
Expand Down
2 changes: 1 addition & 1 deletion fuzz/generate-files.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ $(for name in $(listTargetNames); do echo "$name,"; done)
key: cache-\${{ matrix.target }}-\${{ hashFiles('**/Cargo.toml','**/Cargo.lock') }}
- uses: actions-rs/toolchain@v1
with:
toolchain: 1.58
toolchain: 1.63
override: true
profile: minimal
- name: fuzz
Expand Down
11 changes: 3 additions & 8 deletions src/confidential/slip77.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,10 @@ impl MasterBlindingKey {
}

impl hex::FromHex for MasterBlindingKey {
type Err = hex::HexToArrayError;
type Error = hex::HexToArrayError;

fn from_byte_iter<I>(iter: I) -> Result<Self, Self::Err>
where
I: Iterator<Item = Result<u8, hex::HexToBytesError>>
+ ExactSizeIterator
+ DoubleEndedIterator,
{
Ok(MasterBlindingKey(<[u8; 32]>::from_byte_iter(iter)?))
fn from_hex(s: &str) -> Result<Self, Self::Error> {
Ok(MasterBlindingKey(<[u8; 32]>::from_hex(s)?))
}
}

Expand Down
16 changes: 8 additions & 8 deletions src/descriptor/key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1286,23 +1286,23 @@ mod test {
assert_eq!(public_key.master_fingerprint().to_string(), "abcdef00");
assert_eq!(
public_key.full_derivation_path().unwrap().to_string(),
"m/0'/1'/2"
"0'/1'/2"
);
assert!(!public_key.has_wildcard());

let public_key = DescriptorPublicKey::from_str("[abcdef00/0'/1']tpubDBrgjcxBxnXyL575sHdkpKohWu5qHKoQ7TJXKNrYznh5fVEGBv89hA8ENW7A8MFVpFUSvgLqc4Nj1WZcpePX6rrxviVtPowvMuGF5rdT2Vi/*").unwrap();
assert_eq!(public_key.master_fingerprint().to_string(), "abcdef00");
assert_eq!(
public_key.full_derivation_path().unwrap().to_string(),
"m/0'/1'"
"0'/1'"
);
assert!(public_key.has_wildcard());

let public_key = DescriptorPublicKey::from_str("[abcdef00/0'/1']tpubDBrgjcxBxnXyL575sHdkpKohWu5qHKoQ7TJXKNrYznh5fVEGBv89hA8ENW7A8MFVpFUSvgLqc4Nj1WZcpePX6rrxviVtPowvMuGF5rdT2Vi/*h").unwrap();
assert_eq!(public_key.master_fingerprint().to_string(), "abcdef00");
assert_eq!(
public_key.full_derivation_path().unwrap().to_string(),
"m/0'/1'"
"0'/1'"
);
assert!(public_key.has_wildcard());
}
Expand All @@ -1317,7 +1317,7 @@ mod test {
assert_eq!(public_key.master_fingerprint().to_string(), "2cbe2a6d");
assert_eq!(
public_key.full_derivation_path().unwrap().to_string(),
"m/0'/1'/2"
"0'/1'/2"
);
assert!(!public_key.has_wildcard());

Expand All @@ -1327,7 +1327,7 @@ mod test {
assert_eq!(public_key.master_fingerprint().to_string(), "2cbe2a6d");
assert_eq!(
public_key.full_derivation_path().unwrap().to_string(),
"m/0'/1'/2'"
"0'/1'/2'"
);

let secret_key = DescriptorSecretKey::from_str("tprv8ZgxMBicQKsPcwcD4gSnMti126ZiETsuX7qwrtMypr6FBwAP65puFn4v6c3jrN9VwtMRMph6nyT63NrfUL4C3nBzPcduzVSuHD7zbX2JKVc/0/1/2").unwrap();
Expand All @@ -1336,7 +1336,7 @@ mod test {
assert_eq!(public_key.master_fingerprint().to_string(), "2cbe2a6d");
assert_eq!(
public_key.full_derivation_path().unwrap().to_string(),
"m/0/1/2"
"0/1/2"
);

let secret_key = DescriptorSecretKey::from_str("[aabbccdd]tprv8ZgxMBicQKsPcwcD4gSnMti126ZiETsuX7qwrtMypr6FBwAP65puFn4v6c3jrN9VwtMRMph6nyT63NrfUL4C3nBzPcduzVSuHD7zbX2JKVc/0/1/2").unwrap();
Expand All @@ -1345,7 +1345,7 @@ mod test {
assert_eq!(public_key.master_fingerprint().to_string(), "aabbccdd");
assert_eq!(
public_key.full_derivation_path().unwrap().to_string(),
"m/0/1/2"
"0/1/2"
);

let secret_key = DescriptorSecretKey::from_str("[aabbccdd/90']tprv8ZgxMBicQKsPcwcD4gSnMti126ZiETsuX7qwrtMypr6FBwAP65puFn4v6c3jrN9VwtMRMph6nyT63NrfUL4C3nBzPcduzVSuHD7zbX2JKVc/0'/1'/2").unwrap();
Expand All @@ -1354,7 +1354,7 @@ mod test {
assert_eq!(public_key.master_fingerprint().to_string(), "aabbccdd");
assert_eq!(
public_key.full_derivation_path().unwrap().to_string(),
"m/90'/0'/1'/2"
"90'/0'/1'/2"
);
}

Expand Down
5 changes: 3 additions & 2 deletions src/descriptor/pegin/dynafed_pegin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use std::convert::TryFrom;
use std::fmt;

use bitcoin::blockdata::script::{self, PushBytes};
use bitcoin::{self, ScriptBuf as BtcScript};
use bitcoin::{self, ScriptBuf as BtcScript, Weight};
use elements::secp256k1_zkp;

use crate::descriptor::checksum::{self, verify_checksum};
Expand Down Expand Up @@ -100,6 +100,7 @@ impl_from_tree!(
//
// TODO: Confirm with Andrew about the descriptor type for dynafed
// Assuming sh(wsh) for now.

let fed_desc = BtcDescriptor::<Pk>::from_tree(&ms_expr)?;
let elem_desc = Descriptor::<Pk, CovenantExt<CovExtArgs>>::from_tree(&top.args[1])?;
Ok(Pegin::new(fed_desc, elem_desc))
Expand Down Expand Up @@ -242,7 +243,7 @@ impl<Pk: MiniscriptKey> Pegin<Pk> {
/// and sighash suffix. Includes the weight of the VarInts encoding the
/// scriptSig and witness stack length.
// FIXME: the ToPublicKey bound here should not needed. Fix after upstream
pub fn max_satisfaction_weight(&self) -> Result<usize, Error>
pub fn max_satisfaction_weight(&self) -> Result<Weight, Error>
where
Pk: ToPublicKey,
{
Expand Down
Loading

0 comments on commit 6a045b5

Please sign in to comment.