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
6868
69use up_common::types::opaque::*;69use up_common::types::opaque::*;
7070
71#[cfg(feature = "pov-estimate")]
72use crate::chain_spec::RuntimeIdentification;71use crate::chain_spec::RuntimeIdentification;
7372
74/// Unique native executor instance.73/// Unique native executor instance.
507 #[cfg(feature = "pov-estimate")]506 #[cfg(feature = "pov-estimate")]
508 let rpc_backend = backend.clone();507 let rpc_backend = backend.clone();
509508
510 #[cfg(feature = "pov-estimate")]
511 let runtime_id = parachain_config.chain_spec.runtime_id();509 let runtime_id = parachain_config.chain_spec.runtime_id();
512510
513 let rpc_builder = Box::new(move |deny_unsafe, subscription_task_executor| {511 let rpc_builder = Box::new(move |deny_unsafe, subscription_task_executor| {
514 let full_deps = unique_rpc::FullDeps {512 let full_deps = unique_rpc::FullDeps {
515 #[cfg(feature = "pov-estimate")]
516 runtime_id: runtime_id.clone(),513 runtime_id: runtime_id.clone(),
517514
518 #[cfg(feature = "pov-estimate")]515 #[cfg(feature = "pov-estimate")]
1040 #[cfg(feature = "pov-estimate")]1037 #[cfg(feature = "pov-estimate")]
1041 let rpc_backend = backend.clone();1038 let rpc_backend = backend.clone();
10421039
1043 #[cfg(feature = "pov-estimate")]
1044 let runtime_id = config.chain_spec.runtime_id();1040 let runtime_id = config.chain_spec.runtime_id();
10451041
1046 let rpc_builder = Box::new(move |deny_unsafe, subscription_executor| {1042 let rpc_builder = Box::new(move |deny_unsafe, subscription_executor| {
1047 let full_deps = unique_rpc::FullDeps {1043 let full_deps = unique_rpc::FullDeps {
1048 #[cfg(feature = "pov-estimate")]
1049 runtime_id: runtime_id.clone(),1044 runtime_id: runtime_id.clone(),
10501045
1051 #[cfg(feature = "pov-estimate")]1046 #[cfg(feature = "pov-estimate")]
modifiednode/rpc/Cargo.tomldiffbeforeafterboth
--- a/node/rpc/Cargo.toml
+++ b/node/rpc/Cargo.toml
@@ -44,4 +44,3 @@
 default = []
 pov-estimate = ['uc-rpc/pov-estimate']
 std = []
-unique-runtime = []
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,