diff --git a/zebra-chain/src/block/hash.rs b/zebra-chain/src/block/hash.rs index f1c37371b21..09a2ddc9a20 100644 --- a/zebra-chain/src/block/hash.rs +++ b/zebra-chain/src/block/hash.rs @@ -20,8 +20,8 @@ use proptest_derive::Arbitrary; /// /// Note: Zebra displays transaction and block hashes in big-endian byte-order, /// following the u256 convention set by Bitcoin and zcashd. -#[derive(Copy, Clone, Eq, PartialEq, Hash, Serialize, Deserialize, Default)] -#[cfg_attr(any(test, feature = "proptest-impl"), derive(Arbitrary))] +#[derive(Copy, Clone, Eq, PartialEq, Hash, Serialize, Deserialize)] +#[cfg_attr(any(test, feature = "proptest-impl"), derive(Arbitrary, Default))] pub struct Hash(pub [u8; 32]); impl Hash { diff --git a/zebra-chain/src/block/header.rs b/zebra-chain/src/block/header.rs index b47adac0b44..c59d3972ff5 100644 --- a/zebra-chain/src/block/header.rs +++ b/zebra-chain/src/block/header.rs @@ -22,7 +22,7 @@ use proptest_derive::Arbitrary; /// backwards reference (previous header hash) present in the block /// header. Each block points backwards to its parent, all the way /// back to the genesis block (the first block in the blockchain). -#[derive(Clone, Copy, Debug, Eq, PartialEq, Serialize, Deserialize, Default)] +#[derive(Clone, Copy, Debug, Eq, PartialEq, Serialize, Deserialize)] pub struct Header { /// The block's version field. This is supposed to be `4`: /// diff --git a/zebra-chain/src/block/merkle.rs b/zebra-chain/src/block/merkle.rs index 3f0c9ebf973..639324f9d82 100644 --- a/zebra-chain/src/block/merkle.rs +++ b/zebra-chain/src/block/merkle.rs @@ -69,8 +69,8 @@ use proptest_derive::Arbitrary; /// aggressive anti-DoS mechanism. /// /// [ZIP-244]: https://zips.z.cash/zip-0244 -#[derive(Clone, Copy, Eq, PartialEq, Serialize, Deserialize, Default)] -#[cfg_attr(any(test, feature = "proptest-impl"), derive(Arbitrary))] +#[derive(Clone, Copy, Eq, PartialEq, Serialize, Deserialize)] +#[cfg_attr(any(test, feature = "proptest-impl"), derive(Arbitrary, Default))] pub struct Root(pub [u8; 32]); impl fmt::Debug for Root { diff --git a/zebra-chain/src/sapling/commitment.rs b/zebra-chain/src/sapling/commitment.rs index bda033eab3d..1ef23081550 100644 --- a/zebra-chain/src/sapling/commitment.rs +++ b/zebra-chain/src/sapling/commitment.rs @@ -157,7 +157,8 @@ impl NoteCommitment { /// [`NotSmallOrderValueCommitment`]. /// /// -#[derive(Clone, Copy, Deserialize, PartialEq, Eq, Serialize, Default)] +#[derive(Clone, Copy, Deserialize, PartialEq, Eq, Serialize)] +#[cfg_attr(any(test, feature = "proptest-impl"), derive(Default))] pub struct ValueCommitment(#[serde(with = "serde_helpers::AffinePoint")] jubjub::AffinePoint); impl<'a> std::ops::Add<&'a ValueCommitment> for ValueCommitment { @@ -301,7 +302,8 @@ lazy_static! { /// /// /// -#[derive(Debug, Clone, Copy, Deserialize, PartialEq, Eq, Serialize, Default)] +#[derive(Debug, Clone, Copy, Deserialize, PartialEq, Eq, Serialize)] +#[cfg_attr(any(test, feature = "proptest-impl"), derive(Default))] pub struct NotSmallOrderValueCommitment(ValueCommitment); impl TryFrom for NotSmallOrderValueCommitment { diff --git a/zebra-chain/src/work/difficulty.rs b/zebra-chain/src/work/difficulty.rs index 604ea7fa60f..4724188060c 100644 --- a/zebra-chain/src/work/difficulty.rs +++ b/zebra-chain/src/work/difficulty.rs @@ -62,7 +62,8 @@ mod tests; /// > (see equations in the Zcash Specification [section 7.7.4]) /// /// [section 7.7.4]: https://zips.z.cash/protocol/protocol.pdf#nbits -#[derive(Clone, Copy, Eq, PartialEq, Serialize, Deserialize, Default)] +#[derive(Clone, Copy, Eq, PartialEq, Serialize, Deserialize)] +#[cfg_attr(any(test, feature = "proptest-impl"), derive(Default))] pub struct CompactDifficulty(pub(crate) u32); /// An invalid CompactDifficulty value, for testing. diff --git a/zebra-chain/src/work/equihash.rs b/zebra-chain/src/work/equihash.rs index 684961e0eb1..f65438a5314 100644 --- a/zebra-chain/src/work/equihash.rs +++ b/zebra-chain/src/work/equihash.rs @@ -93,6 +93,7 @@ impl Clone for Solution { impl Eq for Solution {} +#[cfg(any(test, feature = "proptest-impl"))] impl Default for Solution { fn default() -> Self { Self([0; SOLUTION_SIZE])