support: BuildStorage methods to take self reference (#3884)

* support: BuildStorage methods to take self reference.

There is no reason to consume the GenesisConfig when using it to
initialize a new storage backend. Instead, build_storage and
assimilate_storage now operator on self references.

* Bump node runtime impl_version.
This commit is contained in:
Jim Posen
2019-10-25 11:44:57 +02:00
committed by GitHub
parent 44696f46c3
commit e05e624a3a
5 changed files with 21 additions and 23 deletions
@@ -51,7 +51,7 @@ impl BuilderDef {
is_generic |= ext::expr_contains_ident(&builder, &def.module_runtime_generic);
is_generic |= line.is_generic;
data = Some(quote_spanned!(builder.span() => &(#builder)(&self)));
data = Some(quote_spanned!(builder.span() => &(#builder)(self)));
} else if let Some(config) = &line.config {
is_generic |= line.is_generic;
@@ -98,7 +98,7 @@ impl BuilderDef {
blocks.push(quote_spanned! { builder.span() =>
let extra_genesis_builder: fn(&Self) = #builder;
extra_genesis_builder(&self);
extra_genesis_builder(self);
});
}
@@ -138,7 +138,7 @@ fn impl_build_storage(
quote!{
#[cfg(feature = "std")]
impl#genesis_impl GenesisConfig#genesis_struct #genesis_where_clause {
pub fn build_storage #fn_generic (self) -> std::result::Result<
pub fn build_storage #fn_generic (&self) -> std::result::Result<
(
#scrate::sr_primitives::StorageOverlay,
#scrate::sr_primitives::ChildrenStorageOverlay,
@@ -152,7 +152,7 @@ fn impl_build_storage(
/// Assimilate the storage for this module into pre-existing overlays.
pub fn assimilate_storage #fn_generic (
self,
&self,
tuple_storage: &mut (
#scrate::sr_primitives::StorageOverlay,
#scrate::sr_primitives::ChildrenStorageOverlay,
@@ -170,7 +170,7 @@ fn impl_build_storage(
#where_clause
{
fn build_module_genesis_storage(
self,
&self,
storage: &mut (
#scrate::sr_primitives::StorageOverlay,
#scrate::sr_primitives::ChildrenStorageOverlay,