git.delta.rocks / unique-network / refs/commits / 4657e257e343

difftreelog

Adjust node to new runtimes

Daniel Shiposha2022-03-05parent: #1f97da5.patch.diff
in: master

6 files changed

modifiednode/cli/Cargo.tomldiffbeforeafterboth
--- a/node/cli/Cargo.toml
+++ b/node/cli/Cargo.toml
@@ -239,8 +239,17 @@
 # Local dependencies
 
 [dependencies.unique-runtime]
-path = '../../runtime'
+path = '../../runtime/unique'
+optional = true
+
+[dependencies.quartz-runtime]
+path = '../../runtime/quartz'
+optional = true
 
+[dependencies.opal-runtime]
+path = '../../runtime/opal'
+optional = true
+
 [dependencies.up-data-structs]
 path = "../../primitives/data-structs"
 default-features = false
@@ -283,10 +292,10 @@
 fp-rpc = { git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.17" }
 pallet-ethereum = { git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.17" }
 
-unique-rpc = { path = "../rpc" }
+unique-rpc = { default-features = false, path = "../rpc" }
 
 [features]
-default = []
+default = ["unique-runtime"]
 runtime-benchmarks = [
     'unique-runtime/runtime-benchmarks',
     'polkadot-service/runtime-benchmarks',
modifiednode/cli/src/chain_spec.rsdiffbeforeafterboth
--- a/node/cli/src/chain_spec.rs
+++ b/node/cli/src/chain_spec.rs
@@ -15,7 +15,6 @@
 // along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
 
 use cumulus_primitives_core::ParaId;
-use unique_runtime::*;
 use sc_chain_spec::{ChainSpecExtension, ChainSpecGroup};
 use sc_service::ChainType;
 use sp_core::{sr25519, Pair, Public};
@@ -25,8 +24,19 @@
 use serde::{Deserialize, Serialize};
 use serde_json::map::Map;
 
+#[cfg(feature = "unique-runtime")]
+use unique_runtime as runtime;
+
+#[cfg(feature = "quartz-runtime")]
+use quartz_runtime as runtime;
+
+#[cfg(feature = "opal-runtime")]
+use opal_runtime as runtime;
+
+use runtime::{*, opaque::*};
+
 /// Specialized `ChainSpec`. This is a specialization of the general Substrate ChainSpec type.
-pub type ChainSpec = sc_service::GenericChainSpec<unique_runtime::GenesisConfig, Extensions>;
+pub type ChainSpec = sc_service::GenericChainSpec<runtime::GenesisConfig, Extensions>;
 
 /// Helper function to generate a crypto pair from seed
 pub fn get_from_seed<TPublic: Public>(seed: &str) -> <TPublic::Pair as Pair>::Public {
@@ -217,8 +227,8 @@
 	id: ParaId,
 ) -> GenesisConfig {
 	GenesisConfig {
-		system: unique_runtime::SystemConfig {
-			code: unique_runtime::WASM_BINARY
+		system: runtime::SystemConfig {
+			code: runtime::WASM_BINARY
 				.expect("WASM binary was not build, please build it!")
 				.to_vec(),
 		},
@@ -235,9 +245,9 @@
 			key: Some(root_key),
 		},
 		vesting: VestingConfig { vesting: vec![] },
-		parachain_info: unique_runtime::ParachainInfoConfig { parachain_id: id },
+		parachain_info: runtime::ParachainInfoConfig { parachain_id: id },
 		parachain_system: Default::default(),
-		aura: unique_runtime::AuraConfig {
+		aura: runtime::AuraConfig {
 			authorities: initial_authorities,
 		},
 		aura_ext: Default::default(),
modifiednode/cli/src/command.rsdiffbeforeafterboth
41use cumulus_primitives_core::ParaId;41use cumulus_primitives_core::ParaId;
42use cumulus_client_service::genesis::generate_genesis_block;42use cumulus_client_service::genesis::generate_genesis_block;
43use log::info;43use log::info;
44use unique_runtime::Block;
45use polkadot_parachain::primitives::AccountIdConversion;44use polkadot_parachain::primitives::AccountIdConversion;
46use sc_cli::{45use sc_cli::{
47 ChainSpec, CliConfiguration, DefaultConfigurationValues, ImportParams, KeystoreParams,46 ChainSpec, CliConfiguration, DefaultConfigurationValues, ImportParams, KeystoreParams,
54use sp_runtime::traits::Block as BlockT;53use sp_runtime::traits::Block as BlockT;
55use std::{io::Write, net::SocketAddr};54use std::{io::Write, net::SocketAddr};
55
56#[cfg(feature = "unique-runtime")]
57use unique_runtime as runtime;
58
59#[cfg(feature = "quartz-runtime")]
60use quartz_runtime as runtime;
61
62#[cfg(feature = "opal-runtime")]
63use opal_runtime as runtime;
64
65use runtime::Block;
5666
57fn load_spec(id: &str) -> std::result::Result<Box<dyn sc_service::ChainSpec>, String> {67fn load_spec(id: &str) -> std::result::Result<Box<dyn sc_service::ChainSpec>, String> {
58 Ok(match id {68 Ok(match id {
104 }114 }
105115
106 fn native_runtime_version(_: &Box<dyn ChainSpec>) -> &'static RuntimeVersion {116 fn native_runtime_version(_: &Box<dyn ChainSpec>) -> &'static RuntimeVersion {
107 &unique_runtime::VERSION117 &runtime::VERSION
108 }118 }
109}119}
110120
modifiednode/cli/src/service.rsdiffbeforeafterboth
--- a/node/cli/src/service.rs
+++ b/node/cli/src/service.rs
@@ -26,8 +26,17 @@
 
 use unique_rpc::overrides_handle;
 // Local Runtime Types
-use unique_runtime::RuntimeApi;
+#[cfg(feature = "unique-runtime")]
+use unique_runtime as runtime;
+
+#[cfg(feature = "quartz-runtime")]
+use quartz_runtime as runtime;
 
+#[cfg(feature = "opal-runtime")]
+use opal_runtime as runtime;
+
+use runtime::RuntimeApi;
+
 // Cumulus Imports
 use cumulus_client_consensus_aura::{AuraConsensus, BuildAuraConsensusParams, SlotProportion};
 use cumulus_client_consensus_common::ParachainConsensus;
@@ -69,11 +78,11 @@
 	type ExtendHostFunctions = frame_benchmarking::benchmarking::HostFunctions;
 
 	fn dispatch(method: &str, data: &[u8]) -> Option<Vec<u8>> {
-		unique_runtime::api::dispatch(method, data)
+		runtime::api::dispatch(method, data)
 	}
 
 	fn native_version() -> sc_executor::NativeVersion {
-		unique_runtime::native_version()
+		runtime::native_version()
 	}
 }
 
modifiednode/rpc/Cargo.tomldiffbeforeafterboth
--- a/node/rpc/Cargo.toml
+++ b/node/rpc/Cargo.toml
@@ -51,7 +51,10 @@
 pallet-unique = { path = "../../pallets/unique" }
 uc-rpc = { path = "../../client/rpc" }
 up-rpc = { path = "../../primitives/rpc" }
-unique-runtime = { path = "../../runtime" }
+unique-runtime = { path = "../../runtime/unique", optional = true }
+quartz-runtime = { path = "../../runtime/quartz", optional = true }
+opal-runtime = { path = "../../runtime/opal", optional = true }
 
 [features]
+default = ["unique-runtime"]
 std = []
modifiednode/rpc/src/lib.rsdiffbeforeafterboth
--- a/node/rpc/src/lib.rs
+++ b/node/rpc/src/lib.rs
@@ -15,7 +15,6 @@
 // along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
 
 use sp_runtime::traits::BlakeTwo256;
-use unique_runtime::{Hash, AccountId, CrossAccountId, Index, opaque::Block, BlockNumber, Balance};
 use fc_rpc::{
 	EthBlockDataCache, OverrideHandle, RuntimeApiStorageOverride, SchemaV1Override,
 	StorageOverride, SchemaV2Override, SchemaV3Override,
@@ -41,6 +40,17 @@
 use sc_service::TransactionPool;
 use std::{collections::BTreeMap, marker::PhantomData, sync::Arc};
 
+#[cfg(feature = "unique-runtime")]
+use unique_runtime as runtime;
+
+#[cfg(feature = "quartz-runtime")]
+use quartz_runtime as runtime;
+
+#[cfg(feature = "opal-runtime")]
+use opal_runtime as runtime;
+
+use runtime::opaque::{Hash, AccountId, CrossAccountId, Index, Block, BlockNumber, Balance};
+
 /// Public io handler for exporting into other modules
 pub type IoHandler = jsonrpc_core::IoHandler<sc_rpc::Metadata>;
 
@@ -231,7 +241,7 @@
 		client.clone(),
 		pool.clone(),
 		graph,
-		unique_runtime::TransactionConverter,
+		runtime::TransactionConverter,
 		network.clone(),
 		signers,
 		overrides.clone(),