From 895407a7814895c2281dc0ac68ca5a7cf2baa295 Mon Sep 17 00:00:00 2001 From: iStrike7 Date: Wed, 14 Dec 2022 17:38:16 +0530 Subject: [PATCH] Default transactional - re-enabled pallet macro expansion storage layer call wrapping --- .../procedural/src/pallet/expand/call.rs | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/frame/support/procedural/src/pallet/expand/call.rs b/frame/support/procedural/src/pallet/expand/call.rs index f8d3f99c45e24..a9468451ad1d4 100644 --- a/frame/support/procedural/src/pallet/expand/call.rs +++ b/frame/support/procedural/src/pallet/expand/call.rs @@ -141,22 +141,22 @@ pub fn expand_call(def: &mut Def) -> proc_macro2::TokenStream { let capture_docs = if cfg!(feature = "no-metadata-docs") { "never" } else { "always" }; // Wrap all calls inside of storage layers - // if let Some(syn::Item::Impl(item_impl)) = def - // .call - // .as_ref() - // .map(|c| &mut def.item.content.as_mut().expect("Checked by def parser").1[c.index]) - // { - // item_impl.items.iter_mut().for_each(|i| { - // if let syn::ImplItem::Method(method) = i { - // let block = &method.block; - // method.block = syn::parse_quote! {{ - // // We execute all dispatchable in a new storage layer, allowing them - // // to return an error at any point, and undoing any storage changes. - // #frame_support::storage::with_storage_layer(|| #block) - // }}; - // } - // }); - // } + if let Some(syn::Item::Impl(item_impl)) = def + .call + .as_ref() + .map(|c| &mut def.item.content.as_mut().expect("Checked by def parser").1[c.index]) + { + item_impl.items.iter_mut().for_each(|i| { + if let syn::ImplItem::Method(method) = i { + let block = &method.block; + method.block = syn::parse_quote! {{ + // We execute all dispatchable in a new storage layer, allowing them + // to return an error at any point, and undoing any storage changes. + #frame_support::storage::with_storage_layer(|| #block) + }}; + } + }); + } quote::quote_spanned!(span => #[doc(hidden)]