Runtime logging. (#3821)

* Implement Printable for tuples.

* Add debugging function.

* Add debug 1.

* Implement  for everything.

* RuntimeDebug derive.

* Introduce RuntimeDebug.

* Add some dummy logging.

* Replace RuntimeDebug with Debug.

* Revert "Replace RuntimeDebug with Debug."

This reverts commit bc47070a8cb30241b2b590b2fa29fd195088162f.

* Working on Debug for all.

* Fix bounds.

* Add debug utils.

* Implement runtime logging.

* Add some docs and clean up.

* Clean up derives.

* Fix custom derive impl.

* Bump runtime.

* Fix long lines.

* Fix doc test.

* Use CARGO_CFG_STD.

* Revert "Use CARGO_CFG_STD."

This reverts commit ea429566de18ed0fa052571b359eb9826a64a9f4.

* Use parse_macro_input

* Update lockfile.

* Apply review suggestions.

* Remove stray re-export.

* Add no-std impl.

* Update lockfile.
This commit is contained in:
Tomasz Drwięga
2019-10-22 14:13:44 +02:00
committed by Bastian Köcher
parent 934d7aac1c
commit 20a3989785
86 changed files with 1266 additions and 469 deletions
+6 -9
View File
@@ -34,6 +34,7 @@
#![cfg_attr(not(feature = "std"), no_std)]
use rstd::{prelude::*, collections::btree_map::BTreeMap};
use sr_primitives::RuntimeDebug;
use sr_primitives::{helpers_128bit::multiply_by_rational, Perbill, Rational128};
use sr_primitives::traits::{Zero, Convert, Member, SimpleArithmetic, Saturating, Bounded};
@@ -54,8 +55,7 @@ pub type ExtendedBalance = u128;
const DEN: u128 = u128::max_value();
/// A candidate entity for phragmen election.
#[derive(Clone, Default)]
#[cfg_attr(feature = "std", derive(Debug))]
#[derive(Clone, Default, RuntimeDebug)]
pub struct Candidate<AccountId> {
/// Identifier.
pub who: AccountId,
@@ -68,8 +68,7 @@ pub struct Candidate<AccountId> {
}
/// A voter entity.
#[derive(Clone, Default)]
#[cfg_attr(feature = "std", derive(Debug))]
#[derive(Clone, Default, RuntimeDebug)]
pub struct Voter<AccountId> {
/// Identifier.
who: AccountId,
@@ -82,8 +81,7 @@ pub struct Voter<AccountId> {
}
/// A candidate being backed by a voter.
#[derive(Clone, Default)]
#[cfg_attr(feature = "std", derive(Debug))]
#[derive(Clone, Default, RuntimeDebug)]
pub struct Edge<AccountId> {
/// Identifier.
who: AccountId,
@@ -100,7 +98,7 @@ pub type PhragmenAssignment<AccountId> = (AccountId, Perbill);
pub type PhragmenStakedAssignment<AccountId> = (AccountId, ExtendedBalance);
/// Final result of the phragmen election.
#[cfg_attr(feature = "std", derive(Debug))]
#[derive(RuntimeDebug)]
pub struct PhragmenResult<AccountId> {
/// Just winners zipped with their approval stake. Note that the approval stake is merely the
/// sub of their received stake and could be used for very basic sorting and approval voting.
@@ -117,8 +115,7 @@ pub struct PhragmenResult<AccountId> {
///
/// This, at the current version, resembles the `Exposure` defined in the staking SRML module, yet
/// they do not necessarily have to be the same.
#[derive(Default)]
#[cfg_attr(feature = "std", derive(Debug))]
#[derive(Default, RuntimeDebug)]
pub struct Support<AccountId> {
/// The amount of support as the effect of self-vote.
pub own: ExtendedBalance,