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
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 crate::chain_spec;17use crate::chain_spec;
18use std::{path::PathBuf, env};18use std::path::PathBuf;
19use clap::Parser;19use clap::Parser;
20
21const NODE_NAME_ENV: &str = "UNIQUE_NODE_NAME";
2220
23/// Sub-commands supported by the collator.21/// Sub-commands supported by the collator.
24#[derive(Debug, Parser)]22#[derive(Debug, Parser)]
9997
100impl Cli {98impl Cli {
101 pub fn node_name() -> String {99 pub fn node_name() -> String {
102 match env::var(NODE_NAME_ENV).ok() {
103 Some(name) => name,
104 None => {
105 if cfg!(feature = "unique-runtime") {
106 "Unique"100 "Unique".into()
107 } else if cfg!(feature = "sapphire-runtime") {
108 "Sapphire"
109 } else if cfg!(feature = "quartz-runtime") {
110 "Quartz"
111 } else {
112 "Opal"
113 }
114 }
115 .into(),
116 }
117 }101 }
118}102}
119103
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
--- 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,