git.delta.rocks / unique-network / refs/commits / 911b03c63217

difftreelog

fix wasm runtime version section

Yaroslav Bolyukin2023-09-08parent: #320ac9b.patch.diff
in: master

9 files changed

modifiednode/cli/Cargo.tomldiffbeforeafterboth
--- a/node/cli/Cargo.toml
+++ b/node/cli/Cargo.toml
@@ -108,4 +108,3 @@
 runtime-benchmarks = ['opal-runtime/runtime-benchmarks', 'polkadot-cli/runtime-benchmarks', 'polkadot-service/runtime-benchmarks', 'quartz-runtime?/runtime-benchmarks', 'sc-service/runtime-benchmarks', 'unique-runtime?/runtime-benchmarks']
 sapphire-runtime = ['quartz-runtime', 'quartz-runtime/become-sapphire']
 try-runtime = ['opal-runtime?/try-runtime', 'quartz-runtime?/try-runtime', 'try-runtime-cli/try-runtime', 'unique-runtime?/try-runtime']
-state-version-0 = ['opal-runtime?/state-version-0', 'quartz-runtime?/state-version-0', 'unique-runtime?/state-version-0']
modifiednode/cli/src/chain_spec.rsdiffbeforeafterboth
--- a/node/cli/src/chain_spec.rs
+++ b/node/cli/src/chain_spec.rs
@@ -281,7 +281,7 @@
 		// Name
 		format!(
 			"{}{}",
-			default_runtime::RUNTIME_NAME.to_uppercase(),
+			default_runtime::VERSION.spec_name.to_uppercase(),
 			if cfg!(feature = "unique-runtime") {
 				""
 			} else {
@@ -290,7 +290,7 @@
 		)
 		.as_str(),
 		// ID
-		format!("{}_dev", default_runtime::RUNTIME_NAME).as_str(),
+		format!("{}_dev", default_runtime::VERSION.spec_name).as_str(),
 		ChainType::Local,
 		move || {
 			testnet_genesis!(
@@ -355,7 +355,7 @@
 		// Name
 		format!(
 			"{}{}",
-			default_runtime::RUNTIME_NAME.to_uppercase(),
+			default_runtime::VERSION.impl_name.to_uppercase(),
 			if cfg!(feature = "unique-runtime") {
 				""
 			} else {
@@ -364,7 +364,7 @@
 		)
 		.as_str(),
 		// ID
-		format!("{}_local", default_runtime::RUNTIME_NAME).as_str(),
+		format!("{}_local", default_runtime::VERSION.spec_name).as_str(),
 		ChainType::Local,
 		move || {
 			testnet_genesis!(
modifiedruntime/common/config/pallets/mod.rsdiffbeforeafterboth
--- a/runtime/common/config/pallets/mod.rs
+++ b/runtime/common/config/pallets/mod.rs
@@ -24,7 +24,7 @@
 		weights::CommonWeights,
 		RelayChainBlockNumberProvider,
 	},
-	Runtime, RuntimeEvent, RuntimeCall, RUNTIME_NAME, TOKEN_SYMBOL, DECIMALS, Balances,
+	Runtime, RuntimeEvent, RuntimeCall, VERSION, TOKEN_SYMBOL, DECIMALS, Balances,
 };
 use frame_support::traits::{ConstU32, ConstU64, Currency};
 use up_common::{
@@ -90,7 +90,7 @@
 
 parameter_types! {
 	pub const Decimals: u8 = DECIMALS;
-	pub Name: String = RUNTIME_NAME.to_string();
+	pub Name: String = String::from_utf8_lossy(VERSION.impl_name.as_ref()).to_string();
 	pub Symbol: String = TOKEN_SYMBOL.to_string();
 }
 impl pallet_balances_adapter::Config for Runtime {
modifiedruntime/opal/Cargo.tomldiffbeforeafterboth
--- a/runtime/opal/Cargo.toml
+++ b/runtime/opal/Cargo.toml
@@ -64,7 +64,6 @@
 	'sp-runtime/runtime-benchmarks',
 	'xcm-builder/runtime-benchmarks',
 ]
-state-version-0 = []
 std = [
 	'codec/std',
 	'cumulus-pallet-aura-ext/std',
modifiedruntime/opal/src/lib.rsdiffbeforeafterboth
before · runtime/opal/src/lib.rs
1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617//! The Substrate Node Template runtime. This can be compiled with `#[no_std]`, ready for Wasm.1819#![cfg_attr(not(feature = "std"), no_std)]20// `construct_runtime!` does a lot of recursion and requires us to increase the limit to 256.21#![recursion_limit = "1024"]22#![allow(clippy::from_over_into, clippy::identity_op)]23#![allow(clippy::fn_to_numeric_cast_with_truncation)]24// Make the WASM binary available.25#[cfg(feature = "std")]26include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));2728extern crate alloc;2930use frame_support::parameter_types;3132use sp_version::RuntimeVersion;33use sp_runtime::create_runtime_str;3435use up_common::types::*;3637use ::xcm::latest::NetworkId;3839mod runtime_common;4041pub mod governance_timings;42pub mod xcm_barrier;4344pub use runtime_common::*;4546pub const RUNTIME_NAME: &str = "opal";47pub const TOKEN_SYMBOL: &str = "OPL";48pub const DECIMALS: u8 = 18;4950/// This runtime version.51pub const VERSION: RuntimeVersion = RuntimeVersion {52	spec_name: create_runtime_str!(RUNTIME_NAME),53	impl_name: create_runtime_str!(RUNTIME_NAME),54	authoring_version: 1,55	spec_version: 943060,56	impl_version: 0,57	apis: RUNTIME_API_VERSIONS,58	transaction_version: 3,59	#[cfg(feature = "state-version-0")]60	state_version: 0,61	#[cfg(not(feature = "state-version-0"))]62	state_version: 1,63};6465parameter_types! {66	pub const Version: RuntimeVersion = VERSION;67	pub const SS58Prefix: u16 = 42;68	pub const ChainId: u64 = 8882;69	pub const RelayNetwork: NetworkId = NetworkId::Kusama;70}7172construct_runtime!();7374impl_common_runtime_apis!();7576cumulus_pallet_parachain_system::register_validate_block!(77	Runtime = Runtime,78	BlockExecutor = cumulus_pallet_aura_ext::BlockExecutor::<Runtime, Executive>,79	CheckInherents = CheckInherents,80);
modifiedruntime/quartz/Cargo.tomldiffbeforeafterboth
--- a/runtime/quartz/Cargo.toml
+++ b/runtime/quartz/Cargo.toml
@@ -60,7 +60,6 @@
 	'sp-runtime/runtime-benchmarks',
 	'xcm-builder/runtime-benchmarks',
 ]
-state-version-0 = []
 std = [
 	'codec/std',
 	'cumulus-pallet-aura-ext/std',
modifiedruntime/quartz/src/lib.rsdiffbeforeafterboth
--- a/runtime/quartz/src/lib.rs
+++ b/runtime/quartz/src/lib.rs
@@ -43,25 +43,34 @@
 
 pub use runtime_common::*;
 
-#[cfg(feature = "become-sapphire")]
-pub const RUNTIME_NAME: &str = "sapphire";
-#[cfg(not(feature = "become-sapphire"))]
-pub const RUNTIME_NAME: &str = "quartz";
 pub const TOKEN_SYMBOL: &str = "QTZ";
 pub const DECIMALS: u8 = 18;
 
 /// This runtime version.
+#[cfg(not(feature = "become-sapphire"))]
+#[sp_version::runtime_version]
 pub const VERSION: RuntimeVersion = RuntimeVersion {
-	spec_name: create_runtime_str!(RUNTIME_NAME),
-	impl_name: create_runtime_str!(RUNTIME_NAME),
+	spec_name: create_runtime_str!("quartz"),
+	impl_name: create_runtime_str!("quartz"),
+
+	authoring_version: 1,
+	spec_version: 943060,
+	impl_version: 0,
+	apis: RUNTIME_API_VERSIONS,
+	transaction_version: 3,
+	state_version: 1,
+};
+#[cfg(feature = "become-sapphire")]
+#[sp_version::runtime_version]
+pub const VERSION: RuntimeVersion = RuntimeVersion {
+	spec_name: create_runtime_str!("sapphire"),
+	impl_name: create_runtime_str!("sapphire"),
+
 	authoring_version: 1,
 	spec_version: 943060,
 	impl_version: 0,
 	apis: RUNTIME_API_VERSIONS,
 	transaction_version: 3,
-	#[cfg(feature = "state-version-0")]
-	state_version: 0,
-	#[cfg(not(feature = "state-version-0"))]
 	state_version: 1,
 };
 
modifiedruntime/unique/Cargo.tomldiffbeforeafterboth
--- a/runtime/unique/Cargo.toml
+++ b/runtime/unique/Cargo.toml
@@ -58,7 +58,6 @@
 	'up-data-structs/runtime-benchmarks',
 	'xcm-builder/runtime-benchmarks',
 ]
-state-version-0 = []
 std = [
 	'codec/std',
 	'cumulus-pallet-aura-ext/std',
modifiedruntime/unique/src/lib.rsdiffbeforeafterboth
--- a/runtime/unique/src/lib.rs
+++ b/runtime/unique/src/lib.rs
@@ -43,22 +43,19 @@
 
 pub use runtime_common::*;
 
-pub const RUNTIME_NAME: &str = "unique";
 pub const TOKEN_SYMBOL: &str = "UNQ";
 pub const DECIMALS: u8 = 18;
 
 /// This runtime version.
+#[sp_version::runtime_version]
 pub const VERSION: RuntimeVersion = RuntimeVersion {
-	spec_name: create_runtime_str!(RUNTIME_NAME),
-	impl_name: create_runtime_str!(RUNTIME_NAME),
+	spec_name: create_runtime_str!("unique"),
+	impl_name: create_runtime_str!("unique"),
 	authoring_version: 1,
 	spec_version: 943060,
 	impl_version: 0,
 	apis: RUNTIME_API_VERSIONS,
 	transaction_version: 3,
-	#[cfg(feature = "state-version-0")]
-	state_version: 0,
-	#[cfg(not(feature = "state-version-0"))]
 	state_version: 1,
 };