Move runtime upgrade to frame-executive (#5197)

* Move runtime upgrade to `frame-executive`

Instead of storing the runtime upgraded in the space of `frame-system`,
this moves it to `frame-executive`. We also start storing the
`spec_version` and `impl_version` the last runtime upgrade was applied.

This scheme has multiple advantages:
- We don't need to make sure that runtime upgrade was set.
- This will work in the future when we want to test a runtime upgrade,
because the `on_runtime_upgrade` will be executed automatically when the
runtime changes.

* Move `LAST_RUNTIME_UPGRADE` key to `frame-executive`

* Add some more documentation

* Make sure `spec_version` always increases between runtime upgrades

* Fix test

* Upgrade `parity-multiaddr` to fix compilation

* Also check if the `spec_name` changed

* Remove `RuntimeUpgraded` storage entry

* Don't run on genesis
This commit is contained in:
Bastian Köcher
2020-03-15 20:28:57 +01:00
committed by GitHub
parent b57fd17998
commit 26fa6e3c76
7 changed files with 156 additions and 47 deletions
+2 -2
View File
@@ -13,16 +13,17 @@ codec = { package = "parity-scale-codec", version = "1.2.0", default-features =
frame-support = { version = "2.0.0-alpha.2", default-features = false, path = "../support" }
frame-system = { version = "2.0.0-alpha.2", default-features = false, path = "../system" }
serde = { version = "1.0.101", optional = true }
sp-io ={ path = "../../primitives/io", default-features = false , version = "2.0.0-alpha.2"}
sp-runtime = { version = "2.0.0-alpha.2", default-features = false, path = "../../primitives/runtime" }
sp-std = { version = "2.0.0-alpha.2", default-features = false, path = "../../primitives/std" }
[dev-dependencies]
hex-literal = "0.2.1"
sp-core = { version = "2.0.0-alpha.2", path = "../../primitives/core" }
sp-io ={ path = "../../primitives/io", version = "2.0.0-alpha.2"}
pallet-indices = { version = "2.0.0-alpha.2", path = "../indices" }
pallet-balances = { version = "2.0.0-alpha.2", path = "../balances" }
pallet-transaction-payment = { version = "2.0.0-alpha.2", path = "../transaction-payment" }
sp-version = { version = "2.0.0-alpha.2", path = "../../primitives/version" }
[features]
default = ["std"]
@@ -31,7 +32,6 @@ std = [
"frame-support/std",
"frame-system/std",
"serde",
"sp-io/std",
"sp-runtime/std",
"sp-std/std",
]