Add Debug impls

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