From f956c0a78bff214b26c761faac34cbdd99b9e759 Mon Sep 17 00:00:00 2001 From: Aleksandr Krupenkin Date: Sat, 27 Nov 2021 20:03:11 +0300 Subject: [PATCH] Added storage version migration (#527) --- Cargo.lock | 77 ++++++++++++++++---------------------- bin/collator/Cargo.toml | 2 +- runtime/astar/Cargo.toml | 2 +- runtime/local/Cargo.toml | 2 +- runtime/shibuya/Cargo.toml | 2 +- runtime/shibuya/src/lib.rs | 14 ++++++- runtime/shiden/Cargo.toml | 2 +- runtime/shiden/src/lib.rs | 14 ++++++- 8 files changed, 61 insertions(+), 54 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 486b95e742..b3d31858fe 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -117,9 +117,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.48" +version = "1.0.49" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62e1f47f7dc0422027a4e370dd4548d4d66b26782e513e98dca1e689e058a80e" +checksum = "0a03e93e97a28fbc9f42fbc5ba0886a3c67eb637b476dbee711f80a6ffe8223d" [[package]] name = "approx" @@ -171,7 +171,7 @@ checksum = "9b34d609dfbaf33d6889b2b7106d3ca345eacad44200913df5ba02bfd31d2ba9" [[package]] name = "astar-collator" -version = "3.1.1" +version = "3.1.2" dependencies = [ "astar-runtime", "async-trait", @@ -255,7 +255,7 @@ dependencies = [ [[package]] name = "astar-runtime" -version = "3.1.1" +version = "3.1.2" dependencies = [ "cumulus-pallet-aura-ext", "cumulus-pallet-parachain-system", @@ -679,9 +679,9 @@ dependencies = [ [[package]] name = "bindgen" -version = "0.59.1" +version = "0.59.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "453c49e5950bb0eb63bb3df640e31618846c89d5b7faa54040d76e98e0134375" +checksum = "2bd2a9a458e8f4304c52c43ebb0cfbd520289f8379a52e329a38afda99bf8eb8" dependencies = [ "bitflags", "cexpr", @@ -702,18 +702,6 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" -[[package]] -name = "bitvec" -version = "0.19.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55f93d0ef3363c364d5976646a38f04cf67cfe1d4c8d160cdea02cab2c116b33" -dependencies = [ - "funty", - "radium 0.5.3", - "tap", - "wyz", -] - [[package]] name = "bitvec" version = "0.20.4" @@ -721,7 +709,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7774144344a4faa177370406a7ff5f1da24303817368584c6206c8303eb07848" dependencies = [ "funty", - "radium 0.6.2", + "radium", "tap", "wyz", ] @@ -963,9 +951,9 @@ dependencies = [ [[package]] name = "cexpr" -version = "0.5.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db507a7679252d2276ed0dd8113c6875ec56d3089f9225b2b42c30cc1f8e5c89" +checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766" dependencies = [ "nom", ] @@ -4273,7 +4261,7 @@ dependencies = [ [[package]] name = "local-runtime" -version = "3.1.1" +version = "3.1.2" dependencies = [ "evm", "fp-rpc", @@ -4550,6 +4538,12 @@ dependencies = [ "syn", ] +[[package]] +name = "minimal-lexical" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + [[package]] name = "miniz_oxide" version = "0.4.4" @@ -4787,13 +4781,12 @@ checksum = "2bf50223579dc7cdcfb3bfcacf7069ff68243f8c363f62ffa99cf000a6b9c451" [[package]] name = "nom" -version = "6.1.2" +version = "7.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7413f999671bd4745a7b624bd370a569fb6bc574b23c83a3c5ed2e453f3d5e2" +checksum = "1b1d11e1ef389c76fe5b81bcaf2ea32cf88b62bc494e19f493d0b30e7a930109" dependencies = [ - "bitvec 0.19.6", - "funty", "memchr", + "minimal-lexical", "version_check", ] @@ -5953,7 +5946,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "373b1a4c1338d9cd3d1fa53b3a11bdab5ab6bd80a20f7f7becd76953ae2be909" dependencies = [ "arrayvec 0.7.2", - "bitvec 0.20.4", + "bitvec", "byte-slice-cast", "impl-trait-for-tuples 0.2.1", "parity-scale-codec-derive", @@ -6525,7 +6518,7 @@ name = "polkadot-node-core-approval-voting" version = "0.9.12" source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e" dependencies = [ - "bitvec 0.20.4", + "bitvec", "derive_more", "futures 0.3.18", "futures-timer 3.0.2", @@ -6553,7 +6546,7 @@ name = "polkadot-node-core-av-store" version = "0.9.12" source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e" dependencies = [ - "bitvec 0.20.4", + "bitvec", "futures 0.3.18", "futures-timer 3.0.2", "kvdb", @@ -6573,7 +6566,7 @@ name = "polkadot-node-core-backing" version = "0.9.12" source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e" dependencies = [ - "bitvec 0.20.4", + "bitvec", "futures 0.3.18", "polkadot-erasure-coding", "polkadot-node-primitives", @@ -6656,7 +6649,7 @@ name = "polkadot-node-core-dispute-coordinator" version = "0.9.12" source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e" dependencies = [ - "bitvec 0.20.4", + "bitvec", "derive_more", "futures 0.3.18", "kvdb", @@ -6705,7 +6698,7 @@ name = "polkadot-node-core-provisioner" version = "0.9.12" source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e" dependencies = [ - "bitvec 0.20.4", + "bitvec", "futures 0.3.18", "futures-timer 3.0.2", "polkadot-node-subsystem", @@ -6960,7 +6953,7 @@ name = "polkadot-primitives" version = "0.9.12" source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e" dependencies = [ - "bitvec 0.20.4", + "bitvec", "frame-system", "hex-literal 0.3.4", "parity-scale-codec", @@ -7022,7 +7015,7 @@ version = "0.9.12" source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e" dependencies = [ "beefy-primitives", - "bitvec 0.20.4", + "bitvec", "frame-election-provider-support", "frame-executive", "frame-support", @@ -7094,7 +7087,7 @@ version = "0.9.12" source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e" dependencies = [ "beefy-primitives", - "bitvec 0.20.4", + "bitvec", "frame-election-provider-support", "frame-support", "frame-system", @@ -7139,7 +7132,7 @@ version = "0.9.12" source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e" dependencies = [ "bitflags", - "bitvec 0.20.4", + "bitvec", "derive_more", "frame-support", "frame-system", @@ -7554,12 +7547,6 @@ dependencies = [ "proc-macro2", ] -[[package]] -name = "radium" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "941ba9d78d8e2f7ce474c015eea4d9c6d25b6a3327f9832ee29a4de27f91bbb8" - [[package]] name = "radium" version = "0.6.2" @@ -8990,7 +8977,7 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5c55b744399c25532d63a0d2789b109df8d46fc93752d46b0782991a931a782f" dependencies = [ - "bitvec 0.20.4", + "bitvec", "cfg-if 1.0.0", "derive_more", "parity-scale-codec", @@ -9258,7 +9245,7 @@ dependencies = [ [[package]] name = "shibuya-runtime" -version = "3.1.1" +version = "3.1.2" dependencies = [ "cumulus-pallet-aura-ext", "cumulus-pallet-parachain-system", @@ -9325,7 +9312,7 @@ dependencies = [ [[package]] name = "shiden-runtime" -version = "3.1.1" +version = "3.1.2" dependencies = [ "cumulus-pallet-aura-ext", "cumulus-pallet-parachain-system", diff --git a/bin/collator/Cargo.toml b/bin/collator/Cargo.toml index deca57438f..ec836b7783 100644 --- a/bin/collator/Cargo.toml +++ b/bin/collator/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "astar-collator" -version = "3.1.1" +version = "3.1.2" authors = ["Stake Technologies "] description = "Astar collator implementation in Rust." build = "build.rs" diff --git a/runtime/astar/Cargo.toml b/runtime/astar/Cargo.toml index df1cdf5aeb..8ca64827b4 100644 --- a/runtime/astar/Cargo.toml +++ b/runtime/astar/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "astar-runtime" -version = "3.1.1" +version = "3.1.2" authors = ["Stake Technologies "] edition = "2018" build = "build.rs" diff --git a/runtime/local/Cargo.toml b/runtime/local/Cargo.toml index 5e3323f71a..1ef99c9ea0 100644 --- a/runtime/local/Cargo.toml +++ b/runtime/local/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "local-runtime" -version = "3.1.1" +version = "3.1.2" authors = ["Stake Technologies "] edition = "2018" build = "build.rs" diff --git a/runtime/shibuya/Cargo.toml b/runtime/shibuya/Cargo.toml index 6fbabc44d4..2cbff14538 100644 --- a/runtime/shibuya/Cargo.toml +++ b/runtime/shibuya/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "shibuya-runtime" -version = "3.1.1" +version = "3.1.2" authors = ["Stake Technologies "] edition = "2018" build = "build.rs" diff --git a/runtime/shibuya/src/lib.rs b/runtime/shibuya/src/lib.rs index e96e43c1d5..b6741e5680 100644 --- a/runtime/shibuya/src/lib.rs +++ b/runtime/shibuya/src/lib.rs @@ -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, @@ -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, @@ -739,8 +739,18 @@ pub type Executive = frame_executive::Executive< frame_system::ChainContext, 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 for Runtime { fn version() -> RuntimeVersion { diff --git a/runtime/shiden/Cargo.toml b/runtime/shiden/Cargo.toml index 430a0197cb..7a3b734d06 100644 --- a/runtime/shiden/Cargo.toml +++ b/runtime/shiden/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "shiden-runtime" -version = "3.1.1" +version = "3.1.2" authors = ["Stake Technologies "] edition = "2018" build = "build.rs" diff --git a/runtime/shiden/src/lib.rs b/runtime/shiden/src/lib.rs index 19aec5bb16..bc8cac387e 100644 --- a/runtime/shiden/src/lib.rs +++ b/runtime/shiden/src/lib.rs @@ -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, @@ -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, @@ -738,8 +738,18 @@ pub type Executive = frame_executive::Executive< frame_system::ChainContext, 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 for Runtime { fn version() -> RuntimeVersion {