Skip to content

Commit

Permalink
Added storage version migration (#527)
Browse files Browse the repository at this point in the history
  • Loading branch information
akru authored Nov 27, 2021
1 parent 1633abb commit f956c0a
Show file tree
Hide file tree
Showing 8 changed files with 61 additions and 54 deletions.
77 changes: 32 additions & 45 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion bin/collator/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "astar-collator"
version = "3.1.1"
version = "3.1.2"
authors = ["Stake Technologies <[email protected]>"]
description = "Astar collator implementation in Rust."
build = "build.rs"
Expand Down
2 changes: 1 addition & 1 deletion runtime/astar/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "astar-runtime"
version = "3.1.1"
version = "3.1.2"
authors = ["Stake Technologies <[email protected]>"]
edition = "2018"
build = "build.rs"
Expand Down
2 changes: 1 addition & 1 deletion runtime/local/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "local-runtime"
version = "3.1.1"
version = "3.1.2"
authors = ["Stake Technologies <[email protected]>"]
edition = "2018"
build = "build.rs"
Expand Down
2 changes: 1 addition & 1 deletion runtime/shibuya/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "shibuya-runtime"
version = "3.1.1"
version = "3.1.2"
authors = ["Stake Technologies <[email protected]>"]
edition = "2018"
build = "build.rs"
Expand Down
14 changes: 12 additions & 2 deletions runtime/shibuya/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use codec::{Decode, Encode};
use frame_support::{
construct_runtime, parameter_types,
traits::{Contains, Currency, FindAuthor, Imbalance, OnUnbalanced, SameOrOther},
traits::{Contains, Currency, FindAuthor, Imbalance, OnUnbalanced},
weights::{
constants::{BlockExecutionWeight, ExtrinsicBaseWeight, WEIGHT_PER_SECOND},
DispatchClass, Weight, WeightToFeeCoefficient, WeightToFeeCoefficients,
Expand Down Expand Up @@ -85,7 +85,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!("shibuya"),
impl_name: create_runtime_str!("shibuya"),
authoring_version: 1,
spec_version: 21,
spec_version: 22,
impl_version: 0,
apis: RUNTIME_API_VERSIONS,
transaction_version: 1,
Expand Down Expand Up @@ -739,8 +739,18 @@ pub type Executive = frame_executive::Executive<
frame_system::ChainContext<Runtime>,
Runtime,
AllPallets,
OnRuntimeUpgrade,
>;

pub struct OnRuntimeUpgrade;
impl frame_support::traits::OnRuntimeUpgrade for OnRuntimeUpgrade {
fn on_runtime_upgrade() -> u64 {
frame_support::migrations::migrate_from_pallet_version_to_storage_version::<
AllPalletsWithSystem,
>(&RocksDbWeight::get())
}
}

impl_runtime_apis! {
impl sp_api::Core<Block> for Runtime {
fn version() -> RuntimeVersion {
Expand Down
2 changes: 1 addition & 1 deletion runtime/shiden/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "shiden-runtime"
version = "3.1.1"
version = "3.1.2"
authors = ["Stake Technologies <[email protected]>"]
edition = "2018"
build = "build.rs"
Expand Down
14 changes: 12 additions & 2 deletions runtime/shiden/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use codec::{Decode, Encode};
use frame_support::{
construct_runtime, parameter_types,
traits::{Contains, Currency, FindAuthor, Imbalance, OnUnbalanced, SameOrOther},
traits::{Contains, Currency, FindAuthor, Imbalance, OnUnbalanced},
weights::{
constants::{BlockExecutionWeight, ExtrinsicBaseWeight, WEIGHT_PER_SECOND},
DispatchClass, Weight, WeightToFeeCoefficient, WeightToFeeCoefficients,
Expand Down Expand Up @@ -84,7 +84,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!("shiden"),
impl_name: create_runtime_str!("shiden"),
authoring_version: 1,
spec_version: 31,
spec_version: 32,
impl_version: 0,
apis: RUNTIME_API_VERSIONS,
transaction_version: 1,
Expand Down Expand Up @@ -738,8 +738,18 @@ pub type Executive = frame_executive::Executive<
frame_system::ChainContext<Runtime>,
Runtime,
AllPallets,
OnRuntimeUpgrade,
>;

pub struct OnRuntimeUpgrade;
impl frame_support::traits::OnRuntimeUpgrade for OnRuntimeUpgrade {
fn on_runtime_upgrade() -> u64 {
frame_support::migrations::migrate_from_pallet_version_to_storage_version::<
AllPalletsWithSystem,
>(&RocksDbWeight::get())
}
}

impl_runtime_apis! {
impl sp_api::Core<Block> for Runtime {
fn version() -> RuntimeVersion {
Expand Down

0 comments on commit f956c0a

Please sign in to comment.