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.
#[derive(Encode, Store)]
#[derive(Encode, Store, Debug)]
pub struct ValidatorsStore<T: Session> {
#[store(returns = Vec<<T as Session>::ValidatorId>)]
/// Marker for the runtime
@@ -54,7 +54,7 @@ pub struct ValidatorsStore<T: Session> {
}
/// Current index of the session.
#[derive(Encode, Store)]
#[derive(Encode, Store, Debug)]
pub struct CurrentIndexStore<T: Session> {
#[store(returns = <T as Session>::SessionIndex)]
/// Marker for the runtime
@@ -63,7 +63,7 @@ pub struct CurrentIndexStore<T: Session> {
/// 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<T: Session> {
#[store(returns = bool)]
/// Marker for the runtime
@@ -71,7 +71,7 @@ pub struct QueuedChangedStore<T: Session> {
}
/// The current set of validators.
#[derive(Encode, Call)]
#[derive(Encode, Call, Debug)]
pub struct SetKeysCall<T: Session> {
/// The 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.
#[derive(PartialEq, Eq, Clone, Encode, Decode, Ord, PartialOrd, Hash)]
#[derive(PartialEq, Eq, Clone, Encode, Decode, Ord, PartialOrd, Hash, Debug)]
pub struct UnlockChunk<T: Staking> {
/// Amount of funds to be unlocked.
#[codec(compact)]
@@ -162,7 +162,7 @@ pub struct UnlockChunk<T: Staking> {
}
/// 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> {
/// The stash account whose balance is actually locked and at stake.
pub stash: T::AccountId,
@@ -334,14 +334,14 @@ pub struct ValidateCall<T: Staking> {
/// - Reads: Era Election Status, Ledger, Current Era
/// - Writes: Validators, Nominators
/// # </weight>
#[derive(Call, Encode)]
#[derive(Call, Encode, Debug)]
pub struct NominateCall<T: Staking> {
/// The targets that are being nominated
pub targets: Vec<T::Address>,
}
/// 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,
+5 -1
View File
@@ -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<T: System, S = MultiSignature, E = DefaultExtra<T>> {
_marker: std::marker::PhantomData<(T, S, E)>,
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.
#[allow(missing_debug_implementations)]
pub struct Client<T: System, S = MultiSignature, E = DefaultExtra<T>> {
rpc: Rpc<T>,
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>>;
/// Wrapper for NumberOrHex to allow custom From impls
#[derive(Serialize)]
#[derive(Serialize, Debug)]
#[serde(bound = "<T as System>::BlockNumber: Serialize")]
pub struct BlockNumber<T: System>(NumberOrHex<<T as System>::BlockNumber>);
+5
View File
@@ -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;
+1
View File
@@ -69,6 +69,7 @@ pub trait Signer<T: System, S: Encode, E: SignedExtra<T>> {
}
/// Extrinsic signer using a private key.
#[derive(Debug)]
pub struct PairSigner<T: System, S: Encode, E: SignedExtra<T>, P: Pair> {
_marker: PhantomData<(S, E)>,
account_id: T::AccountId,