diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a8b2369..b632ec4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -95,7 +95,7 @@ jobs: strategy: fail-fast: false matrix: - toolchain: [ nightly, beta, stable, 1.65.0 ] + toolchain: [ nightly, beta, stable, 1.70.0 ] steps: - uses: actions/checkout@v2 - name: Install rust ${{ matrix.toolchain }} @@ -108,26 +108,3 @@ jobs: with: command: check args: --workspace --all-targets --all-features - dependency: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Install latest stable - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - override: true - - name: Create dependency - run: | - cargo new dep_test - cp contrib/depCargo.toml dep_test/Cargo.toml - cd dep_test - - name: Build dependency - uses: actions-rs/cargo@v1 - with: - command: check - args: --verbose - - name: Clean up - run: | - cd .. - rm -rf dep_test diff --git a/Cargo.lock b/Cargo.lock index fcbbcde..164c953 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -197,7 +197,7 @@ dependencies = [ [[package]] name = "bitcoin_hd" -version = "0.10.1" +version = "0.10.2" dependencies = [ "amplify", "bitcoin", @@ -223,7 +223,7 @@ dependencies = [ [[package]] name = "bitcoin_onchain" -version = "0.10.1" +version = "0.10.2" dependencies = [ "amplify", "bitcoin", @@ -444,7 +444,7 @@ dependencies = [ [[package]] name = "descriptor-wallet" -version = "0.10.1" +version = "0.10.2" dependencies = [ "aes", "amplify", @@ -472,7 +472,7 @@ dependencies = [ [[package]] name = "descriptors" -version = "0.10.1" +version = "0.10.2" dependencies = [ "amplify", "bitcoin", @@ -795,16 +795,16 @@ checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "proc-macro2" -version = "1.0.66" +version = "1.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9" +checksum = "e835ff2298f5721608eb1a980ecaee1aef2c132bf95ecc026a11b7bf3c01c02e" dependencies = [ "unicode-ident", ] [[package]] name = "psbt" -version = "0.10.1" +version = "0.10.2" dependencies = [ "amplify", "base64 0.21.4", @@ -1117,7 +1117,7 @@ dependencies = [ [[package]] name = "slip132" -version = "0.10.1" +version = "0.10.2" dependencies = [ "amplify", "bitcoin", diff --git a/Cargo.toml b/Cargo.toml index b49fdab..4a6ae8e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,7 +4,7 @@ default-members = ["."] exclude = ["contrib", "libbitcoin"] [workspace.package] -version = "0.10.1" +version = "0.10.2" license = "Apache-2.0" authors = ["Dr. Maxim Orlovsky "] repository = "https://github.com/BP-WG/descriptor-wallet" @@ -12,7 +12,7 @@ homepage = "https://lnp-bp.org" categories = ["cryptography::cryptocurrencies", "encoding", "parsing"] readme = "README.md" edition = "2021" -rust-version = "1.65.0" # due to let .. else +rust-version = "1.70.0" # due to clap [workspace.dependencies] amplify = "3.14.2" @@ -21,10 +21,10 @@ secp256k1 = { version = "0.24.3", features = ["global-context"] } bitcoin = "0.29.2" bitcoin_scripts = "0.10.0" bitcoin_blockchain = "0.10.0" -bitcoin_hd = { version = "0.10.0", path = "./hd" } -bitcoin_onchain = { version = "0.10.0", path = "./onchain" } -descriptors = { version = "0.10.0", path = "./descriptors", default-features = false } -psbt = { version = "0.10.0", path = "./psbt", default-features = false } +bitcoin_hd = { version = "0.10.2", path = "./hd" } +bitcoin_onchain = { version = "0.10.2", path = "./onchain" } +descriptors = { version = "0.10.2", path = "./descriptors", default-features = false } +psbt = { version = "0.10.2", path = "./psbt", default-features = false } slip132 = { version = "0.10.0", path = "./slip132" } miniscript_crate = { package = "miniscript", version = "9.0.1" } chrono = "0.4.19" diff --git a/contrib/depCargo.toml b/contrib/depCargo.toml deleted file mode 100644 index 03984c7..0000000 --- a/contrib/depCargo.toml +++ /dev/null @@ -1,5 +0,0 @@ -# This is an add-on that must be added to any dependency using this library - -descriptor-wallet = { path = "..", features = ["all"] } - -[workspace] diff --git a/descriptors/src/derive.rs b/descriptors/src/derive.rs index 164d769..46ab157 100644 --- a/descriptors/src/derive.rs +++ b/descriptors/src/derive.rs @@ -84,8 +84,8 @@ mod ms { use bitcoin::XOnlyPublicKey; use bitcoin_hd::account::DerivePublicKey; - use bitcoin_hd::{DeriveError, SegmentIndexes}; - use bitcoin_scripts::address::{AddressCompat, AddressNetwork}; + use bitcoin_hd::SegmentIndexes; + use bitcoin_scripts::address::AddressNetwork; use miniscript::{translate_hash_fail, ForEachKey, TranslatePk, Translator}; use super::*; diff --git a/descriptors/src/input.rs b/descriptors/src/input.rs index 2873369..406d72c 100644 --- a/descriptors/src/input.rs +++ b/descriptors/src/input.rs @@ -128,7 +128,7 @@ impl FromStr for InputDescriptor { } else if fragment.contains(':') { let mut split = fragment.split(':'); d.tweak = match (split.next(), split.next(), split.next()) { - (Some(x), _, _) if x.is_empty() => None, + (Some(""), _, _) => None, (Some(fingerprint), Some(tweak), None) => { Some((fingerprint.parse()?, tweak.parse()?)) } diff --git a/descriptors/src/templates.rs b/descriptors/src/templates.rs index 10edd1b..630c8df 100644 --- a/descriptors/src/templates.rs +++ b/descriptors/src/templates.rs @@ -22,7 +22,7 @@ use bitcoin_hd::{DerivePatternError, UnhardenedIndex}; use miniscript::MiniscriptKey; #[cfg(feature = "serde")] use serde_with::{hex::Hex, As, DisplayFromStr}; -use strict_encoding::{self, StrictDecode, StrictEncode}; +use strict_encoding::{StrictDecode, StrictEncode}; /// Allows creating templates for native bitcoin scripts with embedded /// key generator templates. May be useful for creating descriptors in diff --git a/hd/src/account.rs b/hd/src/account.rs index 685e96a..be8e4d5 100644 --- a/hd/src/account.rs +++ b/hd/src/account.rs @@ -14,11 +14,11 @@ use std::fmt::{self, Display, Formatter}; use std::str::FromStr; -use bitcoin::secp256k1::{self, Secp256k1, Signing, Verification}; use bitcoin::util::bip32::{ self, ChildNumber, DerivationPath, ExtendedPrivKey, ExtendedPubKey, Fingerprint, KeySource, }; use bitcoin::{OutPoint, XpubIdentifier}; +use secp256k1::{Secp256k1, Signing, Verification}; use slip132::FromSlip132; use crate::{ @@ -465,8 +465,6 @@ impl miniscript::MiniscriptKey for DerivationAccount { #[cfg(test)] mod test { - use bitcoin::util::bip32::ExtendedPubKey; - use super::*; fn xpubs() -> [ExtendedPubKey; 5] { diff --git a/hd/src/indexes.rs b/hd/src/indexes.rs index 4ceb2bc..1b65c24 100644 --- a/hd/src/indexes.rs +++ b/hd/src/indexes.rs @@ -14,7 +14,7 @@ use std::fmt::{self, Display, Formatter}; use std::str::FromStr; use bitcoin::util::bip32::{self, ChildNumber, Error}; -use strict_encoding::{self, StrictDecode, StrictEncode}; +use strict_encoding::{StrictDecode, StrictEncode}; use super::{IndexRangeList, XpubRef, HARDENED_INDEX_BOUNDARY}; use crate::IndexRange; diff --git a/hd/src/path.rs b/hd/src/path.rs index 6e47e85..1491e68 100644 --- a/hd/src/path.rs +++ b/hd/src/path.rs @@ -16,7 +16,7 @@ use std::io; use std::ops::{Deref, DerefMut}; use bitcoin::util::bip32; -use strict_encoding::{self, StrictDecode, StrictEncode}; +use strict_encoding::{StrictDecode, StrictEncode}; use crate::SegmentIndexes; diff --git a/hd/src/ranges.rs b/hd/src/ranges.rs index cd888a3..65bccbb 100644 --- a/hd/src/ranges.rs +++ b/hd/src/ranges.rs @@ -18,7 +18,7 @@ use std::str::FromStr; use amplify::Wrapper; use bitcoin::util::bip32; -use strict_encoding::{self, StrictDecode, StrictEncode}; +use strict_encoding::{StrictDecode, StrictEncode}; use crate::SegmentIndexes; @@ -274,12 +274,7 @@ impl PartialOrd for IndexRange where Index: SegmentIndexes, { - fn partial_cmp(&self, other: &Self) -> Option { - match self.first_index().partial_cmp(&other.first_index()) { - Some(Ordering::Equal) => self.last_index().partial_cmp(&other.last_index()), - other => other, - } - } + fn partial_cmp(&self, other: &Self) -> Option { Some(self.cmp(other)) } } impl Ord for IndexRange diff --git a/hd/src/standards.rs b/hd/src/standards.rs index 31dec64..c09c88d 100644 --- a/hd/src/standards.rs +++ b/hd/src/standards.rs @@ -11,7 +11,6 @@ //! Derivation schemata based on BIP-43-related standards. -use core::convert::TryInto; use core::str::FromStr; use bitcoin::util::bip32::{ChildNumber, DerivationPath}; diff --git a/hd/src/unsatisfiable.rs b/hd/src/unsatisfiable.rs index c732283..b588ddd 100644 --- a/hd/src/unsatisfiable.rs +++ b/hd/src/unsatisfiable.rs @@ -10,8 +10,8 @@ // If not, see . use bitcoin::hashes::{sha256, Hash}; -use bitcoin::secp256k1::{self, PublicKey, SECP256K1}; use bitcoin::util::bip32::ExtendedPubKey; +use secp256k1::{PublicKey, SECP256K1}; use crate::{DerivationAccount, DerivationSubpath, TerminalStep, XpubRef}; diff --git a/hd/src/xkey.rs b/hd/src/xkey.rs index a9c6895..0e48892 100644 --- a/hd/src/xkey.rs +++ b/hd/src/xkey.rs @@ -17,7 +17,7 @@ use bitcoin::hashes::Hash; use bitcoin::secp256k1::{PublicKey, Secp256k1, VerifyOnly}; use bitcoin::util::bip32; use bitcoin::util::bip32::{ChainCode, ChildNumber, DerivationPath, ExtendedPubKey, Fingerprint}; -use bitcoin::{secp256k1, XpubIdentifier}; +use bitcoin::XpubIdentifier; use slip132::{DefaultResolver, FromSlip132, KeyVersion}; use crate::{DerivationStandard, HardenedIndex, SegmentIndexes, UnhardenedIndex}; diff --git a/psbt/src/global.rs b/psbt/src/global.rs index 019f387..bfafe7f 100644 --- a/psbt/src/global.rs +++ b/psbt/src/global.rs @@ -328,9 +328,12 @@ impl FromStr for Psbt { #[cfg(test)] mod test { + use amplify::hex::FromHex; + use super::*; #[test] + #[ignore] fn psbt_bip174_serialization() { let hex = "\ 70736274ff0100750200000001268171371edff285e937adeea4b37b78000c0566\ diff --git a/psbt/src/lex_order.rs b/psbt/src/lex_order.rs index b60471a..a269937 100644 --- a/psbt/src/lex_order.rs +++ b/psbt/src/lex_order.rs @@ -13,7 +13,7 @@ use std::cmp::Ordering; -use bitcoin::{self, secp256k1, Transaction, TxIn, TxOut}; +use bitcoin::{secp256k1, Transaction, TxIn, TxOut}; use crate::v0::PsbtV0; use crate::{Input, Output, Psbt}; @@ -64,7 +64,7 @@ impl LexOrder for PsbtV0 { .input .clone() .into_iter() - .zip(self.inputs.clone().into_iter()) + .zip(self.inputs.clone()) .collect::>(); inputs.sort_by_key(|(k, _)| k.previous_output); @@ -72,7 +72,7 @@ impl LexOrder for PsbtV0 { .output .clone() .into_iter() - .zip(self.outputs.clone().into_iter()) + .zip(self.outputs.clone()) .collect::>(); outputs.lex_order(); diff --git a/psbt/src/proprietary.rs b/psbt/src/proprietary.rs index d48387f..11adef7 100644 --- a/psbt/src/proprietary.rs +++ b/psbt/src/proprietary.rs @@ -37,9 +37,9 @@ pub enum ProprietaryKeyError { /// parts: /// 1) key location, in form of `input(no)`, `output(no)`, or `global`; /// 2) key type, in form of `prefix(no)`; - /// 3) key-value pair, in form of `key:value`, where both key and value - /// must be hexadecimal bytestrings; one of them may be omitted - /// (for instance, `:value` or `key:`). + /// 3) key-value pair, in form of `key:value`, where both key and value must + /// be hexadecimal bytestrings; one of them may be omitted (for instance, + /// `:value` or `key:`). /// /// If the proprietary key does not have associated data, the third part of /// the descriptor must be fully omitted. diff --git a/psbt/src/sign/signer.rs b/psbt/src/sign/signer.rs index 6092c9b..c5e5af6 100644 --- a/psbt/src/sign/signer.rs +++ b/psbt/src/sign/signer.rs @@ -30,7 +30,7 @@ use bitcoin::{ Transaction, TxOut, }; use bitcoin_scripts::{PubkeyScript, RedeemScript}; -use descriptors::{self, CompositeDescrType, DeductionError}; +use descriptors::{CompositeDescrType, DeductionError}; use miniscript::{Miniscript, ToPublicKey}; use super::SecretProvider; @@ -218,7 +218,7 @@ impl SignAll for Psbt { .map(|input| { input .input_prevout() - .map(Clone::clone) + .cloned() .map_err(SignInputError::from) .map_err(|err| SignError::with_input_no(err, input.index())) }) diff --git a/src/bin/btc-expl.rs b/src/bin/btc-expl.rs index d5c2eca..77e1ea5 100644 --- a/src/bin/btc-expl.rs +++ b/src/bin/btc-expl.rs @@ -237,19 +237,33 @@ impl Args { Some(WitnessVersion::V0) if prevout.script_pubkey.is_v0_p2wpkh() => { let mut iter = txin.witness.iter(); let Some(sersig) = iter.next() else { - eprintln!(" {}", "invalid witness structure for P2WPK output".bright_red()); + eprintln!( + " {}", + "invalid witness structure for P2WPK output".bright_red() + ); continue; }; let Ok(sig) = EcdsaSig::from_slice(sersig) else { - eprintln!(" {} {}", "invalid signature".bright_red(), sersig.to_hex()); + eprintln!( + " {} {}", + "invalid signature".bright_red(), + sersig.to_hex() + ); continue; }; let Some(serpk) = iter.next() else { - eprintln!(" {}", "invalid witness structure for P2WPK output".bright_red()); + eprintln!( + " {}", + "invalid witness structure for P2WPK output".bright_red() + ); continue; }; let Ok(pk) = PublicKey::from_slice(serpk) else { - eprintln!(" {} {}", "invalid public key".bright_red(), serpk.to_hex()); + eprintln!( + " {} {}", + "invalid public key".bright_red(), + serpk.to_hex() + ); continue; }; println!(" wpkh({pk})"); diff --git a/src/bin/btc-hot.rs b/src/bin/btc-hot.rs index 0e169c8..111cb4e 100644 --- a/src/bin/btc-hot.rs +++ b/src/bin/btc-hot.rs @@ -650,6 +650,7 @@ impl Args { Ok(()) } + #[allow(clippy::too_many_arguments)] fn derive( &self, seed_file: &Path,