From c72069e921d1fac8add62dde85c3ea388f364eb7 Mon Sep 17 00:00:00 2001
From: Martin Habovstiak
Date: Wed, 24 Jul 2024 14:23:30 +0200
Subject: [PATCH] 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.
---
.github/workflows/rust.yml | 4 ++--
README.md | 4 ++--
addresses/Cargo.toml | 2 +-
addresses/README.md | 2 +-
base58/Cargo.toml | 2 +-
base58/README.md | 2 +-
bitcoin/Cargo.toml | 11 ++++-------
bitcoin/contrib/test_vars.sh | 2 +-
bitcoin/src/blockdata/block.rs | 3 ---
bitcoin/src/blockdata/transaction.rs | 4 ----
bitcoin/src/consensus/serde.rs | 3 +--
bitcoin/src/consensus_validation.rs | 7 +------
bitcoin/src/crypto/ecdsa.rs | 1 -
bitcoin/src/crypto/key.rs | 2 --
bitcoin/src/crypto/sighash.rs | 13 ++-----------
bitcoin/src/crypto/taproot.rs | 1 -
bitcoin/src/lib.rs | 5 +----
bitcoin/src/network/mod.rs | 2 --
bitcoin/src/pow.rs | 3 ---
bitcoin/src/psbt/map/input.rs | 2 --
bitcoin/src/psbt/map/output.rs | 1 -
bitcoin/src/psbt/mod.rs | 1 -
bitcoin/src/psbt/raw.rs | 3 ---
bitcoin/src/serde_utils.rs | 2 --
bitcoin/src/taproot/merkle_branch.rs | 1 -
bitcoin/src/taproot/mod.rs | 3 ---
clippy.toml | 2 +-
fuzz/generate-files.sh | 2 +-
hashes/Cargo.toml | 2 +-
hashes/README.md | 2 +-
hashes/src/sha256t.rs | 19 +++----------------
internals/Cargo.toml | 2 +-
io/Cargo.toml | 2 +-
primitives/Cargo.toml | 7 +++----
primitives/README.md | 2 +-
primitives/src/lib.rs | 2 +-
primitives/src/locktime/relative.rs | 1 -
primitives/src/sequence.rs | 1 -
units/Cargo.toml | 2 +-
units/README.md | 2 +-
40 files changed, 34 insertions(+), 100 deletions(-)
diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml
index ee10b04db..3e5c3af11 100644
--- a/.github/workflows/rust.yml
+++ b/.github/workflows/rust.yml
@@ -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"
diff --git a/README.md b/README.md
index d2e76fad6..c8b8ee335 100644
--- a/README.md
+++ b/README.md
@@ -12,7 +12,7 @@
-
+
@@ -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.
diff --git a/addresses/Cargo.toml b/addresses/Cargo.toml
index 156be7a8d..8e3825299 100644
--- a/addresses/Cargo.toml
+++ b/addresses/Cargo.toml
@@ -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]
diff --git a/addresses/README.md b/addresses/README.md
index 41ab86553..aaf09cc28 100644
--- a/addresses/README.md
+++ b/addresses/README.md
@@ -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**.
diff --git a/base58/Cargo.toml b/base58/Cargo.toml
index 9141a1711..7580164c3 100644
--- a/base58/Cargo.toml
+++ b/base58/Cargo.toml
@@ -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]
diff --git a/base58/README.md b/base58/README.md
index d69760c5a..f28534d5a 100644
--- a/base58/README.md
+++ b/base58/README.md
@@ -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
diff --git a/bitcoin/Cargo.toml b/bitcoin/Cargo.toml
index bd7b420f5..9da854842 100644
--- a/bitcoin/Cargo.toml
+++ b/bitcoin/Cargo.toml
@@ -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"] }
diff --git a/bitcoin/contrib/test_vars.sh b/bitcoin/contrib/test_vars.sh
index 7dbdf4076..aac69b689 100644
--- a/bitcoin/contrib/test_vars.sh
+++ b/bitcoin/contrib/test_vars.sh
@@ -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"
diff --git a/bitcoin/src/blockdata/block.rs b/bitcoin/src/blockdata/block.rs
index 109473bd0..454f6681f 100644
--- a/bitcoin/src/blockdata/block.rs
+++ b/bitcoin/src/blockdata/block.rs
@@ -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,
diff --git a/bitcoin/src/blockdata/transaction.rs b/bitcoin/src/blockdata/transaction.rs
index dbf8cebc9..2ea5950d2 100644
--- a/bitcoin/src/blockdata/transaction.rs
+++ b/bitcoin/src/blockdata/transaction.rs
@@ -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 {
diff --git a/bitcoin/src/consensus/serde.rs b/bitcoin/src/consensus/serde.rs
index 7f589179e..9d577047f 100644
--- a/bitcoin/src/consensus/serde.rs
+++ b/bitcoin/src/consensus/serde.rs
@@ -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::")]
/// tx: Transaction,
diff --git a/bitcoin/src/consensus_validation.rs b/bitcoin/src/consensus_validation.rs
index ad13ca45b..65f59e91b 100644
--- a/bitcoin/src/consensus_validation.rs
+++ b/bitcoin/src/consensus_validation.rs
@@ -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]
diff --git a/bitcoin/src/crypto/ecdsa.rs b/bitcoin/src/crypto/ecdsa.rs
index d009e8735..3731739f4 100644
--- a/bitcoin/src/crypto/ecdsa.rs
+++ b/bitcoin/src/crypto/ecdsa.rs
@@ -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,
diff --git a/bitcoin/src/crypto/key.rs b/bitcoin/src/crypto/key.rs
index 05c869e83..f4c1cdbf8 100644
--- a/bitcoin/src/crypto/key.rs
+++ b/bitcoin/src/crypto/key.rs
@@ -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);
diff --git a/bitcoin/src/crypto/sighash.rs b/bitcoin/src/crypto/sighash.rs
index ef47c7bd5..16a9f63c2 100644
--- a/bitcoin/src/crypto/sighash.rs
+++ b/bitcoin/src/crypto/sighash.rs
@@ -1788,9 +1788,9 @@ mod tests {
fn sighash_deser_numeric<'de, D>(deserializer: D) -> Result
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::")]
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,
}
#[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,
diff --git a/bitcoin/src/crypto/taproot.rs b/bitcoin/src/crypto/taproot.rs
index e21dfeca0..7bbb6e47b 100644
--- a/bitcoin/src/crypto/taproot.rs
+++ b/bitcoin/src/crypto/taproot.rs
@@ -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,
diff --git a/bitcoin/src/lib.rs b/bitcoin/src/lib.rs
index 47f8f1ada..e5e25f53f 100644
--- a/bitcoin/src/lib.rs
+++ b/bitcoin/src/lib.rs
@@ -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")]
diff --git a/bitcoin/src/network/mod.rs b/bitcoin/src/network/mod.rs
index ea244fbf5..fcc50ad8b 100644
--- a/bitcoin/src/network/mod.rs
+++ b/bitcoin/src/network/mod.rs
@@ -65,7 +65,6 @@ impl From 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,
diff --git a/bitcoin/src/pow.rs b/bitcoin/src/pow.rs
index deb2b8289..abf449588 100644
--- a/bitcoin/src/pow.rs
+++ b/bitcoin/src/pow.rs
@@ -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:
#[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 {
diff --git a/bitcoin/src/psbt/map/input.rs b/bitcoin/src/psbt/map/input.rs
index 7a713aef0..e52c8389c 100644
--- a/bitcoin/src/psbt/map/input.rs
+++ b/bitcoin/src/psbt/map/input.rs
@@ -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,
}
diff --git a/bitcoin/src/psbt/map/output.rs b/bitcoin/src/psbt/map/output.rs
index 184cac068..499f0ca94 100644
--- a/bitcoin/src/psbt/map/output.rs
+++ b/bitcoin/src/psbt/map/output.rs
@@ -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,
diff --git a/bitcoin/src/psbt/mod.rs b/bitcoin/src/psbt/mod.rs
index 65db04616..47ddafcf0 100644
--- a/bitcoin/src/psbt/mod.rs
+++ b/bitcoin/src/psbt/mod.rs
@@ -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,
diff --git a/bitcoin/src/psbt/raw.rs b/bitcoin/src/psbt/raw.rs
index 73b38f41b..0e4739bb0 100644
--- a/bitcoin/src/psbt/raw.rs
+++ b/bitcoin/src/psbt/raw.rs
@@ -21,7 +21,6 @@ use crate::psbt::Error;
/// ` := `
#[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 {
/// ` := `
#[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
where
Subtype: Copy + From + Into,
diff --git a/bitcoin/src/serde_utils.rs b/bitcoin/src/serde_utils.rs
index 7540382a1..3891fa31e 100644
--- a/bitcoin/src/serde_utils.rs
+++ b/bitcoin/src/serde_utils.rs
@@ -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,
#[serde(deserialize_with = "crate::serde_utils::hex_bytes::deserialize")] Vec,
@@ -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],
diff --git a/bitcoin/src/taproot/merkle_branch.rs b/bitcoin/src/taproot/merkle_branch.rs
index d0aff7946..e48648ad3 100644
--- a/bitcoin/src/taproot/merkle_branch.rs
+++ b/bitcoin/src/taproot/merkle_branch.rs
@@ -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"))]
#[cfg_attr(feature = "serde", serde(try_from = "Vec"))]
pub struct TaprootMerkleBranch(Vec);
diff --git a/bitcoin/src/taproot/mod.rs b/bitcoin/src/taproot/mod.rs
index 571de54ae..e2aeeb4cc 100644
--- a/bitcoin/src/taproot/mod.rs
+++ b/bitcoin/src/taproot/mod.rs
@@ -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,
diff --git a/clippy.toml b/clippy.toml
index 173999bc7..ddca6b4cb 100644
--- a/clippy.toml
+++ b/clippy.toml
@@ -1,2 +1,2 @@
-msrv = "1.56.1"
+msrv = "1.63.0"
too-many-arguments-threshold = 13
diff --git a/fuzz/generate-files.sh b/fuzz/generate-files.sh
index 74aeacc2b..e1c8a9d46 100755
--- a/fuzz/generate-files.sh
+++ b/fuzz/generate-files.sh
@@ -13,7 +13,7 @@ cat > "$REPO_DIR/fuzz/Cargo.toml" < schemars::JsonSchema for Hash {
}
}
-// This impl, and the trait bound `(T,): Tag` below, are hacks to allow defining
-// constfns on Hash 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 Tag for (T,)
-where
- T: Tag,
-{
- fn engine() -> sha256::HashEngine { T::engine() }
-}
-
impl Hash
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 { from_engine(e) }
@@ -146,7 +133,7 @@ crate::internal_macros::hash_trait_impls!(256, false, T: Tag);
fn from_engine(e: sha256::HashEngine) -> Hash
where
- (T,): Tag,
+ T: Tag,
{
Hash::from_byte_array(sha256::Hash::from_engine(e).to_byte_array())
}
diff --git a/internals/Cargo.toml b/internals/Cargo.toml
index 79117f4db..536e25b72 100644
--- a/internals/Cargo.toml
+++ b/internals/Cargo.toml
@@ -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]
diff --git a/io/Cargo.toml b/io/Cargo.toml
index 3369d1f92..292e5022c 100644
--- a/io/Cargo.toml
+++ b/io/Cargo.toml
@@ -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]
diff --git a/primitives/Cargo.toml b/primitives/Cargo.toml
index b62901478..a05bed3c9 100644
--- a/primitives/Cargo.toml
+++ b/primitives/Cargo.toml
@@ -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]
diff --git a/primitives/README.md b/primitives/README.md
index cd18cd943..0b93090b1 100644
--- a/primitives/README.md
+++ b/primitives/README.md
@@ -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
diff --git a/primitives/src/lib.rs b/primitives/src/lib.rs
index 342352994..598783835 100644
--- a/primitives/src/lib.rs
+++ b/primitives/src/lib.rs
@@ -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;
diff --git a/primitives/src/locktime/relative.rs b/primitives/src/locktime/relative.rs
index 82b5da41d..a890b940b 100644
--- a/primitives/src/locktime/relative.rs
+++ b/primitives/src/locktime/relative.rs
@@ -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),
diff --git a/primitives/src/sequence.rs b/primitives/src/sequence.rs
index 63f2a62bb..4d0ddca5c 100644
--- a/primitives/src/sequence.rs
+++ b/primitives/src/sequence.rs
@@ -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 {
diff --git a/units/Cargo.toml b/units/Cargo.toml
index 02d2931ae..a289a0756 100644
--- a/units/Cargo.toml
+++ b/units/Cargo.toml
@@ -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]
diff --git a/units/README.md b/units/README.md
index 177b82ff1..7530c96ed 100644
--- a/units/README.md
+++ b/units/README.md
@@ -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