diff --git a/substrate/core/test-runtime/wasm/target/wasm32-unknown-unknown/release/substrate_test_runtime.compact.wasm b/substrate/core/test-runtime/wasm/target/wasm32-unknown-unknown/release/substrate_test_runtime.compact.wasm index e7d060ff3b..440d0288d7 100644 Binary files a/substrate/core/test-runtime/wasm/target/wasm32-unknown-unknown/release/substrate_test_runtime.compact.wasm and b/substrate/core/test-runtime/wasm/target/wasm32-unknown-unknown/release/substrate_test_runtime.compact.wasm differ diff --git a/substrate/node/runtime/wasm/target/wasm32-unknown-unknown/release/node_runtime.compact.wasm b/substrate/node/runtime/wasm/target/wasm32-unknown-unknown/release/node_runtime.compact.wasm index 2d8e45e907..fcb764ca1f 100644 Binary files a/substrate/node/runtime/wasm/target/wasm32-unknown-unknown/release/node_runtime.compact.wasm and b/substrate/node/runtime/wasm/target/wasm32-unknown-unknown/release/node_runtime.compact.wasm differ diff --git a/substrate/srml/assets/src/lib.rs b/substrate/srml/assets/src/lib.rs index c84620f4e7..dd6446c958 100644 --- a/substrate/srml/assets/src/lib.rs +++ b/substrate/srml/assets/src/lib.rs @@ -62,7 +62,7 @@ type AssetId = u32; decl_module! { // Simple declaration of the `Module` type. Lets the macro know what its working on. pub struct Module for enum Call where origin: T::Origin { - fn deposit_event() = default; + fn deposit_event() = default; /// Issue a new class of fungible assets. There are, and will only ever be, `total` /// such assets and they'll all belong to the `origin` initially. It will have an /// identifier `AssetId` instance: this will be specified in the `Issued` event. diff --git a/substrate/srml/balances/src/lib.rs b/substrate/srml/balances/src/lib.rs index deadbfd656..c6e5d7729a 100644 --- a/substrate/srml/balances/src/lib.rs +++ b/substrate/srml/balances/src/lib.rs @@ -136,7 +136,7 @@ pub trait Trait: system::Trait { decl_module! { pub struct Module for enum Call where origin: T::Origin { - fn deposit_event() = default; + fn deposit_event() = default; /// Transfer some liquid free balance to another staker. pub fn transfer( diff --git a/substrate/srml/contract/src/lib.rs b/substrate/srml/contract/src/lib.rs index e87c289ed8..cf1d2ac1db 100644 --- a/substrate/srml/contract/src/lib.rs +++ b/substrate/srml/contract/src/lib.rs @@ -147,7 +147,7 @@ where decl_module! { /// Contracts module. pub struct Module for enum Call where origin: T::Origin { - fn deposit_event() = default; + fn deposit_event() = default; // TODO: Change AccountId to staking::Address /// Make a call to a specified account, optionally transferring some balance. /// Make a call to a specified account, optionally transferring some balance. diff --git a/substrate/srml/council/src/motions.rs b/substrate/srml/council/src/motions.rs index 5316d5c681..ad0f5032cf 100644 --- a/substrate/srml/council/src/motions.rs +++ b/substrate/srml/council/src/motions.rs @@ -67,7 +67,7 @@ decl_event!( decl_module! { pub struct Module for enum Call where origin: ::Origin { - fn deposit_event() = default; + fn deposit_event() = default; fn propose(origin, threshold: Compact, proposal: Box<::Proposal>) { let who = ensure_signed(origin)?; let threshold = threshold.into(); diff --git a/substrate/srml/council/src/seats.rs b/substrate/srml/council/src/seats.rs index 7fef771d38..bff476695b 100644 --- a/substrate/srml/council/src/seats.rs +++ b/substrate/srml/council/src/seats.rs @@ -87,7 +87,7 @@ pub trait Trait: democracy::Trait { decl_module! { pub struct Module for enum Call where origin: T::Origin { - fn deposit_event() = default; + fn deposit_event() = default; /// Set candidate approvals. Approval slots stay valid as long as candidates in those slots /// are registered. diff --git a/substrate/srml/council/src/voting.rs b/substrate/srml/council/src/voting.rs index 9536fe5d35..ffc340e4f9 100644 --- a/substrate/srml/council/src/voting.rs +++ b/substrate/srml/council/src/voting.rs @@ -33,7 +33,7 @@ pub trait Trait: CouncilTrait { decl_module! { pub struct Module for enum Call where origin: T::Origin { - fn deposit_event() = default; + fn deposit_event() = default; fn propose(origin, proposal: Box) { let who = ensure_signed(origin)?; diff --git a/substrate/srml/democracy/src/lib.rs b/substrate/srml/democracy/src/lib.rs index 2bf9e21ae7..599e15b0c0 100644 --- a/substrate/srml/democracy/src/lib.rs +++ b/substrate/srml/democracy/src/lib.rs @@ -87,7 +87,7 @@ pub trait Trait: balances::Trait + Sized { decl_module! { pub struct Module for enum Call where origin: T::Origin { - fn deposit_event() = default; + fn deposit_event() = default; /// Propose a sensitive action to be taken. fn propose( @@ -376,7 +376,7 @@ impl Module { .map(|a| (a.clone(), Self::vote_of((index, a)))) // ^^^ defensive only: all items come from `voters`; for an item to be in `voters` there must be a vote registered; qed .filter(|&(_, vote)| vote.is_aye() == approved) // Just the winning coins - { + { // now plus: the base lock period multiplied by the number of periods this voter offered to // lock should they win... let locked_until = now + lock_period * T::BlockNumber::sa((vote.multiplier()) as u64); diff --git a/substrate/srml/example/src/lib.rs b/substrate/srml/example/src/lib.rs index 31baac20f7..8b14aae6ee 100644 --- a/substrate/srml/example/src/lib.rs +++ b/substrate/srml/example/src/lib.rs @@ -98,7 +98,9 @@ decl_module! { pub struct Module for enum Call where origin: T::Origin { /// Deposit one of this module's events by using the default implementation. /// It is also possible to provide a custom implementation. - fn deposit_event() = default; + /// For non-generic events, the generic parameter just needs to be dropped, so that it + /// looks like: `fn deposit_event() = default;`. + fn deposit_event() = default; /// This is your public interface. Be extremely careful. /// This is just a simple example of how to interact with the module from the external /// world. diff --git a/substrate/srml/grandpa/src/lib.rs b/substrate/srml/grandpa/src/lib.rs index de2d10b0f1..50ab852891 100644 --- a/substrate/srml/grandpa/src/lib.rs +++ b/substrate/srml/grandpa/src/lib.rs @@ -176,7 +176,7 @@ decl_storage! { decl_module! { pub struct Module for enum Call where origin: T::Origin { - fn deposit_event() = default; + fn deposit_event() = default; /// Report some misbehaviour. fn report_misbehavior(origin, _report: Vec) { diff --git a/substrate/srml/session/src/lib.rs b/substrate/srml/session/src/lib.rs index 8fc58feab2..6992a5311f 100644 --- a/substrate/srml/session/src/lib.rs +++ b/substrate/srml/session/src/lib.rs @@ -89,7 +89,7 @@ pub trait Trait: timestamp::Trait { decl_module! { pub struct Module for enum Call where origin: T::Origin { - fn deposit_event() = default; + fn deposit_event() = default; /// Sets the session key of `_validator` to `_key`. This doesn't take effect until the next /// session. diff --git a/substrate/srml/staking/src/lib.rs b/substrate/srml/staking/src/lib.rs index 208c14fc0f..c5ae4982f3 100644 --- a/substrate/srml/staking/src/lib.rs +++ b/substrate/srml/staking/src/lib.rs @@ -100,7 +100,7 @@ pub trait Trait: balances::Trait + session::Trait { decl_module! { pub struct Module for enum Call where origin: T::Origin { - fn deposit_event() = default; + fn deposit_event() = default; /// Declare the desire to stake for the transactor. /// diff --git a/substrate/srml/sudo/src/lib.rs b/substrate/srml/sudo/src/lib.rs index c814224aa5..ca4859a4d3 100644 --- a/substrate/srml/sudo/src/lib.rs +++ b/substrate/srml/sudo/src/lib.rs @@ -49,7 +49,7 @@ pub trait Trait: consensus::Trait + system::Trait { decl_module! { // Simple declaration of the `Module` type. Lets the macro know what its working on. pub struct Module for enum Call where origin: T::Origin { - fn deposit_event() = default; + fn deposit_event() = default; fn sudo(origin, proposal: Box) { // This is a public call, so we ensure that the origin is some signed account. diff --git a/substrate/srml/support/src/dispatch.rs b/substrate/srml/support/src/dispatch.rs index 4d0815c41f..f751a5293e 100644 --- a/substrate/srml/support/src/dispatch.rs +++ b/substrate/srml/support/src/dispatch.rs @@ -104,14 +104,14 @@ macro_rules! decl_module { { $( $on_finalise:tt )* } [ $($t:tt)* ] $(#[doc = $doc_attr:tt])* - $vis:vis fn deposit_event() = default; + $vis:vis fn deposit_event $(<$dpeg:ident>)* () = default; $($rest:tt)* ) => { decl_module!(@normalize $(#[$attr])* pub struct $mod_type<$trait_instance: $trait_name> for enum $call_type where origin: $origin_type, system = $system - { $vis fn deposit_event() = default; } + { $vis fn deposit_event $(<$dpeg>)* () = default; } { $( $on_finalise )* } [ $($t)* ] $($rest)* @@ -125,14 +125,16 @@ macro_rules! decl_module { { $( $on_finalise:tt )* } [ $($t:tt)* ] $(#[doc = $doc_attr:tt])* - $vis:vis fn deposit_event($($param_name:ident : $param:ty),* ) { $( $impl:tt )* } + $vis:vis fn deposit_event $(<$dpeg:ident>)* ( + $($param_name:ident : $param:ty),* + ) { $( $impl:tt )* } $($rest:tt)* ) => { decl_module!(@normalize $(#[$attr])* pub struct $mod_type<$trait_instance: $trait_name> for enum $call_type where origin: $origin_type, system = $system - { $vis fn deposit_event($( $param_name: $param ),* ) { $( $impl )* } } + { $vis fn deposit_event $(<$dpeg>)* ($( $param_name: $param ),* ) { $( $impl )* } } { $( $on_finalise )* } [ $($t)* ] $($rest)* @@ -296,10 +298,26 @@ macro_rules! decl_module { $system:ident; ) => {}; + // Non-generic event (@impl_deposit_event $module:ident<$trait_instance:ident: $trait_name:ident>; $system:ident; $vis:vis fn deposit_event() = default; + ) => { + impl<$trait_instance: $trait_name> $module<$trait_instance> { + $vis fn deposit_event(event: Event) { + <$system::Module<$trait_instance>>::deposit_event( + <$trait_instance as $trait_name>::Event::from(event).into() + ); + } + } + }; + + // Generic event + (@impl_deposit_event + $module:ident<$trait_instance:ident: $trait_name:ident>; + $system:ident; + $vis:vis fn deposit_event<$ignore:ident>() = default; ) => { impl<$trait_instance: $trait_name> $module<$trait_instance> { $vis fn deposit_event(event: Event<$trait_instance>) { diff --git a/substrate/srml/treasury/src/lib.rs b/substrate/srml/treasury/src/lib.rs index abbe0e7899..c919c5e959 100644 --- a/substrate/srml/treasury/src/lib.rs +++ b/substrate/srml/treasury/src/lib.rs @@ -68,7 +68,7 @@ type ProposalIndex = u32; decl_module! { // Simple declaration of the `Module` type. Lets the macro know what its working on. pub struct Module for enum Call where origin: T::Origin { - fn deposit_event() = default; + fn deposit_event() = default; /// Put forward a suggestion for spending. A deposit proportional to the value /// is reserved and slashed if the proposal is rejected. It is returned once the /// proposal is awarded. diff --git a/substrate/srml/upgrade-key/src/lib.rs b/substrate/srml/upgrade-key/src/lib.rs index 3957b080d3..2b4470a9f3 100644 --- a/substrate/srml/upgrade-key/src/lib.rs +++ b/substrate/srml/upgrade-key/src/lib.rs @@ -46,7 +46,7 @@ pub trait Trait: consensus::Trait + system::Trait { decl_module! { // Simple declaration of the `Module` type. Lets the macro know what its working on. pub struct Module for enum Call where origin: T::Origin { - fn deposit_event() = default; + fn deposit_event() = default; fn upgrade(origin, new: Vec) { // This is a public call, so we ensure that the origin is some signed account. let _sender = ensure_signed(origin)?;