Skip to content
This repository has been archived by the owner on Nov 1, 2023. It is now read-only.

Commit

Permalink
Box events
Browse files Browse the repository at this point in the history
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
  • Loading branch information
ggwpez committed Apr 12, 2022
1 parent 2cdae82 commit 9fb1887
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions frame/support/procedural/src/construct_runtime/expand/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,16 +100,16 @@ fn expand_event_variant(

match instance {
Some(inst) if part_is_generic => {
quote!(#[codec(index = #index)] #variant_name(#path::Event<#runtime, #path::#inst>),)
quote!(#[codec(index = #index)] #variant_name(Box<#path::Event<#runtime, #path::#inst>>),)
},
Some(inst) => {
quote!(#[codec(index = #index)] #variant_name(#path::Event<#path::#inst>),)
quote!(#[codec(index = #index)] #variant_name(Box<#path::Event<#path::#inst>>),)
},
None if part_is_generic => {
quote!(#[codec(index = #index)] #variant_name(#path::Event<#runtime>),)
quote!(#[codec(index = #index)] #variant_name(Box<#path::Event<#runtime>>),)
},
None => {
quote!(#[codec(index = #index)] #variant_name(#path::Event),)
quote!(#[codec(index = #index)] #variant_name(Box<#path::Event>),)
},
}
}
Expand All @@ -124,15 +124,15 @@ fn expand_event_conversion(
quote! {
impl From<#pallet_event> for Event {
fn from(x: #pallet_event) -> Self {
Event::#variant_name(x)
Event::#variant_name(Box::new(x))
}
}
impl TryInto<#pallet_event> for Event {
type Error = ();

fn try_into(self) -> #scrate::sp_std::result::Result<#pallet_event, Self::Error> {
match self {
Self::#variant_name(evt) => Ok(evt),
Self::#variant_name(evt) => Ok(*evt),
_ => Err(()),
}
}
Expand Down

0 comments on commit 9fb1887

Please sign in to comment.