From 6039cc4557ae13647d5fd8d28981d1b96f568dff Mon Sep 17 00:00:00 2001 From: Riccardo Casatta Date: Mon, 3 Oct 2022 11:13:14 +0200 Subject: [PATCH] Rename serde-feature to serde --- CHANGELOG.md | 1 + Cargo.toml | 6 +++--- contrib/test.sh | 2 +- fuzz/Cargo.toml | 2 +- src/blind.rs | 2 +- src/lib.rs | 2 +- src/pset/map/global.rs | 4 ++-- src/pset/map/input.rs | 2 +- src/pset/map/output.rs | 4 ++-- src/pset/mod.rs | 2 +- src/pset/raw.rs | 6 +++--- src/schnorr.rs | 2 +- src/serde_utils.rs | 2 ++ src/taproot.rs | 11 ++++++----- 14 files changed, 26 insertions(+), 22 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d2c539dc..1c585c6b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ # unreleased +- the feature "serde-feature" is now renamed to just "serde" - update MSRV to 1.41.1 - breaking change in serde in how the Nonce is serialized - `Block`, `BlockHeader`, `PeginData`, `PegoutData` loose the Default impl diff --git a/Cargo.toml b/Cargo.toml index 79827555..53255065 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,10 +14,10 @@ default = [ "json-contract" ] integration = [ "elementsd" ] json-contract = [ "serde_json" ] -"serde-feature" = [ +"serde" = [ "bitcoin/serde", "secp256k1-zkp/use-serde", - "serde" + "actual-serde" ] "fuzztarget" = [] @@ -34,7 +34,7 @@ bitcoin_hashes = "0.11.0" # Used for ContractHash::from_json_contract. serde_json = { version = "1.0", optional = true } -serde = { version = "1.0", features=["derive"], optional = true } +actual-serde = { package="serde", version = "1.0", features=["derive"], optional = true } # This should be an optional dev-dependency (only needed for integration tests), # but dev-dependency cannot be optional, and without optionality older toolchain try to compile it and fails diff --git a/contrib/test.sh b/contrib/test.sh index 1e187873..d13bc25c 100755 --- a/contrib/test.sh +++ b/contrib/test.sh @@ -1,6 +1,6 @@ #!/bin/sh -ex -FEATURES="serde-feature" +FEATURES="serde" # Use toolchain if explicitly specified if [ -n "$TOOLCHAIN" ] diff --git a/fuzz/Cargo.toml b/fuzz/Cargo.toml index e3b93f11..028baa32 100644 --- a/fuzz/Cargo.toml +++ b/fuzz/Cargo.toml @@ -15,7 +15,7 @@ honggfuzz_fuzz = ["honggfuzz"] [dependencies] honggfuzz = { version = "0.5", optional = true, default-features = false } afl = { version = "0.11", optional = true } -elements = { path = "..", features = ["fuzztarget", "serde-feature"] } +elements = { path = "..", features = ["fuzztarget", "serde"] } # Prevent this from interfering with workspaces [workspace] diff --git a/src/blind.rs b/src/blind.rs index e2d7da5b..cff07475 100644 --- a/src/blind.rs +++ b/src/blind.rs @@ -210,7 +210,7 @@ impl RangeProofMessage { } /// Information about Transaction Input Asset -#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] +#[cfg_attr(feature = "serde", derive(Serialize, Deserialize), serde(crate = "actual_serde"))] #[derive(Debug, PartialEq, Eq, Clone, Hash)] pub struct TxOutSecrets { /// Asset diff --git a/src/lib.rs b/src/lib.rs index 876fd9f9..9ccbff53 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -30,7 +30,7 @@ pub extern crate bitcoin; extern crate bitcoin_hashes as just_imported_for_the_macros; extern crate slip21; pub extern crate secp256k1_zkp; -#[cfg(feature = "serde")] #[macro_use] extern crate serde; +#[cfg(feature = "serde")] #[macro_use] extern crate actual_serde as serde; #[cfg(all(test, feature = "serde"))] extern crate serde_test; #[cfg(test)] extern crate rand; diff --git a/src/pset/map/global.rs b/src/pset/map/global.rs index 17bb5c7d..76d06a44 100644 --- a/src/pset/map/global.rs +++ b/src/pset/map/global.rs @@ -56,7 +56,7 @@ const PSBT_ELEMENTS_GLOBAL_TX_MODIFIABLE: u8 = 0x01; /// Global transaction data #[derive(Debug, Clone, PartialEq)] -#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] +#[cfg_attr(feature = "serde", derive(Serialize, Deserialize), serde(crate = "actual_serde"))] pub struct TxData { /// Transaction version. Must be 2. pub version: u32, @@ -91,7 +91,7 @@ impl Default for TxData{ /// A key-value map for global data. #[derive(Clone, Debug, PartialEq)] -#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] +#[cfg_attr(feature = "serde", derive(Serialize, Deserialize), serde(crate = "actual_serde"))] pub struct Global { /// Global transaction data #[cfg_attr(feature = "serde", serde(flatten))] diff --git a/src/pset/map/input.rs b/src/pset/map/input.rs index 6e254e1b..c7801ff0 100644 --- a/src/pset/map/input.rs +++ b/src/pset/map/input.rs @@ -148,7 +148,7 @@ const PSBT_ELEMENTS_IN_ISSUANCE_BLIND_INFLATION_KEYS_PROOF: u8 = 0x10; /// A key-value map for an input of the corresponding index in the unsigned /// transaction. #[derive(Clone, Debug, PartialEq)] -#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] +#[cfg_attr(feature = "serde", derive(Serialize, Deserialize), serde(crate = "actual_serde"))] pub struct Input { /// The non-witness transaction this input spends from. Should only be /// [std::option::Option::Some] for inputs which spend non-segwit outputs or diff --git a/src/pset/map/output.rs b/src/pset/map/output.rs index 485b7d75..a243734c 100644 --- a/src/pset/map/output.rs +++ b/src/pset/map/output.rs @@ -87,7 +87,7 @@ const PSBT_ELEMENTS_OUT_BLIND_ASSET_PROOF: u8 = 0x10; /// A key-value map for an output of the corresponding index in the unsigned /// transaction. #[derive(Clone, Default, Debug, PartialEq)] -#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] +#[cfg_attr(feature = "serde", derive(Serialize, Deserialize), serde(crate = "actual_serde"))] pub struct Output { /// The redeem script for this output. pub redeem_script: Option