From 90e3b9bb4e243e54d450ec3a7fe288eb46dbdf70 Mon Sep 17 00:00:00 2001 From: "Demi M. Obenour" Date: Thu, 18 Jun 2020 13:44:20 -0400 Subject: [PATCH] Add Debug impls --- src/frame/session.rs | 8 ++++---- src/frame/staking.rs | 8 ++++---- src/lib.rs | 6 +++++- src/rpc.rs | 2 +- src/runtimes.rs | 5 +++++ src/signer.rs | 1 + 6 files changed, 20 insertions(+), 10 deletions(-) diff --git a/src/frame/session.rs b/src/frame/session.rs index d0ffa0eb32..f82e52f7c4 100644 --- a/src/frame/session.rs +++ b/src/frame/session.rs @@ -46,7 +46,7 @@ pub trait Session: System { } /// The current set of validators. -#[derive(Encode, Store)] +#[derive(Encode, Store, Debug)] pub struct ValidatorsStore { #[store(returns = Vec<::ValidatorId>)] /// Marker for the runtime @@ -54,7 +54,7 @@ pub struct ValidatorsStore { } /// Current index of the session. -#[derive(Encode, Store)] +#[derive(Encode, Store, Debug)] pub struct CurrentIndexStore { #[store(returns = ::SessionIndex)] /// Marker for the runtime @@ -63,7 +63,7 @@ pub struct CurrentIndexStore { /// True if the underlying economic identities or weighting behind the validators /// has changed in the queued validator set. -#[derive(Encode, Store)] +#[derive(Encode, Store, Debug)] pub struct QueuedChangedStore { #[store(returns = bool)] /// Marker for the runtime @@ -71,7 +71,7 @@ pub struct QueuedChangedStore { } /// The current set of validators. -#[derive(Encode, Call)] +#[derive(Encode, Call, Debug)] pub struct SetKeysCall { /// The keys pub keys: T::Keys, diff --git a/src/frame/staking.rs b/src/frame/staking.rs index 4e31c568d9..daaca52b47 100644 --- a/src/frame/staking.rs +++ b/src/frame/staking.rs @@ -151,7 +151,7 @@ pub trait Staking: Balances { } /// Just a Balance/BlockNumber tuple to encode when a chunk of funds will be unlocked. -#[derive(PartialEq, Eq, Clone, Encode, Decode, Ord, PartialOrd, Hash)] +#[derive(PartialEq, Eq, Clone, Encode, Decode, Ord, PartialOrd, Hash, Debug)] pub struct UnlockChunk { /// Amount of funds to be unlocked. #[codec(compact)] @@ -162,7 +162,7 @@ pub struct UnlockChunk { } /// The ledger of a (bonded) stash. -#[derive(PartialEq, Eq, Clone, Encode, Decode, Ord, PartialOrd, Hash)] +#[derive(PartialEq, Eq, Clone, Encode, Decode, Ord, PartialOrd, Hash, Debug)] pub struct StakingLedger { /// The stash account whose balance is actually locked and at stake. pub stash: T::AccountId, @@ -334,14 +334,14 @@ pub struct ValidateCall { /// - Reads: Era Election Status, Ledger, Current Era /// - Writes: Validators, Nominators /// # -#[derive(Call, Encode)] +#[derive(Call, Encode, Debug)] pub struct NominateCall { /// The targets that are being nominated pub targets: Vec, } /// Claim a payout. -#[derive(PartialEq, Eq, Clone, Call, Encode, Decode)] +#[derive(PartialEq, Eq, Clone, Call, Encode, Decode, Debug)] struct PayoutStakersCall<'a, T: Staking> { pub validator_stash: &'a T::AccountId, pub era: T::EraIndex, diff --git a/src/lib.rs b/src/lib.rs index eff1e3ff12..5dc9a5fbea 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -27,6 +27,7 @@ path_statements, patterns_in_fns_without_body, private_in_public, + missing_debug_implementations, unconditional_recursion, unused_allocation, unused_comparisons, @@ -34,7 +35,8 @@ while_true, trivial_casts, trivial_numeric_casts, - unused_extern_crates + unused_extern_crates, + clippy::all )] #![allow(clippy::type_complexity)] @@ -114,6 +116,7 @@ use crate::{ /// ClientBuilder for constructing a Client. #[derive(Default)] +#[allow(missing_debug_implementations)] pub struct ClientBuilder> { _marker: std::marker::PhantomData<(T, S, E)>, url: Option, @@ -172,6 +175,7 @@ impl ClientBuilder { } /// Client to interface with a substrate node. +#[allow(missing_debug_implementations)] pub struct Client> { rpc: Rpc, genesis_hash: T::Hash, diff --git a/src/rpc.rs b/src/rpc.rs index faba5db5a2..047ddf05fc 100644 --- a/src/rpc.rs +++ b/src/rpc.rs @@ -85,7 +85,7 @@ pub type ChainBlock = SignedBlock::Header, ::Extrinsic>>; /// Wrapper for NumberOrHex to allow custom From impls -#[derive(Serialize)] +#[derive(Serialize, Debug)] #[serde(bound = "::BlockNumber: Serialize")] pub struct BlockNumber(NumberOrHex<::BlockNumber>); diff --git a/src/runtimes.rs b/src/runtimes.rs index 4bfec53911..7143fda0c2 100644 --- a/src/runtimes.rs +++ b/src/runtimes.rs @@ -30,18 +30,21 @@ use sp_runtime::{ use sp_std::prelude::*; /// BABE marker struct +#[derive(Copy, Clone, Debug, Default, Eq, PartialEq, Ord, PartialOrd, Hash)] pub struct Babe; impl sp_runtime::BoundToRuntimeAppPublic for Babe { type Public = sp_consensus_babe::AuthorityId; } /// ImOnline marker struct +#[derive(Copy, Clone, Debug, Default, Eq, PartialEq, Ord, PartialOrd, Hash)] pub struct ImOnline; impl sp_runtime::BoundToRuntimeAppPublic for ImOnline { type Public = ImOnlineId; } /// GRANDPA marker struct +#[derive(Copy, Clone, Debug, Default, Eq, PartialEq, Ord, PartialOrd, Hash)] pub struct Grandpa; impl sp_runtime::BoundToRuntimeAppPublic for Grandpa { type Public = sp_finality_grandpa::AuthorityId; @@ -60,6 +63,7 @@ mod validator_app { /// Parachain marker struct #[cfg(feature = "kusama")] +#[derive(Copy, Clone, Debug, Default, Eq, PartialEq, Ord, PartialOrd, Hash)] pub struct Parachains; #[cfg(feature = "kusama")] @@ -68,6 +72,7 @@ impl sp_runtime::BoundToRuntimeAppPublic for Parachains { } /// Authority discovery marker struct +#[derive(Copy, Clone, Debug, Default, Eq, PartialEq, Ord, PartialOrd, Hash)] pub struct AuthorityDiscovery; impl sp_runtime::BoundToRuntimeAppPublic for AuthorityDiscovery { type Public = AuthorityDiscoveryId; diff --git a/src/signer.rs b/src/signer.rs index e42b02656e..fecd5b3423 100644 --- a/src/signer.rs +++ b/src/signer.rs @@ -69,6 +69,7 @@ pub trait Signer> { } /// Extrinsic signer using a private key. +#[derive(Debug)] pub struct PairSigner, P: Pair> { _marker: PhantomData<(S, E)>, account_id: T::AccountId,