Skip to content

Commit

Permalink
Merge pull request #228 from bennyhodl/serde-feature
Browse files Browse the repository at this point in the history
chore: use correct feature name for serde
  • Loading branch information
Tibo-lg authored Jun 26, 2024
2 parents 8771f30 + 8017bde commit 214ff35
Show file tree
Hide file tree
Showing 17 changed files with 110 additions and 105 deletions.
2 changes: 1 addition & 1 deletion dlc-manager/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ default = ["std"]
std = ["dlc/std", "dlc-messages/std", "dlc-trie/std", "bitcoin/std", "lightning/std"]
fuzztarget = ["rand_chacha"]
parallel = ["dlc-trie/parallel"]
use-serde = ["serde", "dlc/use-serde", "dlc-messages/serde", "dlc-trie/use-serde"]
use-serde = ["serde", "dlc/use-serde", "dlc-messages/use-serde", "dlc-trie/use-serde"]

[dependencies]
async-trait = "0.1.50"
Expand Down
2 changes: 1 addition & 1 deletion dlc-manager/src/channel/offered_channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use super::party_points::PartyBasePoints;

#[derive(Clone, Debug)]
#[cfg_attr(
feature = "serde",
feature = "use-serde",
derive(serde::Serialize, serde::Deserialize),
serde(rename_all = "camelCase")
)]
Expand Down
2 changes: 1 addition & 1 deletion dlc-manager/src/channel/party_points.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use secp256k1_zkp::{All, PublicKey, Secp256k1, Signing, Verification};
/// values necessary for state update throughout the lifetime of the channel.
#[derive(Clone, Debug)]
#[cfg_attr(
feature = "serde",
feature = "use-serde",
derive(serde::Serialize, serde::Deserialize),
serde(rename_all = "camelCase")
)]
Expand Down
2 changes: 1 addition & 1 deletion dlc-manager/src/contract/contract_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pub(super) type OracleIndexAndPrefixLength = Vec<(usize, usize)>;
/// Contains information about the contract conditions and oracles used.
#[derive(Clone, Debug)]
#[cfg_attr(
feature = "serde",
feature = "use-serde",
derive(serde::Serialize, serde::Deserialize),
serde(rename_all = "camelCase")
)]
Expand Down
8 changes: 4 additions & 4 deletions dlc-manager/src/contract/contract_input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ use crate::error::Error;

use super::ContractDescriptor;
use secp256k1_zkp::XOnlyPublicKey;
#[cfg(feature = "serde")]
#[cfg(feature = "use-serde")]
use serde::{Deserialize, Serialize};

/// Oracle information required for the initial creation of a contract.
#[derive(Debug)]
#[cfg_attr(
feature = "serde",
feature = "use-serde",
derive(Serialize, Deserialize),
serde(rename_all = "camelCase")
)]
Expand Down Expand Up @@ -53,7 +53,7 @@ impl OracleInput {
/// Represents the contract specifications.
#[derive(Debug)]
#[cfg_attr(
feature = "serde",
feature = "use-serde",
derive(Serialize, Deserialize),
serde(rename_all = "camelCase")
)]
Expand All @@ -66,7 +66,7 @@ pub struct ContractInputInfo {

#[derive(Debug)]
#[cfg_attr(
feature = "serde",
feature = "use-serde",
derive(Serialize, Deserialize),
serde(rename_all = "camelCase")
)]
Expand Down
4 changes: 2 additions & 2 deletions dlc-manager/src/contract/enum_descriptor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ use dlc_trie::{combination_iterator::CombinationIterator, RangeInfo};
use secp256k1_zkp::{
All, EcdsaAdaptorSignature, Message, PublicKey, Secp256k1, SecretKey, Verification,
};
#[cfg(feature = "serde")]
#[cfg(feature = "use-serde")]
use serde::{Deserialize, Serialize};

/// A descriptor for a contract whose outcomes are represented as an enumeration.
#[derive(Clone, Debug)]
#[cfg_attr(
feature = "serde",
feature = "use-serde",
derive(Serialize, Deserialize),
serde(rename_all = "camelCase")
)]
Expand Down
4 changes: 2 additions & 2 deletions dlc-manager/src/contract/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use dlc_messages::{
use dlc_trie::multi_oracle_trie::MultiOracleTrie;
use dlc_trie::multi_oracle_trie_with_diff::MultiOracleTrieWithDiff;
use secp256k1_zkp::PublicKey;
#[cfg(feature = "serde")]
#[cfg(feature = "use-serde")]
use serde::{Deserialize, Serialize};
use signed_contract::SignedContract;

Expand Down Expand Up @@ -188,7 +188,7 @@ pub enum AdaptorInfo {
/// The descriptor of a contract.
#[derive(Clone, Debug)]
#[cfg_attr(
feature = "serde",
feature = "use-serde",
derive(Serialize, Deserialize),
serde(rename_all = "camelCase")
)]
Expand Down
6 changes: 3 additions & 3 deletions dlc-manager/src/contract/numerical_descriptor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ use dlc_trie::multi_oracle_trie::MultiOracleTrie;
use dlc_trie::multi_oracle_trie_with_diff::MultiOracleTrieWithDiff;
use dlc_trie::{DlcTrie, OracleNumericInfo};
use secp256k1_zkp::{All, EcdsaAdaptorSignature, PublicKey, Secp256k1, SecretKey};
#[cfg(feature = "serde")]
#[cfg(feature = "use-serde")]
use serde::{Deserialize, Serialize};

/// Information about the allowed deviation in outcome value between the oracles.
#[derive(Clone, Debug)]
#[cfg_attr(
feature = "serde",
feature = "use-serde",
derive(Serialize, Deserialize),
serde(rename_all = "camelCase")
)]
Expand All @@ -33,7 +33,7 @@ pub struct DifferenceParams {

#[derive(Clone, Debug)]
#[cfg_attr(
feature = "serde",
feature = "use-serde",
derive(Serialize, Deserialize),
serde(rename_all = "camelCase")
)]
Expand Down
2 changes: 1 addition & 1 deletion dlc-manager/src/contract/offered_contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use secp256k1_zkp::PublicKey;
/// Contains information about a contract that was offered.
#[derive(Clone, Debug)]
#[cfg_attr(
feature = "serde",
feature = "use-serde",
derive(serde::Serialize, serde::Deserialize),
serde(rename_all = "camelCase")
)]
Expand Down
16 changes: 8 additions & 8 deletions dlc-manager/src/payout_curve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ use std::ops::Deref;

use crate::error::Error;
use dlc::{Payout, RangePayout};
#[cfg(feature = "serde")]
#[cfg(feature = "use-serde")]
use serde::{Deserialize, Serialize};

/// Contains information to compute the set of payouts based on the outcomes.
#[derive(Clone, Debug, PartialEq)]
#[cfg_attr(
feature = "serde",
feature = "use-serde",
derive(Serialize, Deserialize),
serde(rename_all = "camelCase")
)]
Expand Down Expand Up @@ -112,7 +112,7 @@ impl PayoutFunction {
/// A piece of a payout function.
#[derive(Clone, Debug, PartialEq)]
#[cfg_attr(
feature = "serde",
feature = "use-serde",
derive(Serialize, Deserialize),
serde(rename_all = "camelCase")
)]
Expand Down Expand Up @@ -274,7 +274,7 @@ where
/// A function piece represented by a polynomial.
#[derive(Clone, Debug, Eq, PartialEq)]
#[cfg_attr(
feature = "serde",
feature = "use-serde",
derive(Serialize, Deserialize),
serde(rename_all = "camelCase")
)]
Expand Down Expand Up @@ -373,7 +373,7 @@ impl Evaluable for PolynomialPayoutCurvePiece {
/// A payout point representing a payout for a given outcome.
#[derive(Clone, Debug, Eq, PartialEq)]
#[cfg_attr(
feature = "serde",
feature = "use-serde",
derive(Serialize, Deserialize),
serde(rename_all = "camelCase")
)]
Expand All @@ -395,7 +395,7 @@ impl PayoutPoint {
/// A function piece represented by a hyperbola.
#[derive(Clone, Debug, PartialEq)]
#[cfg_attr(
feature = "serde",
feature = "use-serde",
derive(Serialize, Deserialize),
serde(rename_all = "camelCase")
)]
Expand Down Expand Up @@ -487,7 +487,7 @@ impl Evaluable for HyperbolaPayoutCurvePiece {
/// of 1 indicates that no rounding is performed.
#[derive(Clone, Debug)]
#[cfg_attr(
feature = "serde",
feature = "use-serde",
derive(Serialize, Deserialize),
serde(rename_all = "camelCase")
)]
Expand All @@ -501,7 +501,7 @@ pub struct RoundingInterval {
/// A set of rounding intervals.
#[derive(Clone, Debug)]
#[cfg_attr(
feature = "serde",
feature = "use-serde",
derive(Serialize, Deserialize),
serde(rename_all = "camelCase")
)]
Expand Down
2 changes: 1 addition & 1 deletion dlc-manager/tests/manager_execution_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ use std::thread;
struct TestVectorPart<T> {
message: T,
#[cfg_attr(
feature = "serde",
feature = "use-serde",
serde(
serialize_with = "dlc_messages::serde_utils::serialize_hex",
deserialize_with = "dlc_messages::serde_utils::deserialize_hex_string"
Expand Down
Loading

0 comments on commit 214ff35

Please sign in to comment.