mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-21 05:11:02 +00:00
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:
@@ -71,7 +71,7 @@ impl<G: RuntimeGenesis> GenesisSource<G> {
|
||||
}
|
||||
|
||||
impl<'a, G: RuntimeGenesis, E> BuildStorage for &'a ChainSpec<G, E> {
|
||||
fn build_storage(self) -> Result<(StorageOverlay, ChildrenStorageOverlay), String> {
|
||||
fn build_storage(&self) -> Result<(StorageOverlay, ChildrenStorageOverlay), String> {
|
||||
match self.genesis.resolve()? {
|
||||
Genesis::Runtime(gc) => gc.build_storage(),
|
||||
Genesis::Raw(map, children_map) => Ok((
|
||||
@@ -85,7 +85,7 @@ impl<'a, G: RuntimeGenesis, E> BuildStorage for &'a ChainSpec<G, E> {
|
||||
}
|
||||
|
||||
fn assimilate_storage(
|
||||
self,
|
||||
&self,
|
||||
_: &mut (StorageOverlay, ChildrenStorageOverlay)
|
||||
) -> Result<(), String> {
|
||||
Err("`assimilate_storage` not implemented for `ChainSpec`.".into())
|
||||
@@ -289,11 +289,11 @@ mod tests {
|
||||
|
||||
impl BuildStorage for Genesis {
|
||||
fn assimilate_storage(
|
||||
self,
|
||||
&self,
|
||||
storage: &mut (StorageOverlay, ChildrenStorageOverlay),
|
||||
) -> Result<(), String> {
|
||||
storage.0.extend(
|
||||
self.0.into_iter().map(|(a, b)| (a.into_bytes(), b.into_bytes()))
|
||||
self.0.iter().map(|(a, b)| (a.clone().into_bytes(), b.clone().into_bytes()))
|
||||
);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user