Skip to content

Commit

Permalink
Merge pull request #82 from BP-WG/v0.10
Browse files Browse the repository at this point in the history
Release v0.10.2
  • Loading branch information
dr-orlovsky authored Mar 20, 2024
2 parents 57d1b0d + 5a361e3 commit 0812dc3
Show file tree
Hide file tree
Showing 20 changed files with 56 additions and 74 deletions.
25 changes: 1 addition & 24 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand All @@ -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
16 changes: 8 additions & 8 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ default-members = ["."]
exclude = ["contrib", "libbitcoin"]

[workspace.package]
version = "0.10.1"
version = "0.10.2"
license = "Apache-2.0"
authors = ["Dr. Maxim Orlovsky <[email protected]>"]
repository = "https://github.com/BP-WG/descriptor-wallet"
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"
Expand All @@ -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"
Expand Down
5 changes: 0 additions & 5 deletions contrib/depCargo.toml

This file was deleted.

4 changes: 2 additions & 2 deletions descriptors/src/derive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::*;
Expand Down
2 changes: 1 addition & 1 deletion descriptors/src/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()?))
}
Expand Down
2 changes: 1 addition & 1 deletion descriptors/src/templates.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 1 addition & 3 deletions hd/src/account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::{
Expand Down Expand Up @@ -465,8 +465,6 @@ impl miniscript::MiniscriptKey for DerivationAccount {

#[cfg(test)]
mod test {
use bitcoin::util::bip32::ExtendedPubKey;

use super::*;

fn xpubs() -> [ExtendedPubKey; 5] {
Expand Down
2 changes: 1 addition & 1 deletion hd/src/indexes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion hd/src/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
9 changes: 2 additions & 7 deletions hd/src/ranges.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -274,12 +274,7 @@ impl<Index> PartialOrd for IndexRange<Index>
where
Index: SegmentIndexes,
{
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
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<Ordering> { Some(self.cmp(other)) }
}

impl<Index> Ord for IndexRange<Index>
Expand Down
1 change: 0 additions & 1 deletion hd/src/standards.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down
2 changes: 1 addition & 1 deletion hd/src/unsatisfiable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
// If not, see <https://opensource.org/licenses/Apache-2.0>.

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};

Expand Down
2 changes: 1 addition & 1 deletion hd/src/xkey.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down
3 changes: 3 additions & 0 deletions psbt/src/global.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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\
Expand Down
6 changes: 3 additions & 3 deletions psbt/src/lex_order.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -64,15 +64,15 @@ impl LexOrder for PsbtV0 {
.input
.clone()
.into_iter()
.zip(self.inputs.clone().into_iter())
.zip(self.inputs.clone())
.collect::<Vec<(_, _)>>();
inputs.sort_by_key(|(k, _)| k.previous_output);

let mut outputs = tx
.output
.clone()
.into_iter()
.zip(self.outputs.clone().into_iter())
.zip(self.outputs.clone())
.collect::<Vec<(_, _)>>();
outputs.lex_order();

Expand Down
6 changes: 3 additions & 3 deletions psbt/src/proprietary.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions psbt/src/sign/signer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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()))
})
Expand Down
22 changes: 18 additions & 4 deletions src/bin/btc-expl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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})");
Expand Down
1 change: 1 addition & 0 deletions src/bin/btc-hot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -650,6 +650,7 @@ impl Args {
Ok(())
}

#[allow(clippy::too_many_arguments)]
fn derive(
&self,
seed_file: &Path,
Expand Down

0 comments on commit 0812dc3

Please sign in to comment.