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
before · client/rpc/Cargo.toml
1[package]2edition = "2021"3license = "GPLv3"4name = "uc-rpc"5version = "0.1.4"67[dependencies]8anyhow = "1.0.57"9jsonrpsee = { version = "0.16.2", features = ["macros", "server"] }10trie-db = { version = "0.24.0", default-features = false }11zstd = { version = "0.11.2", default-features = false }1213# Note: `package = "parity-scale-codec"` must be supplied since the `Encode` macro searches for it.14codec = { workspace = true, package = "parity-scale-codec" }1516app-promotion-rpc = { workspace = true }17up-common = { workspace = true }18up-data-structs = { workspace = true }19up-pov-estimate-rpc = { workspace = true, optional = true }20up-rpc = { workspace = true }2122pallet-evm = { workspace = true }23sc-client-api = { workspace = true }24sc-rpc-api = { workspace = true }25sc-service = { workspace = true }26sp-api = { workspace = true }27sp-blockchain = { workspace = true }28sp-core = { workspace = true }29sp-externalities = { workspace = true }30sp-keystore = { workspace = true }31sp-runtime = { workspace = true }32sp-state-machine = { workspace = true }33sp-trie = { workspace = true }3435frame-benchmarking = { workspace = true }3637sc-executor = { workspace = true }3839opal-runtime = { workspace = true }40quartz-runtime = { workspace = true, optional = true }41unique-runtime = { workspace = true, optional = true }4243[features]44pov-estimate = [45	'opal-runtime/pov-estimate',46	'quartz-runtime?/pov-estimate',47	'unique-runtime?/pov-estimate',48	'up-pov-estimate-rpc',49]
after · client/rpc/Cargo.toml
1[package]2edition = "2021"3license = "GPLv3"4name = "uc-rpc"5version = "0.1.4"67[dependencies]8anyhow = "1.0.57"9jsonrpsee = { version = "0.16.2", features = ["macros", "server"] }10trie-db = { version = "0.24.0", default-features = false }11zstd = { version = "0.11.2", default-features = false }1213# Note: `package = "parity-scale-codec"` must be supplied since the `Encode` macro searches for it.14codec = { workspace = true, package = "parity-scale-codec" }1516app-promotion-rpc = { workspace = true }17up-common = { workspace = true }18up-data-structs = { workspace = true }19up-pov-estimate-rpc = { workspace = true, optional = true }20up-rpc = { workspace = true }2122pallet-evm = { workspace = true }23sc-client-api = { workspace = true }24sc-rpc-api = { workspace = true }25sc-service = { workspace = true }26sp-api = { workspace = true }27sp-blockchain = { workspace = true }28sp-core = { workspace = true }29sp-externalities = { workspace = true }30sp-keystore = { workspace = true }31sp-runtime = { workspace = true }32sp-state-machine = { workspace = true }33sp-trie = { workspace = true }3435frame-benchmarking = { workspace = true }3637sc-executor = { workspace = true }3839opal-runtime = { workspace = true, optional = true }40quartz-runtime = { workspace = true, optional = true }41unique-runtime = { workspace = true, optional = true }4243[features]44default = ['opal-runtime']45all-runtimes = [46	'opal-runtime',47	'quartz-runtime',48	'unique-runtime',49]50pov-estimate = [51	'opal-runtime/pov-estimate',52	'quartz-runtime?/pov-estimate',53	'unique-runtime?/pov-estimate',54	'up-pov-estimate-rpc',55]
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
--- 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,