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
15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
1616
17use cumulus_primitives_core::ParaId;17use cumulus_primitives_core::ParaId;
18use unique_runtime::*;
19use sc_chain_spec::{ChainSpecExtension, ChainSpecGroup};18use sc_chain_spec::{ChainSpecExtension, ChainSpecGroup};
20use sc_service::ChainType;19use sc_service::ChainType;
21use sp_core::{sr25519, Pair, Public};20use sp_core::{sr25519, Pair, Public};
25use serde::{Deserialize, Serialize};24use serde::{Deserialize, Serialize};
26use serde_json::map::Map;25use serde_json::map::Map;
26
27#[cfg(feature = "unique-runtime")]
28use unique_runtime as runtime;
29
30#[cfg(feature = "quartz-runtime")]
31use quartz_runtime as runtime;
32
33#[cfg(feature = "opal-runtime")]
34use opal_runtime as runtime;
35
36use runtime::{*, opaque::*};
2737
28/// Specialized `ChainSpec`. This is a specialization of the general Substrate ChainSpec type.38/// Specialized `ChainSpec`. This is a specialization of the general Substrate ChainSpec type.
29pub type ChainSpec = sc_service::GenericChainSpec<unique_runtime::GenesisConfig, Extensions>;39pub type ChainSpec = sc_service::GenericChainSpec<runtime::GenesisConfig, Extensions>;
3040
31/// Helper function to generate a crypto pair from seed41/// Helper function to generate a crypto pair from seed
32pub fn get_from_seed<TPublic: Public>(seed: &str) -> <TPublic::Pair as Pair>::Public {42pub fn get_from_seed<TPublic: Public>(seed: &str) -> <TPublic::Pair as Pair>::Public {
217 id: ParaId,227 id: ParaId,
218) -> GenesisConfig {228) -> GenesisConfig {
219 GenesisConfig {229 GenesisConfig {
220 system: unique_runtime::SystemConfig {230 system: runtime::SystemConfig {
221 code: unique_runtime::WASM_BINARY231 code: runtime::WASM_BINARY
222 .expect("WASM binary was not build, please build it!")232 .expect("WASM binary was not build, please build it!")
223 .to_vec(),233 .to_vec(),
224 },234 },
235 key: Some(root_key),245 key: Some(root_key),
236 },246 },
237 vesting: VestingConfig { vesting: vec![] },247 vesting: VestingConfig { vesting: vec![] },
238 parachain_info: unique_runtime::ParachainInfoConfig { parachain_id: id },248 parachain_info: runtime::ParachainInfoConfig { parachain_id: id },
239 parachain_system: Default::default(),249 parachain_system: Default::default(),
240 aura: unique_runtime::AuraConfig {250 aura: runtime::AuraConfig {
241 authorities: initial_authorities,251 authorities: initial_authorities,
242 },252 },
243 aura_ext: Default::default(),253 aura_ext: Default::default(),
modifiednode/cli/src/command.rsdiffbeforeafterboth
--- a/node/cli/src/command.rs
+++ b/node/cli/src/command.rs
@@ -41,7 +41,6 @@
 use cumulus_primitives_core::ParaId;
 use cumulus_client_service::genesis::generate_genesis_block;
 use log::info;
-use unique_runtime::Block;
 use polkadot_parachain::primitives::AccountIdConversion;
 use sc_cli::{
 	ChainSpec, CliConfiguration, DefaultConfigurationValues, ImportParams, KeystoreParams,
@@ -54,6 +53,17 @@
 use sp_runtime::traits::Block as BlockT;
 use std::{io::Write, net::SocketAddr};
 
+#[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::Block;
+
 fn load_spec(id: &str) -> std::result::Result<Box<dyn sc_service::ChainSpec>, String> {
 	Ok(match id {
 		"westend-local" => Box::new(chain_spec::local_testnet_westend_config()),
@@ -104,7 +114,7 @@
 	}
 
 	fn native_runtime_version(_: &Box<dyn ChainSpec>) -> &'static RuntimeVersion {
-		&unique_runtime::VERSION
+		&runtime::VERSION
 	}
 }
 
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(),