diff --git a/substrate/node/runtime/src/lib.rs b/substrate/node/runtime/src/lib.rs index 34a8a30524..e892ceda81 100644 --- a/substrate/node/runtime/src/lib.rs +++ b/substrate/node/runtime/src/lib.rs @@ -59,7 +59,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { impl_name: create_runtime_str!("substrate-node"), authoring_version: 10, spec_version: 90, - impl_version: 90, + impl_version: 91, apis: RUNTIME_API_VERSIONS, }; diff --git a/substrate/srml/support/src/traits.rs b/substrate/srml/support/src/traits.rs index a83af94836..599de27c2e 100644 --- a/substrate/srml/support/src/traits.rs +++ b/substrate/srml/support/src/traits.rs @@ -24,6 +24,8 @@ use crate::runtime_primitives::traits::{ MaybeSerializeDebug, SimpleArithmetic }; +use super::for_each_tuple; + /// New trait for querying a single fixed value from a type. pub trait Get { /// Return a constant value. @@ -36,20 +38,24 @@ pub trait OnFreeBalanceZero { fn on_free_balance_zero(who: &AccountId); } -impl OnFreeBalanceZero for () { - fn on_free_balance_zero(_who: &AccountId) {} -} -impl< - AccountId, - X: OnFreeBalanceZero, - Y: OnFreeBalanceZero, -> OnFreeBalanceZero for (X, Y) { - fn on_free_balance_zero(who: &AccountId) { - X::on_free_balance_zero(who); - Y::on_free_balance_zero(who); +macro_rules! impl_on_free_balance_zero { + () => ( + impl OnFreeBalanceZero for () { + fn on_free_balance_zero(_: &AccountId) {} + } + ); + + ( $($t:ident)* ) => { + impl),*> OnFreeBalanceZero for ($($t,)*) { + fn on_free_balance_zero(who: &AccountId) { + $($t::on_free_balance_zero(who);)* + } + } } } +for_each_tuple!(impl_on_free_balance_zero); + /// Trait for a hook to get called when some balance has been minted, causing dilution. pub trait OnDilution { /// Some `portion` of the total balance just "grew" by `minted`. `portion` is the pre-growth diff --git a/substrate/srml/system/src/lib.rs b/substrate/srml/system/src/lib.rs index 7c4a95a30f..5a3094d821 100644 --- a/substrate/srml/system/src/lib.rs +++ b/substrate/srml/system/src/lib.rs @@ -85,7 +85,7 @@ use primitives::traits::Zero; use substrate_primitives::storage::well_known_keys; use srml_support::{ storage, decl_module, decl_event, decl_storage, StorageDoubleMap, StorageValue, - StorageMap, Parameter, + StorageMap, Parameter, for_each_tuple, }; use safe_mix::TripletMix; use parity_codec::{Encode, Decode}; @@ -102,10 +102,24 @@ pub trait OnNewAccount { fn on_new_account(who: &AccountId); } -impl OnNewAccount for () { - fn on_new_account(_who: &AccountId) {} +macro_rules! impl_on_new_account { + () => ( + impl OnNewAccount for () { + fn on_new_account(_: &AccountId) {} + } + ); + + ( $($t:ident)* ) => { + impl),*> OnNewAccount for ($($t,)*) { + fn on_new_account(who: &AccountId) { + $($t::on_new_account(who);)* + } + } + } } +for_each_tuple!(impl_on_new_account); + /// Determiner to say whether a given account is unused. pub trait IsDeadAccount { /// Is the given account dead?