git.delta.rocks / unique-network / refs/commits / 2df4b512774f

difftreelog

Merge pull request #901 from UniqueNetwork/feature/unify-nodes

Yaroslav Bolyukin2023-03-29parents: #cf38322 #2ec63fe.patch.diff
in: master

6 files changed

modifiedclient/rpc/Cargo.tomldiffbeforeafterboth
--- a/client/rpc/Cargo.toml
+++ b/client/rpc/Cargo.toml
@@ -36,11 +36,17 @@
 
 sc-executor = { workspace = true }
 
-opal-runtime = { workspace = true }
+opal-runtime = { workspace = true, optional = true }
 quartz-runtime = { workspace = true, optional = true }
 unique-runtime = { workspace = true, optional = true }
 
 [features]
+default = ['opal-runtime']
+all-runtimes = [
+	'opal-runtime',
+	'quartz-runtime',
+	'unique-runtime',
+]
 pov-estimate = [
 	'opal-runtime/pov-estimate',
 	'quartz-runtime?/pov-estimate',
modifiednode/cli/Cargo.tomldiffbeforeafterboth
--- a/node/cli/Cargo.toml
+++ b/node/cli/Cargo.toml
@@ -99,6 +99,11 @@
 
 [features]
 default = ["opal-runtime"]
+all-runtimes = [
+	'opal-runtime',
+	'quartz-runtime',
+	'unique-runtime',
+]
 pov-estimate = [
 	'opal-runtime/pov-estimate',
 	'quartz-runtime?/pov-estimate',
modifiednode/cli/src/cli.rsdiffbeforeafterboth
--- a/node/cli/src/cli.rs
+++ b/node/cli/src/cli.rs
@@ -15,11 +15,9 @@
 // along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
 
 use crate::chain_spec;
-use std::{path::PathBuf, env};
+use std::path::PathBuf;
 use clap::Parser;
 
-const NODE_NAME_ENV: &str = "UNIQUE_NODE_NAME";
-
 /// Sub-commands supported by the collator.
 #[derive(Debug, Parser)]
 pub enum Subcommand {
@@ -99,21 +97,7 @@
 
 impl Cli {
 	pub fn node_name() -> String {
-		match env::var(NODE_NAME_ENV).ok() {
-			Some(name) => name,
-			None => {
-				if cfg!(feature = "unique-runtime") {
-					"Unique"
-				} else if cfg!(feature = "sapphire-runtime") {
-					"Sapphire"
-				} else if cfg!(feature = "quartz-runtime") {
-					"Quartz"
-				} else {
-					"Opal"
-				}
-			}
-			.into(),
-		}
+		"Unique".into()
 	}
 }
 
modifiednode/cli/src/service.rsdiffbeforeafterboth
--- a/node/cli/src/service.rs
+++ b/node/cli/src/service.rs
@@ -68,7 +68,6 @@
 
 use up_common::types::opaque::*;
 
-#[cfg(feature = "pov-estimate")]
 use crate::chain_spec::RuntimeIdentification;
 
 /// Unique native executor instance.
@@ -507,12 +506,10 @@
 	#[cfg(feature = "pov-estimate")]
 	let rpc_backend = backend.clone();
 
-	#[cfg(feature = "pov-estimate")]
 	let runtime_id = parachain_config.chain_spec.runtime_id();
 
 	let rpc_builder = Box::new(move |deny_unsafe, subscription_task_executor| {
 		let full_deps = unique_rpc::FullDeps {
-			#[cfg(feature = "pov-estimate")]
 			runtime_id: runtime_id.clone(),
 
 			#[cfg(feature = "pov-estimate")]
@@ -1040,12 +1037,10 @@
 	#[cfg(feature = "pov-estimate")]
 	let rpc_backend = backend.clone();
 
-	#[cfg(feature = "pov-estimate")]
 	let runtime_id = config.chain_spec.runtime_id();
 
 	let rpc_builder = Box::new(move |deny_unsafe, subscription_executor| {
 		let full_deps = unique_rpc::FullDeps {
-			#[cfg(feature = "pov-estimate")]
 			runtime_id: runtime_id.clone(),
 
 			#[cfg(feature = "pov-estimate")]
modifiednode/rpc/Cargo.tomldiffbeforeafterboth
before · node/rpc/Cargo.toml
1[package]2authors = ['Unique Network <support@uniquenetwork.io>']3description = "Unique chain rpc"4edition = "2021"5license = 'GPLv3'6name = "unique-rpc"7version = "0.1.2"89[package.metadata.docs.rs]10targets = ["x86_64-unknown-linux-gnu"]1112[dependencies]13jsonrpsee = { workspace = true }14# pallet-contracts-rpc = { git = 'https://github.com/paritytech/substrate', branch = 'master' }15pallet-transaction-payment-rpc = { workspace = true }16sc-client-api = { workspace = true }17sc-finality-grandpa = { workspace = true }18sc-network = { workspace = true }19sc-rpc = { workspace = true }20sc-rpc-api = { workspace = true }21sc-service = { workspace = true }22sc-transaction-pool = { workspace = true }23sp-api = { workspace = true }24sp-block-builder = { workspace = true }25sp-blockchain = { workspace = true }26sp-runtime = { workspace = true }27substrate-frame-rpc-system = { workspace = true }2829fc-db = { workspace = true }30fc-rpc = { workspace = true }31fc-rpc-core = { workspace = true }32fp-rpc = { workspace = true }33fp-storage = { workspace = true }3435app-promotion-rpc = { workspace = true }36serde = { workspace = true }37uc-rpc = { workspace = true }38up-common = { workspace = true }39up-data-structs = { workspace = true }40up-pov-estimate-rpc = { workspace = true, default-features = true }41up-rpc = { workspace = true }4243[features]44default = []45pov-estimate = ['uc-rpc/pov-estimate']46std = []47unique-runtime = []
after · node/rpc/Cargo.toml
1[package]2authors = ['Unique Network <support@uniquenetwork.io>']3description = "Unique chain rpc"4edition = "2021"5license = 'GPLv3'6name = "unique-rpc"7version = "0.1.2"89[package.metadata.docs.rs]10targets = ["x86_64-unknown-linux-gnu"]1112[dependencies]13jsonrpsee = { workspace = true }14# pallet-contracts-rpc = { git = 'https://github.com/paritytech/substrate', branch = 'master' }15pallet-transaction-payment-rpc = { workspace = true }16sc-client-api = { workspace = true }17sc-finality-grandpa = { workspace = true }18sc-network = { workspace = true }19sc-rpc = { workspace = true }20sc-rpc-api = { workspace = true }21sc-service = { workspace = true }22sc-transaction-pool = { workspace = true }23sp-api = { workspace = true }24sp-block-builder = { workspace = true }25sp-blockchain = { workspace = true }26sp-runtime = { workspace = true }27substrate-frame-rpc-system = { workspace = true }2829fc-db = { workspace = true }30fc-rpc = { workspace = true }31fc-rpc-core = { workspace = true }32fp-rpc = { workspace = true }33fp-storage = { workspace = true }3435app-promotion-rpc = { workspace = true }36serde = { workspace = true }37uc-rpc = { workspace = true }38up-common = { workspace = true }39up-data-structs = { workspace = true }40up-pov-estimate-rpc = { workspace = true, default-features = true }41up-rpc = { workspace = true }4243[features]44default = []45pov-estimate = ['uc-rpc/pov-estimate']46std = []
modifiednode/rpc/src/lib.rsdiffbeforeafterboth
--- a/node/rpc/src/lib.rs
+++ b/node/rpc/src/lib.rs
@@ -80,7 +80,7 @@
 	/// EthFilterApi pool.
 	pub filter_pool: Option<FilterPool>,
 
-	#[cfg(feature = "pov-estimate")]
+	/// Runtime identification (read from the chain spec)
 	pub runtime_id: RuntimeId,
 	/// Executor params for PoV estimating
 	#[cfg(feature = "pov-estimate")]
@@ -194,8 +194,7 @@
 		deny_unsafe,
 		filter_pool,
 
-		#[cfg(feature = "pov-estimate")]
-		runtime_id,
+		runtime_id: _,
 
 		#[cfg(feature = "pov-estimate")]
 		exec_params,