Bump MSRV to 1.63

The version 1.63 satisfies our requirements for MSRV and provides
significant benefits so this commit bumps it. This commit also starts
using some advantages of the new MSRV, namely namespaced features, weak
dependencies and the ability to use trait bounds in `const` context.

This however does not yet migrade the `rand-std` feature because that
requires a release of `secp256k1` with the same kind of change - bumping
MSRV to 1.63 and removing `rand-std` in favor of weak dependency.
This commit is contained in:
Martin Habovstiak 2024-07-24 14:23:30 +02:00
parent 1276a99061
commit c72069e921
40 changed files with 34 additions and 100 deletions

View File

@ -70,7 +70,7 @@ jobs:
run: ./maintainer-tools/ci/run_task.sh nightly
MSRV: # 2 jobs, one per manifest.
name: Test - 1.56.1 toolchain
name: Test - MSRV toolchain
runs-on: ubuntu-latest
strategy:
fail-fast: false
@ -88,7 +88,7 @@ jobs:
- name: "Select toolchain"
uses: dtolnay/rust-toolchain@stable
with:
toolchain: "1.56.1"
toolchain: "1.63.0"
- name: "Set dependencies"
run: cp Cargo-${{ matrix.dep }}.lock Cargo.lock
- name: "Run test script"

View File

@ -12,7 +12,7 @@
<a href="https://github.com/rust-bitcoin/rust-bitcoin/blob/master/LICENSE"><img alt="CC0 1.0 Universal Licensed" src="https://img.shields.io/badge/license-CC0--1.0-blue.svg"/></a>
<a href="https://github.com/rust-bitcoin/rust-bitcoin/actions?query=workflow%3AContinuous%20integration"><img alt="CI Status" src="https://github.com/rust-bitcoin/rust-bitcoin/workflows/Continuous%20integration/badge.svg"></a>
<a href="https://docs.rs/bitcoin"><img alt="API Docs" src="https://img.shields.io/badge/docs.rs-bitcoin-green"/></a>
<a href="https://blog.rust-lang.org/2021/11/01/Rust-1.56.1.html"><img alt="Rustc Version 1.56.1+" src="https://img.shields.io/badge/rustc-1.56.1%2B-lightgrey.svg"/></a>
<a href="https://blog.rust-lang.org/2021/11/01/Rust-1.63.0.html"><img alt="Rustc Version 1.63.0+" src="https://img.shields.io/badge/rustc-1.63.0%2B-lightgrey.svg"/></a>
<a href="https://gnusha.org/bitcoin-rust/"><img alt="Chat on IRC" src="https://img.shields.io/badge/irc-%23bitcoin--rust%20on%20libera.chat-blue"></a>
<a href="https://github.com/model-checking/kani"><imp alt="kani" src="https://github.com/rust-bitcoin/rust-bitcoin/actions/workflows/kani.yaml/badge.svg"></a>
</p>
@ -69,7 +69,7 @@ For more information please see [`CONTRIBUTING.md`](./CONTRIBUTING.md).
## Minimum Supported Rust Version (MSRV)
This library should always compile with any combination of features on **Rust 1.56.1**.
This library should always compile with any combination of features on **Rust 1.63.0**.
Use `Cargo-minimal.lock` to build the MSRV by copying to `Cargo.lock` and building.

View File

@ -9,7 +9,7 @@ categories = ["cryptography::cryptocurrencies"]
keywords = ["bitcoin", "types"]
readme = "README.md"
edition = "2021"
rust-version = "1.56.1"
rust-version = "1.63.0"
exclude = ["tests", "contrib"]
[features]

View File

@ -4,4 +4,4 @@ Types and logic required to receive bitcoin - i.e., bitcoin addresses.
## Minimum Supported Rust Version (MSRV)
This library should always compile with any combination of features on **Rust 1.56.1**.
This library should always compile with any combination of features on **Rust 1.63.0**.

View File

@ -9,7 +9,7 @@ categories = ["cryptography::cryptocurrencies", "encoding"]
keywords = ["bitcoin", "base58", "encode", "decode", "checksum"]
readme = "README.md"
edition = "2021"
rust-version = "1.56.1"
rust-version = "1.63.0"
exclude = ["tests", "contrib"]
[features]

View File

@ -22,7 +22,7 @@ the checksum.
## Minimum Supported Rust Version (MSRV)
This library should always compile with any combination of features on **Rust 1.56.1**.
This library should always compile with any combination of features on **Rust 1.63.0**.
## Licensing

View File

@ -10,19 +10,18 @@ categories = ["cryptography::cryptocurrencies"]
keywords = [ "crypto", "bitcoin" ]
readme = "../README.md"
edition = "2021"
rust-version = "1.56.1"
rust-version = "1.63.0"
exclude = ["tests", "contrib"]
# If you change features or optional dependencies in any way please update the "# Cargo features" section in lib.rs as well.
[features]
default = [ "std", "secp-recovery" ]
std = ["base58/std", "bech32/std", "hashes/std", "hex/std", "internals/std", "io/std", "primitives/std", "secp256k1/std", "units/std"]
std = ["base58/std", "bech32/std", "hashes/std", "hex/std", "internals/std", "io/std", "primitives/std", "secp256k1/std", "units/std", "bitcoinconsensus?/std"]
rand-std = ["secp256k1/rand-std", "std"]
rand = ["secp256k1/rand"]
serde = ["actual-serde", "hashes/serde", "internals/serde", "primitives/serde", "secp256k1/serde", "units/serde"]
serde = ["dep:serde", "hashes/serde", "internals/serde", "primitives/serde", "secp256k1/serde", "units/serde"]
secp-lowmemory = ["secp256k1/lowmemory"]
secp-recovery = ["secp256k1/recovery"]
bitcoinconsensus-std = ["bitcoinconsensus/std", "std"]
[dependencies]
base58 = { package = "base58ck", version = "0.1.0", default-features = false, features = ["alloc"] }
@ -37,11 +36,9 @@ units = { package = "bitcoin-units", version = "0.1.0", default-features = false
base64 = { version = "0.22.0", optional = true }
ordered = { version = "0.2.0", optional = true }
# Only use this feature for no-std builds, otherwise use bitcoinconsensus-std.
bitcoinconsensus = { version = "0.106.0+26", default-features = false, optional = true }
# Do NOT use this as a feature! Use the `serde` feature instead.
actual-serde = { package = "serde", version = "1.0.103", default-features = false, features = [ "derive", "alloc" ], optional = true }
serde = { version = "1.0.103", default-features = false, features = [ "derive", "alloc" ], optional = true }
[dev-dependencies]
internals = { package = "bitcoin-internals", version = "0.3.0", features = ["test-serde"] }

View File

@ -5,7 +5,7 @@
# shellcheck disable=SC2034
# Test all these features with "std" enabled.
FEATURES_WITH_STD="rand-std serde secp-recovery bitcoinconsensus-std base64 ordered"
FEATURES_WITH_STD="rand-std serde secp-recovery bitcoinconsensus base64 ordered"
# Test all these features without "std" or "alloc" enabled.
FEATURES_WITHOUT_STD="rand serde secp-recovery bitcoinconsensus base64 ordered"

View File

@ -49,7 +49,6 @@ impl BlockHash {
/// * [CBlockHeader definition](https://github.com/bitcoin/bitcoin/blob/345457b542b6a980ccfbc868af0970a6f91d1b82/src/primitives/block.h#L20)
#[derive(Copy, PartialEq, Eq, Clone, PartialOrd, Ord, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "serde", serde(crate = "actual_serde"))]
pub struct Header {
/// Block version, now repurposed for soft fork signalling.
pub version: Version,
@ -142,7 +141,6 @@ impl fmt::Debug for Header {
/// * [BIP34 - Block v2, Height in Coinbase](https://github.com/bitcoin/bips/blob/master/bip-0034.mediawiki)
#[derive(Copy, PartialEq, Eq, Clone, Debug, PartialOrd, Ord, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "serde", serde(crate = "actual_serde"))]
pub struct Version(i32);
impl Version {
@ -223,7 +221,6 @@ impl Decodable for Version {
/// * [CBlock definition](https://github.com/bitcoin/bitcoin/blob/345457b542b6a980ccfbc868af0970a6f91d1b82/src/primitives/block.h#L62)
#[derive(PartialEq, Eq, Clone, Debug)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "serde", serde(crate = "actual_serde"))]
pub struct Block {
/// The block header
pub header: Header,

View File

@ -230,7 +230,6 @@ impl core::str::FromStr for OutPoint {
/// * [CTxIn definition](https://github.com/bitcoin/bitcoin/blob/345457b542b6a980ccfbc868af0970a6f91d1b82/src/primitives/transaction.h#L65)
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Debug, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "serde", serde(crate = "actual_serde"))]
pub struct TxIn {
/// The reference to the previous output that is being used as an input.
pub previous_output: OutPoint,
@ -339,7 +338,6 @@ impl Default for TxIn {
/// * [CTxOut definition](https://github.com/bitcoin/bitcoin/blob/345457b542b6a980ccfbc868af0970a6f91d1b82/src/primitives/transaction.h#L148)
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Debug, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "serde", serde(crate = "actual_serde"))]
pub struct TxOut {
/// The value of the output, in satoshis.
pub value: Amount,
@ -464,7 +462,6 @@ fn size_from_script_pubkey(script_pubkey: &Script) -> usize {
/// transitioning from 0.29 to 0.30.
#[derive(Clone, PartialEq, Eq, Debug, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "serde", serde(crate = "actual_serde"))]
pub struct Transaction {
/// The protocol version, is currently expected to be 1 or 2 (BIP 68).
pub version: Version,
@ -924,7 +921,6 @@ impl std::error::Error for IndexOutOfBoundsError {
/// [BIP-68]: https://github.com/bitcoin/bips/blob/master/bip-0068.mediawiki
#[derive(Copy, PartialEq, Eq, Clone, Debug, PartialOrd, Ord, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "serde", serde(crate = "actual_serde"))]
pub struct Version(pub i32);
impl Version {

View File

@ -405,12 +405,11 @@ where
/// To (de)serialize a field using consensus encoding you can write e.g.:
///
/// ```
/// # use actual_serde::{Serialize, Deserialize};
/// # use serde::{Serialize, Deserialize};
/// use bitcoin::Transaction;
/// use bitcoin::consensus;
///
/// #[derive(Serialize, Deserialize)]
/// # #[serde(crate = "actual_serde")]
/// pub struct MyStruct {
/// #[serde(with = "consensus::serde::With::<consensus::serde::Hex>")]
/// tx: Transaction,

View File

@ -200,16 +200,11 @@ impl fmt::Display for BitcoinconsensusError {
}
}
#[cfg(all(feature = "std", feature = "bitcoinconsensus-std"))]
#[cfg(all(feature = "std", feature = "bitcoinconsensus"))]
impl std::error::Error for BitcoinconsensusError {
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> { Some(&self.0) }
}
#[cfg(all(feature = "std", not(feature = "bitcoinconsensus-std")))]
impl std::error::Error for BitcoinconsensusError {
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> { None }
}
/// An error during transaction validation.
#[derive(Debug, Clone, PartialEq, Eq)]
#[non_exhaustive]

View File

@ -20,7 +20,6 @@ const MAX_SIG_LEN: usize = 73;
/// An ECDSA signature with the corresponding hash type.
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "serde", serde(crate = "actual_serde"))]
pub struct Signature {
/// The underlying ECDSA Signature.
pub signature: secp256k1::ecdsa::Signature,

View File

@ -694,7 +694,6 @@ pub type UntweakedPublicKey = XOnlyPublicKey;
/// Tweaked BIP-340 X-coord-only public key.
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "serde", serde(crate = "actual_serde"))]
#[cfg_attr(feature = "serde", serde(transparent))]
pub struct TweakedPublicKey(XOnlyPublicKey);
@ -727,7 +726,6 @@ pub type UntweakedKeypair = Keypair;
/// ```
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "serde", serde(crate = "actual_serde"))]
#[cfg_attr(feature = "serde", serde(transparent))]
pub struct TweakedKeypair(Keypair);

View File

@ -1788,9 +1788,9 @@ mod tests {
fn sighash_deser_numeric<'de, D>(deserializer: D) -> Result<TapSighashType, D::Error>
where
D: actual_serde::Deserializer<'de>,
D: serde::Deserializer<'de>,
{
use actual_serde::de::{Deserialize, Error, Unexpected};
use serde::de::{Deserialize, Error, Unexpected};
let raw = u8::deserialize(deserializer)?;
TapSighashType::from_consensus_u8(raw).map_err(|_| {
@ -1807,7 +1807,6 @@ mod tests {
use crate::taproot::{TapNodeHash, TapTweakHash};
#[derive(serde::Deserialize)]
#[serde(crate = "actual_serde")]
struct UtxoSpent {
#[serde(rename = "scriptPubKey")]
script_pubkey: ScriptBuf,
@ -1817,7 +1816,6 @@ mod tests {
#[derive(serde::Deserialize)]
#[serde(rename_all = "camelCase")]
#[serde(crate = "actual_serde")]
struct KpsGiven {
#[serde(with = "con_serde::With::<con_serde::Hex>")]
raw_unsigned_tx: Transaction,
@ -1826,7 +1824,6 @@ mod tests {
#[derive(serde::Deserialize)]
#[serde(rename_all = "camelCase")]
#[serde(crate = "actual_serde")]
struct KpsIntermediary {
hash_prevouts: sha256::Hash,
hash_outputs: sha256::Hash,
@ -1837,7 +1834,6 @@ mod tests {
#[derive(serde::Deserialize)]
#[serde(rename_all = "camelCase")]
#[serde(crate = "actual_serde")]
struct KpsInputSpendingGiven {
txin_index: usize,
internal_privkey: SecretKey,
@ -1848,7 +1844,6 @@ mod tests {
#[derive(serde::Deserialize)]
#[serde(rename_all = "camelCase")]
#[serde(crate = "actual_serde")]
struct KpsInputSpendingIntermediary {
internal_pubkey: XOnlyPublicKey,
tweak: TapTweakHash,
@ -1860,14 +1855,12 @@ mod tests {
#[derive(serde::Deserialize)]
#[serde(rename_all = "camelCase")]
#[serde(crate = "actual_serde")]
struct KpsInputSpendingExpected {
witness: Vec<String>,
}
#[derive(serde::Deserialize)]
#[serde(rename_all = "camelCase")]
#[serde(crate = "actual_serde")]
struct KpsInputSpending {
given: KpsInputSpendingGiven,
intermediary: KpsInputSpendingIntermediary,
@ -1877,7 +1870,6 @@ mod tests {
#[derive(serde::Deserialize)]
#[serde(rename_all = "camelCase")]
#[serde(crate = "actual_serde")]
struct KeyPathSpending {
given: KpsGiven,
intermediary: KpsIntermediary,
@ -1886,7 +1878,6 @@ mod tests {
#[derive(serde::Deserialize)]
#[serde(rename_all = "camelCase")]
#[serde(crate = "actual_serde")]
struct TestData {
version: u64,
key_path_spending: Vec<KeyPathSpending>,

View File

@ -16,7 +16,6 @@ use crate::taproot::serialized_signature::{self, SerializedSignature};
/// A BIP340-341 serialized Taproot signature with the corresponding hash type.
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "serde", serde(crate = "actual_serde"))]
pub struct Signature {
/// The underlying schnorr signature.
pub signature: secp256k1::schnorr::Signature,

View File

@ -15,9 +15,6 @@
//!
//! * `base64` (dependency) - enables encoding of PSBTs and message signatures.
//! * `bitcoinconsensus` (dependency) - enables validating scripts and transactions.
//! * `bitcoinconsensus-std` - same as `bitcoinconsensus` but also enables `std` here and in the
//! `bitcoinconsensus` crate. Additionally, enables returning
//! `bitcoinconsensus::Error` from `std::error::Error::source()`.
//! * `default` - enables `std` and `secp-recovery`.
//! * `ordered` (dependency) - adds implementations of `ArbitraryOrd` to some structs.
//! * `rand` (transitive dependency) - makes it more convenient to generate random values.
@ -79,7 +76,7 @@ pub extern crate secp256k1;
#[cfg(feature = "serde")]
#[macro_use]
extern crate actual_serde as serde;
extern crate serde;
mod internal_macros;
#[cfg(feature = "serde")]

View File

@ -65,7 +65,6 @@ impl From<Network> for NetworkKind {
/// The cryptocurrency network to act on.
#[derive(Copy, PartialEq, Eq, PartialOrd, Ord, Clone, Hash, Debug)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "serde", serde(crate = "actual_serde"))]
#[cfg_attr(feature = "serde", serde(rename_all = "lowercase"))]
#[non_exhaustive]
pub enum Network {
@ -425,7 +424,6 @@ mod tests {
#[test]
fn serde_as_core_arg() {
#[derive(Serialize, Deserialize, PartialEq, Debug)]
#[serde(crate = "actual_serde")]
struct T {
#[serde(with = "crate::network::as_core_arg")]
pub network: Network,

View File

@ -88,7 +88,6 @@ macro_rules! do_impl {
/// Work is a measure of how difficult it is to find a hash below a given [`Target`].
#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "serde", serde(crate = "actual_serde"))]
pub struct Work(U256);
impl Work {
@ -124,7 +123,6 @@ impl Sub for Work {
/// ref: <https://en.bitcoin.it/wiki/Target>
#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "serde", serde(crate = "actual_serde"))]
pub struct Target(U256);
impl Target {
@ -347,7 +345,6 @@ do_impl!(Target);
/// terms of the underlying `u32`.
#[derive(Copy, Clone, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "serde", serde(crate = "actual_serde"))]
pub struct CompactTarget(u32);
impl CompactTarget {

View File

@ -67,7 +67,6 @@ const PSBT_IN_PROPRIETARY: u8 = 0xFC;
/// transaction.
#[derive(Clone, Default, Debug, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "serde", serde(crate = "actual_serde"))]
pub struct Input {
/// The non-witness transaction this input spends from. Should only be
/// `Option::Some` for inputs which spend non-segwit outputs or
@ -148,7 +147,6 @@ pub struct Input {
/// ```
#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "serde", serde(crate = "actual_serde"))]
pub struct PsbtSighashType {
pub(in crate::psbt) inner: u32,
}

View File

@ -28,7 +28,6 @@ const PSBT_OUT_PROPRIETARY: u8 = 0xFC;
/// transaction.
#[derive(Clone, Default, Debug, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "serde", serde(crate = "actual_serde"))]
pub struct Output {
/// The redeem script for this output.
pub redeem_script: Option<ScriptBuf>,

View File

@ -39,7 +39,6 @@ pub use self::{
/// A Partially Signed Transaction.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "serde", serde(crate = "actual_serde"))]
pub struct Psbt {
/// The unsigned transaction, scriptSigs and witnesses for each input must be empty.
pub unsigned_tx: Transaction,

View File

@ -21,7 +21,6 @@ use crate::psbt::Error;
/// `<key> := <keylen> <keytype> <keydata>`
#[derive(Debug, PartialEq, Hash, Eq, Clone, Ord, PartialOrd)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "serde", serde(crate = "actual_serde"))]
pub struct Key {
/// The type of this PSBT key.
pub type_value: u8,
@ -34,7 +33,6 @@ pub struct Key {
/// `<keypair> := <key> <value>`
#[derive(Debug, PartialEq, Eq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "serde", serde(crate = "actual_serde"))]
pub struct Pair {
/// The key of this key-value pair.
pub key: Key,
@ -51,7 +49,6 @@ pub type ProprietaryType = u8;
/// structure according to BIP 174.
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "serde", serde(crate = "actual_serde"))]
pub struct ProprietaryKey<Subtype = ProprietaryType>
where
Subtype: Copy + From<u8> + Into<u8>,

View File

@ -166,7 +166,6 @@ pub mod btreemap_as_seq_byte_values {
/// A custom key-value pair type that serialized the bytes as hex.
#[derive(Debug, Deserialize)]
#[serde(crate = "actual_serde")]
struct OwnedPair<T>(
T,
#[serde(deserialize_with = "crate::serde_utils::hex_bytes::deserialize")] Vec<u8>,
@ -174,7 +173,6 @@ pub mod btreemap_as_seq_byte_values {
/// A custom key-value pair type that serialized the bytes as hex.
#[derive(Debug, Serialize)]
#[serde(crate = "actual_serde")]
struct BorrowedPair<'a, T: 'static>(
&'a T,
#[serde(serialize_with = "crate::serde_utils::hex_bytes::serialize")] &'a [u8],

View File

@ -13,7 +13,6 @@ use crate::prelude::{Borrow, BorrowMut, Box, Vec};
/// The Merkle proof for inclusion of a tree in a Taproot tree hash.
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "serde", serde(crate = "actual_serde"))]
#[cfg_attr(feature = "serde", serde(into = "Vec<TapNodeHash>"))]
#[cfg_attr(feature = "serde", serde(try_from = "Vec<TapNodeHash>"))]
pub struct TaprootMerkleBranch(Vec<TapNodeHash>);

View File

@ -692,7 +692,6 @@ impl std::error::Error for HiddenNodesError {
// for which we need a separate type.
#[derive(Clone, Debug, Eq, PartialEq, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "serde", serde(crate = "actual_serde"))]
#[cfg_attr(feature = "serde", serde(into = "NodeInfo"))]
#[cfg_attr(feature = "serde", serde(try_from = "NodeInfo"))]
pub struct TapTree(NodeInfo);
@ -952,7 +951,6 @@ impl<'de> serde::Deserialize<'de> for NodeInfo {
/// Leaf node in a Taproot tree. Can be either hidden or known.
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "serde", serde(crate = "actual_serde"))]
pub enum TapLeaf {
/// A known script
Script(ScriptBuf, LeafVersion),
@ -1081,7 +1079,6 @@ impl<'leaf> ScriptLeaf<'leaf> {
/// Control block data structure used in Tapscript satisfaction.
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "serde", serde(crate = "actual_serde"))]
pub struct ControlBlock {
/// The tapleaf version.
pub leaf_version: LeafVersion,

View File

@ -1,2 +1,2 @@
msrv = "1.56.1"
msrv = "1.63.0"
too-many-arguments-threshold = 13

View File

@ -13,7 +13,7 @@ cat > "$REPO_DIR/fuzz/Cargo.toml" <<EOF
[package]
name = "bitcoin-fuzz"
edition = "2021"
rust-version = "1.56.1"
rust-version = "1.63.0"
version = "0.0.1"
authors = ["Generated by fuzz/generate-files.sh"]
publish = false

View File

@ -10,7 +10,7 @@ categories = ["algorithms"]
keywords = [ "crypto", "bitcoin", "hash", "digest" ]
readme = "README.md"
edition = "2021"
rust-version = "1.56.1"
rust-version = "1.63.0"
exclude = ["tests", "contrib"]
[features]

View File

@ -9,7 +9,7 @@ since these are needed to display hashes anway.
## Minimum Supported Rust Version (MSRV)
This library should always compile with any combination of features on **Rust 1.56.1**.
This library should always compile with any combination of features on **Rust 1.63.0**.
## Contributions

View File

@ -36,22 +36,9 @@ impl<T: Tag> schemars::JsonSchema for Hash<T> {
}
}
// This impl, and the trait bound `(T,): Tag` below, are hacks to allow defining
// constfns on Hash<T> for a generic T. This trick was discovered by
// https://github.com/rust-lang/rust/issues/90912
//
// When we drop rustc 1.56.1 we will be able to remove this, which will be a
// technically breaking change but in practice probably fine to just drop.
impl<T> Tag for (T,)
where
T: Tag,
{
fn engine() -> sha256::HashEngine { T::engine() }
}
impl<T> Hash<T>
where
(T,): Tag,
T: Tag,
{
const fn internal_new(arr: [u8; 32]) -> Self { Hash(arr, PhantomData) }
@ -70,7 +57,7 @@ where
}
/// Constructs a new engine.
pub fn engine() -> HashEngine { <(T,)>::engine() }
pub fn engine() -> HashEngine { T::engine() }
/// Produces a hash from the current state of a given engine.
pub fn from_engine(e: HashEngine) -> Hash<T> { from_engine(e) }
@ -146,7 +133,7 @@ crate::internal_macros::hash_trait_impls!(256, false, T: Tag);
fn from_engine<T>(e: sha256::HashEngine) -> Hash<T>
where
(T,): Tag,
T: Tag,
{
Hash::from_byte_array(sha256::Hash::from_engine(e).to_byte_array())
}

View File

@ -10,7 +10,7 @@ categories = ["cryptography::cryptocurrencies"]
keywords = ["internal"]
readme = "README.md"
edition = "2021"
rust-version = "1.56.1"
rust-version = "1.63.0"
exclude = ["tests", "contrib"]
[features]

View File

@ -10,7 +10,7 @@ categories = ["no-std"]
keywords = [ "io", "no-std" ]
readme = "README.md"
edition = "2021"
rust-version = "1.56.1"
rust-version = "1.63.0"
exclude = ["tests", "contrib"]
[features]

View File

@ -11,14 +11,14 @@ categories = ["cryptography::cryptocurrencies"]
keywords = ["bitcoin", "types"]
readme = "README.md"
edition = "2021"
rust-version = "1.56.1"
rust-version = "1.63.0"
exclude = ["tests", "contrib"]
[features]
default = ["std"]
std = ["alloc", "internals/std", "io/std", "units/std"]
alloc = ["internals/alloc", "io/alloc", "units/alloc"]
serde = ["actual-serde", "internals/serde", "units/serde"]
serde = ["dep:serde", "internals/serde", "units/serde"]
[dependencies]
internals = { package = "bitcoin-internals", version = "0.3.0" }
@ -27,8 +27,7 @@ units = { package = "bitcoin-units", version = "0.1.0", default-features = false
ordered = { version = "0.2.0", optional = true }
# Do NOT use this as a feature! Use the `serde` feature instead.
actual-serde = { package = "serde", version = "1.0.103", default-features = false, features = ["derive"], optional = true }
serde = { version = "1.0.103", default-features = false, features = ["derive"], optional = true }
[dev-dependencies]

View File

@ -5,7 +5,7 @@ This crate provides primitive data types that are used throughout the
## Minimum Supported Rust Version (MSRV)
This library should always compile with any combination of features on **Rust 1.56.1**.
This library should always compile with any combination of features on **Rust 1.63.0**.
## Licensing

View File

@ -25,7 +25,7 @@ extern crate std;
#[cfg(feature = "serde")]
#[macro_use]
extern crate actual_serde as serde;
extern crate serde;
#[cfg(feature = "alloc")]
pub mod locktime;

View File

@ -37,7 +37,6 @@ pub use units::locktime::relative::*;
/// * [BIP 112 CHECKSEQUENCEVERIFY](https://github.com/bitcoin/bips/blob/master/bip-0112.mediawiki)
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "serde", serde(crate = "actual_serde"))]
pub enum LockTime {
/// A block height lock time value.
Blocks(Height),

View File

@ -30,7 +30,6 @@ use crate::locktime::relative;
/// Bitcoin transaction input sequence number.
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "serde", serde(crate = "actual_serde"))]
pub struct Sequence(pub u32);
impl Sequence {

View File

@ -9,7 +9,7 @@ categories = ["cryptography::cryptocurrencies"]
keywords = ["bitcoin", "newtypes"]
readme = "README.md"
edition = "2021"
rust-version = "1.56.1"
rust-version = "1.63.0"
exclude = ["tests", "contrib"]
[features]

View File

@ -4,7 +4,7 @@ This crate provides basic Bitcoin numeric units such as `Amount`.
## Minimum Supported Rust Version (MSRV)
This library should always compile with any combination of features on **Rust 1.56.1**.
This library should always compile with any combination of features on **Rust 1.63.0**.
## Licensing