Skip to content
Snippets Groups Projects
Commit 093b574d authored by Sergey Pepyakin's avatar Sergey Pepyakin Committed by GitHub
Browse files

Slap runtime_version macro everywhere (#444)

* Slap runtime_version macro everywhere

* Update Substrate

This includes the fix of compilation for macOS platforms.
parent d458d262
No related merge requests found
This diff is collapsed.
......@@ -76,6 +76,7 @@ impl_opaque_keys! {
}
/// This runtime version.
#[sp_version::runtime_version]
pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!("test-parachain"),
impl_name: create_runtime_str!("test-parachain"),
......
......@@ -59,6 +59,7 @@ use xcm_builder::{
use xcm_executor::{Config, XcmExecutor};
/// This runtime version.
#[sp_version::runtime_version]
pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!("shell"),
impl_name: create_runtime_str!("shell"),
......
......@@ -59,17 +59,38 @@ impl_opaque_keys! {
pub struct SessionKeys {}
}
const SPEC_VERSION: u32 = 3;
// The only difference between the two declarations below is the `spec_version`. With the
// `upgrade` feature enabled `spec_version` should be greater than the one of without the
// `upgrade` feature.
//
// The duplication here is unfortunate necessity.
//
// runtime_version macro is dumb. It accepts a const item declaration, passes it through and
// also emits runtime version custom section. It parses the expressions to extract the version
// details. Since macro kicks in early, it operates on AST. Thus you cannot use constants.
// Macros are expanded top to bottom, meaning we also cannot use `cfg` here.
#[cfg(feature = "upgrade")]
#[sp_version::runtime_version]
pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!("cumulus-test-parachain"),
impl_name: create_runtime_str!("cumulus-test-parachain"),
authoring_version: 1,
// Read the note above.
spec_version: 4,
impl_version: 1,
apis: RUNTIME_API_VERSIONS,
transaction_version: 1,
};
/// This runtime version.
#[cfg(not(feature = "upgrade"))]
#[sp_version::runtime_version]
pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!("cumulus-test-parachain"),
impl_name: create_runtime_str!("cumulus-test-parachain"),
authoring_version: 1,
#[cfg(feature = "upgrade")]
spec_version: SPEC_VERSION + 1,
#[cfg(not(feature = "upgrade"))]
spec_version: SPEC_VERSION,
// Read the note above.
spec_version: 3,
impl_version: 1,
apis: RUNTIME_API_VERSIONS,
transaction_version: 1,
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment