git.delta.rocks / unique-network / refs/commits / 5189324f5050

difftreelog

Adjust node and rpc to work with different runtimes

Daniel Shiposha2022-03-14parent: #ea9e87e.patch.diff
in: master

7 files changed

modifiedCargo.lockdiffbeforeafterboth
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -11942,6 +11942,7 @@
  "opal-runtime",
  "pallet-ethereum",
  "pallet-transaction-payment-rpc",
+ "pallet-transaction-payment-rpc-runtime-api",
  "parity-scale-codec",
  "parking_lot 0.11.2",
  "polkadot-cli",
@@ -11988,7 +11989,9 @@
  "substrate-prometheus-endpoint",
  "unique-rpc",
  "unique-runtime",
+ "unique-runtime-common",
  "up-data-structs",
+ "up-rpc",
 ]
 
 [[package]]
@@ -12003,12 +12006,11 @@
  "futures 0.3.21",
  "jsonrpc-core",
  "jsonrpc-pubsub",
- "opal-runtime",
+ "pallet-common",
  "pallet-ethereum",
  "pallet-transaction-payment-rpc",
  "pallet-transaction-payment-rpc-runtime-api",
  "pallet-unique",
- "quartz-runtime",
  "sc-client-api",
  "sc-consensus-aura",
  "sc-consensus-epochs",
@@ -12020,6 +12022,7 @@
  "sc-rpc-api",
  "sc-service",
  "sc-transaction-pool",
+ "serde",
  "sp-api",
  "sp-block-builder",
  "sp-blockchain",
@@ -12034,7 +12037,7 @@
  "substrate-frame-rpc-system",
  "tokio 0.2.25",
  "uc-rpc",
- "unique-runtime",
+ "unique-runtime-common",
  "up-rpc",
 ]
 
@@ -12118,10 +12121,13 @@
 name = "unique-runtime-common"
 version = "0.1.0"
 dependencies = [
+ "fp-rpc",
  "frame-support",
  "frame-system",
+ "pallet-common",
  "parity-scale-codec",
  "scale-info",
+ "sp-consensus-aura",
  "sp-core",
  "sp-runtime",
 ]
modifiednode/cli/Cargo.tomldiffbeforeafterboth
--- a/node/cli/Cargo.toml
+++ b/node/cli/Cargo.toml
@@ -238,6 +238,10 @@
 ################################################################################
 # Local dependencies
 
+[dependencies.unique-runtime-common]
+default-features = false
+path = "../../runtime/common"
+
 [dependencies.unique-runtime]
 path = '../../runtime/unique'
 optional = true
@@ -254,6 +258,13 @@
 path = "../../primitives/data-structs"
 default-features = false
 
+[dependencies.up-rpc]
+path = "../../primitives/rpc"
+
+[dependencies.pallet-transaction-payment-rpc-runtime-api]
+git = 'https://github.com/paritytech/substrate.git'
+branch = 'polkadot-v0.9.17'
+
 ################################################################################
 # Package
 
@@ -295,7 +306,7 @@
 unique-rpc = { default-features = false, path = "../rpc" }
 
 [features]
-default = ["unique-runtime"]
+default = ["unique-runtime", "quartz-runtime", "opal-runtime"]
 runtime-benchmarks = [
     'unique-runtime/runtime-benchmarks',
     'polkadot-service/runtime-benchmarks',
modifiednode/cli/src/chain_spec.rsdiffbeforeafterboth
--- a/node/cli/src/chain_spec.rs
+++ b/node/cli/src/chain_spec.rs
@@ -24,20 +24,33 @@
 use serde::{Deserialize, Serialize};
 use serde_json::map::Map;
 
-#[cfg(feature = "unique-runtime")]
-use unique_runtime as runtime;
+use unique_runtime_common::types::*;
 
-#[cfg(feature = "quartz-runtime")]
-use quartz_runtime as runtime;
+/// Specialized `ChainSpec`. This is a specialization of the general Substrate ChainSpec type.
+pub type ChainSpec = sc_service::GenericChainSpec<unique_runtime::GenesisConfig, Extensions>;
 
-#[cfg(feature = "opal-runtime")]
-use opal_runtime as runtime;
+pub trait RuntimeIdentification {
+	fn is_unique(&self) -> bool;
+
+	fn is_quartz(&self) -> bool;
 
-use runtime::{*, opaque::*};
+	fn is_opal(&self) -> bool;
+}
 
-/// Specialized `ChainSpec`. This is a specialization of the general Substrate ChainSpec type.
-pub type ChainSpec = sc_service::GenericChainSpec<runtime::GenesisConfig, Extensions>;
+impl RuntimeIdentification for Box<dyn sc_service::ChainSpec> {
+	fn is_unique(&self) -> bool {
+		self.id().starts_with("unique")
+	}
 
+	fn is_quartz(&self) -> bool {
+		self.id().starts_with("quartz")
+	}
+
+	fn is_opal(&self) -> bool {
+		self.id().starts_with("opal")
+	}
+}
+
 /// Helper function to generate a crypto pair from seed
 pub fn get_from_seed<TPublic: Public>(seed: &str) -> <TPublic::Pair as Pair>::Public {
 	TPublic::Pair::from_string(&format!("//{}", seed), None)
@@ -225,10 +238,12 @@
 	initial_authorities: Vec<AuraId>,
 	endowed_accounts: Vec<AccountId>,
 	id: ParaId,
-) -> GenesisConfig {
+) -> unique_runtime::GenesisConfig {
+	use unique_runtime::*;
+
 	GenesisConfig {
-		system: runtime::SystemConfig {
-			code: runtime::WASM_BINARY
+		system: SystemConfig {
+			code: WASM_BINARY
 				.expect("WASM binary was not build, please build it!")
 				.to_vec(),
 		},
@@ -245,9 +260,9 @@
 			key: Some(root_key),
 		},
 		vesting: VestingConfig { vesting: vec![] },
-		parachain_info: runtime::ParachainInfoConfig { parachain_id: id },
+		parachain_info: ParachainInfoConfig { parachain_id: id },
 		parachain_system: Default::default(),
-		aura: runtime::AuraConfig {
+		aura: AuraConfig {
 			authorities: initial_authorities,
 		},
 		aura_ext: Default::default(),
modifiednode/cli/src/command.rsdiffbeforeafterboth
--- a/node/cli/src/command.rs
+++ b/node/cli/src/command.rs
@@ -33,10 +33,20 @@
 // limitations under the License.
 
 use crate::{
-	chain_spec,
+	chain_spec::{self, RuntimeIdentification},
 	cli::{Cli, RelayChainCli, Subcommand},
-	service::{new_partial, ParachainRuntimeExecutor},
+	service::new_partial,
 };
+
+#[cfg(feature = "unique-runtime")]
+use crate::service::UniqueRuntimeExecutor;
+
+#[cfg(feature = "quartz-runtime")]
+use crate::service::QuartzRuntimeExecutor;
+
+#[cfg(feature = "opal-runtime")]
+use crate::service::OpalRuntimeExecutor;
+
 use codec::Encode;
 use cumulus_primitives_core::ParaId;
 use cumulus_client_service::genesis::generate_genesis_block;
@@ -53,16 +63,14 @@
 use sp_runtime::traits::Block as BlockT;
 use std::{io::Write, net::SocketAddr};
 
-#[cfg(feature = "unique-runtime")]
-use unique_runtime as runtime;
+use unique_runtime_common::types::Block;
 
-#[cfg(feature = "quartz-runtime")]
-use quartz_runtime as runtime;
-
-#[cfg(feature = "opal-runtime")]
-use opal_runtime as runtime;
-
-use runtime::Block;
+macro_rules! no_runtime_err {
+	($chain_spec:expr) => {
+		format!("No runtime valid runtime was found, chain id: {}",
+			$chain_spec.id())
+	};
+}
 
 fn load_spec(id: &str) -> std::result::Result<Box<dyn sc_service::ChainSpec>, String> {
 	Ok(match id {
@@ -79,7 +87,7 @@
 impl SubstrateCli for Cli {
 	// TODO use args
 	fn impl_name() -> String {
-		format!("{} Node", runtime::RUNTIME_NAME)
+		"Unique Node".into()
 	}
 
 	fn impl_version() -> String {
@@ -88,11 +96,10 @@
 	// TODO use args
 	fn description() -> String {
 		format!(
-			"{} Node\n\nThe command-line arguments provided first will be \
+			"Unique Node\n\nThe command-line arguments provided first will be \
 		passed to the parachain node, while the arguments provided after -- will be passed \
 		to the relaychain node.\n\n\
 		{} [parachain-args] -- [relaychain-args]",
-			runtime::RUNTIME_NAME,
 			Self::executable_name()
 		)
 	}
@@ -114,15 +121,30 @@
 		load_spec(id)
 	}
 
-	fn native_runtime_version(_: &Box<dyn ChainSpec>) -> &'static RuntimeVersion {
-		&runtime::VERSION
+	fn native_runtime_version(chain_spec: &Box<dyn ChainSpec>) -> &'static RuntimeVersion {
+		#[cfg(feature = "unique-runtime")]
+		if chain_spec.is_unique() {
+			return &unique_runtime::VERSION;
+		}
+
+		#[cfg(feature = "quartz-runtime")]
+		if chain_spec.is_quartz() {
+			return &quartz_runtime::VERSION;
+		}
+
+		#[cfg(feature = "opal-runtime")]
+		if chain_spec.is_opal() {
+			return &opal_runtime::VERSION;
+		}
+
+		panic!("{}", no_runtime_err!(chain_spec));
 	}
 }
 
 impl SubstrateCli for RelayChainCli {
 	// TODO use args
 	fn impl_name() -> String {
-		format!("{} Node", runtime::RUNTIME_NAME)
+		"Unique Node".into()
 	}
 
 	fn impl_version() -> String {
@@ -130,13 +152,11 @@
 	}
 	// TODO use args
 	fn description() -> String {
-		format!(
-			"{} Node\n\nThe command-line arguments provided first will be \
+		"Unique Node\n\nThe command-line arguments provided first will be \
 		passed to the parachain node, while the arguments provided after -- will be passed \
 		to the relaychain node.\n\n\
-		parachain-collator [parachain-args] -- [relaychain-args]",
-			runtime::RUNTIME_NAME
-		)
+		parachain-collator [parachain-args] -- [relaychain-args]"
+			.into()
 	}
 
 	fn author() -> String {
@@ -173,16 +193,50 @@
 macro_rules! construct_async_run {
 	(|$components:ident, $cli:ident, $cmd:ident, $config:ident| $( $code:tt )* ) => {{
 		let runner = $cli.create_runner($cmd)?;
-		runner.async_run(|$config| {
-			let $components = new_partial::<
-				_
-			>(
-				&$config,
-				crate::service::parachain_build_import_queue,
-			)?;
-			let task_manager = $components.task_manager;
-			{ $( $code )* }.map(|v| (v, task_manager))
-		})
+
+		#[cfg(feature = "unique-runtime")]
+		if runner.config().chain_spec.is_unique() {
+			return runner.async_run(|$config| {
+				let $components = new_partial::<
+					unique_runtime::RuntimeApi, UniqueRuntimeExecutor, _
+				>(
+					&$config,
+					crate::service::parachain_build_import_queue,
+				)?;
+				let task_manager = $components.task_manager;
+				{ $( $code )* }.map(|v| (v, task_manager))
+			});
+		}
+
+		#[cfg(feature = "quartz-runtime")]
+		if runner.config().chain_spec.is_quartz() {
+			return runner.async_run(|$config| {
+				let $components = new_partial::<
+					quartz_runtime::RuntimeApi, QuartzRuntimeExecutor, _
+				>(
+					&$config,
+					crate::service::parachain_build_import_queue,
+				)?;
+				let task_manager = $components.task_manager;
+				{ $( $code )* }.map(|v| (v, task_manager))
+			});
+		}
+
+		#[cfg(feature = "opal-runtime")]
+		if runner.config().chain_spec.is_opal() {
+			return runner.async_run(|$config| {
+				let $components = new_partial::<
+					opal_runtime::RuntimeApi, OpalRuntimeExecutor, _
+				>(
+					&$config,
+					crate::service::parachain_build_import_queue,
+				)?;
+				let task_manager = $components.task_manager;
+				{ $( $code )* }.map(|v| (v, task_manager))
+			});
+		}
+
+		Err(no_runtime_err!(runner.config().chain_spec).into())
 	}}
 }
 
@@ -286,8 +340,24 @@
 		Some(Subcommand::Benchmark(cmd)) => {
 			if cfg!(feature = "runtime-benchmarks") {
 				let runner = cli.create_runner(cmd)?;
+				runner.sync_run(|config| {
+					#[cfg(feature = "unique-runtime")]
+					if config.chain_spec.is_unique() {
+						return cmd.run::<Block, UniqueRuntimeExecutor>(config);
+					}
+
+					#[cfg(feature = "quartz-runtime")]
+					if config.chain_spec.is_quartz() {
+						return cmd.run::<Block, QuartzRuntimeExecutor>(config);
+					}
+
+					#[cfg(feature = "opal-runtime")]
+					if config.chain_spec.is_opal() {
+						return cmd.run::<Block, OpalRuntimeExecutor>(config);
+					}
 
-				runner.sync_run(|config| cmd.run::<Block, ParachainRuntimeExecutor>(config))
+					Err(no_runtime_err!(config.chain_spec).into())
+				})
 			} else {
 				Err("Benchmarking wasn't enabled when building the node. \
 				You can enable it with `--features runtime-benchmarks`."
@@ -341,10 +411,43 @@
 					}
 				);
 
-				crate::service::start_node(config, polkadot_config, id)
+				#[cfg(feature = "unique-runtime")]
+				if config.chain_spec.is_unique() {
+					return crate::service::start_node::<
+						unique_runtime::Runtime,
+						unique_runtime::RuntimeApi,
+						UniqueRuntimeExecutor,
+					>(config, polkadot_config, id)
 					.await
 					.map(|r| r.0)
-					.map_err(Into::into)
+					.map_err(Into::into);
+				}
+
+				#[cfg(feature = "quartz-runtime")]
+				if config.chain_spec.is_quartz() {
+					return crate::service::start_node::<
+						quartz_runtime::Runtime,
+						quartz_runtime::RuntimeApi,
+						QuartzRuntimeExecutor,
+					>(config, polkadot_config, id)
+					.await
+					.map(|r| r.0)
+					.map_err(Into::into);
+				}
+
+				#[cfg(feature = "opal-runtime")]
+				if config.chain_spec.is_opal() {
+					return crate::service::start_node::<
+						opal_runtime::Runtime,
+						opal_runtime::RuntimeApi,
+						OpalRuntimeExecutor,
+					>(config, polkadot_config, id)
+					.await
+					.map(|r| r.0)
+					.map_err(Into::into);
+				}
+
+				Err(no_runtime_err!(config.chain_spec).into())
 			})
 		}
 	}
modifiednode/cli/src/service.rsdiffbeforeafterboth
--- a/node/cli/src/service.rs
+++ b/node/cli/src/service.rs
@@ -25,17 +25,8 @@
 use futures::StreamExt;
 
 use unique_rpc::overrides_handle;
-// Local Runtime Types
-#[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;
+use serde::{Serialize, Deserialize};
 
 // Cumulus Imports
 use cumulus_client_consensus_aura::{AuraConsensus, BuildAuraConsensusParams, SlotProportion};
@@ -71,18 +62,46 @@
 pub type Block = sp_runtime::generic::Block<Header, sp_runtime::OpaqueExtrinsic>;
 type Hash = sp_core::H256;
 
+use unique_runtime_common::types::{AuraId, RuntimeInstance, AccountId, Balance, Index};
+
 /// Native executor instance.
-pub struct ParachainRuntimeExecutor;
+pub struct UniqueRuntimeExecutor;
+pub struct QuartzRuntimeExecutor;
+pub struct OpalRuntimeExecutor;
+
+impl NativeExecutionDispatch for UniqueRuntimeExecutor {
+	type ExtendHostFunctions = frame_benchmarking::benchmarking::HostFunctions;
+
+	fn dispatch(method: &str, data: &[u8]) -> Option<Vec<u8>> {
+		unique_runtime::api::dispatch(method, data)
+	}
+
+	fn native_version() -> sc_executor::NativeVersion {
+		unique_runtime::native_version()
+	}
+}
+
+impl NativeExecutionDispatch for QuartzRuntimeExecutor {
+	type ExtendHostFunctions = frame_benchmarking::benchmarking::HostFunctions;
 
-impl NativeExecutionDispatch for ParachainRuntimeExecutor {
+	fn dispatch(method: &str, data: &[u8]) -> Option<Vec<u8>> {
+		unique_runtime::api::dispatch(method, data)
+	}
+
+	fn native_version() -> sc_executor::NativeVersion {
+		unique_runtime::native_version()
+	}
+}
+
+impl NativeExecutionDispatch for OpalRuntimeExecutor {
 	type ExtendHostFunctions = frame_benchmarking::benchmarking::HostFunctions;
 
 	fn dispatch(method: &str, data: &[u8]) -> Option<Vec<u8>> {
-		runtime::api::dispatch(method, data)
+		unique_runtime::api::dispatch(method, data)
 	}
 
 	fn native_version() -> sc_executor::NativeVersion {
-		runtime::native_version()
+		unique_runtime::native_version()
 	}
 }
 
@@ -106,9 +125,7 @@
 	)?))
 }
 
-type ExecutorDispatch = ParachainRuntimeExecutor;
-
-type FullClient =
+type FullClient<RuntimeApi, ExecutorDispatch> =
 	sc_service::TFullClient<Block, RuntimeApi, NativeElseWasmExecutor<ExecutorDispatch>>;
 type FullBackend = sc_service::TFullBackend<Block>;
 type FullSelectChain = sc_consensus::LongestChain<FullBackend, Block>;
@@ -118,16 +135,16 @@
 /// Use this macro if you don't actually need the full service, but just the builder in order to
 /// be able to perform chain operations.
 #[allow(clippy::type_complexity)]
-pub fn new_partial<BIQ>(
+pub fn new_partial<RuntimeApi, ExecutorDispatch, BIQ>(
 	config: &Configuration,
 	build_import_queue: BIQ,
 ) -> Result<
 	PartialComponents<
-		FullClient,
+		FullClient<RuntimeApi, ExecutorDispatch>,
 		FullBackend,
 		FullSelectChain,
-		sc_consensus::DefaultImportQueue<Block, FullClient>,
-		sc_transaction_pool::FullPool<Block, FullClient>,
+		sc_consensus::DefaultImportQueue<Block, FullClient<RuntimeApi, ExecutorDispatch>>,
+		sc_transaction_pool::FullPool<Block, FullClient<RuntimeApi, ExecutorDispatch>>,
 		(
 			Option<Telemetry>,
 			Option<FilterPool>,
@@ -140,13 +157,21 @@
 >
 where
 	sc_client_api::StateBackendFor<FullBackend, Block>: sp_api::StateBackend<BlakeTwo256>,
+	RuntimeApi: sp_api::ConstructRuntimeApi<Block, FullClient<RuntimeApi, ExecutorDispatch>>
+		+ Send
+		+ Sync
+		+ 'static,
+	RuntimeApi::RuntimeApi: sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block>,
 	ExecutorDispatch: NativeExecutionDispatch + 'static,
 	BIQ: FnOnce(
-		Arc<FullClient>,
+		Arc<FullClient<RuntimeApi, ExecutorDispatch>>,
 		&Configuration,
 		Option<TelemetryHandle>,
 		&TaskManager,
-	) -> Result<sc_consensus::DefaultImportQueue<Block, FullClient>, sc_service::Error>,
+	) -> Result<
+		sc_consensus::DefaultImportQueue<Block, FullClient<RuntimeApi, ExecutorDispatch>>,
+		sc_service::Error,
+	>,
 {
 	let _telemetry = config
 		.telemetry_endpoints
@@ -240,29 +265,50 @@
 ///
 /// This is the actual implementation that is abstract over the executor and the runtime api.
 #[sc_tracing::logging::prefix_logs_with("Parachain")]
-async fn start_node_impl<BIQ, BIC>(
+async fn start_node_impl<Runtime, RuntimeApi, ExecutorDispatch, BIQ, BIC>(
 	parachain_config: Configuration,
 	polkadot_config: Configuration,
 	id: ParaId,
 	build_import_queue: BIQ,
 	build_consensus: BIC,
-) -> sc_service::error::Result<(TaskManager, Arc<FullClient>)>
+) -> sc_service::error::Result<(TaskManager, Arc<FullClient<RuntimeApi, ExecutorDispatch>>)>
 where
 	sc_client_api::StateBackendFor<FullBackend, Block>: sp_api::StateBackend<BlakeTwo256>,
+	Runtime: RuntimeInstance + Send + Sync + 'static,
+	<Runtime as RuntimeInstance>::CrossAccountId: Serialize,
+	for<'de> <Runtime as RuntimeInstance>::CrossAccountId: Deserialize<'de>,
+	RuntimeApi: sp_api::ConstructRuntimeApi<Block, FullClient<RuntimeApi, ExecutorDispatch>>
+		+ Send
+		+ Sync
+		+ 'static,
+	RuntimeApi::RuntimeApi: sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block>
+		+ fp_rpc::EthereumRuntimeRPCApi<Block>
+		+ sp_session::SessionKeys<Block>
+		+ sp_block_builder::BlockBuilder<Block>
+		+ pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<Block, Balance>
+		+ sp_api::ApiExt<Block, StateBackend = sc_client_api::StateBackendFor<FullBackend, Block>>
+		+ up_rpc::UniqueApi<Block, Runtime::CrossAccountId, AccountId>
+		+ substrate_frame_rpc_system::AccountNonceApi<Block, AccountId, Index>
+		+ sp_api::Metadata<Block>
+		+ sp_offchain::OffchainWorkerApi<Block>
+		+ cumulus_primitives_core::CollectCollationInfo<Block>,
 	ExecutorDispatch: NativeExecutionDispatch + 'static,
 	BIQ: FnOnce(
-		Arc<FullClient>,
+		Arc<FullClient<RuntimeApi, ExecutorDispatch>>,
 		&Configuration,
 		Option<TelemetryHandle>,
 		&TaskManager,
-	) -> Result<sc_consensus::DefaultImportQueue<Block, FullClient>, sc_service::Error>,
+	) -> Result<
+		sc_consensus::DefaultImportQueue<Block, FullClient<RuntimeApi, ExecutorDispatch>>,
+		sc_service::Error,
+	>,
 	BIC: FnOnce(
-		Arc<FullClient>,
+		Arc<FullClient<RuntimeApi, ExecutorDispatch>>,
 		Option<&Registry>,
 		Option<TelemetryHandle>,
 		&TaskManager,
 		Arc<dyn RelayChainInterface>,
-		Arc<sc_transaction_pool::FullPool<Block, FullClient>>,
+		Arc<sc_transaction_pool::FullPool<Block, FullClient<RuntimeApi, ExecutorDispatch>>>,
 		Arc<NetworkService<Block, Hash>>,
 		SyncCryptoStorePtr,
 		bool,
@@ -274,7 +320,8 @@
 
 	let parachain_config = prepare_node_config(parachain_config);
 
-	let params = new_partial::<BIQ>(&parachain_config, build_import_queue)?;
+	let params =
+		new_partial::<RuntimeApi, ExecutorDispatch, BIQ>(&parachain_config, build_import_queue)?;
 	let (mut telemetry, filter_pool, frontier_backend, telemetry_worker_handle, fee_history_cache) =
 		params.other;
 
@@ -320,7 +367,7 @@
 
 	let block_data_cache = Arc::new(fc_rpc::EthBlockDataCache::new(
 		task_manager.spawn_handle(),
-		overrides_handle(client.clone()),
+		overrides_handle::<_, _, Runtime>(client.clone()),
 		50,
 		50,
 	));
@@ -346,10 +393,12 @@
 			fee_history_limit: 2048,
 		};
 
-		Ok(unique_rpc::create_full::<_, _, _, _, RuntimeApi, _>(
-			full_deps,
-			subscription_executor.clone(),
-		))
+		Ok(
+			unique_rpc::create_full::<_, _, _, _, Runtime, RuntimeApi, _>(
+				full_deps,
+				subscription_executor.clone(),
+			),
+		)
 	});
 
 	task_manager.spawn_essential_handle().spawn(
@@ -436,12 +485,26 @@
 }
 
 /// Build the import queue for the the parachain runtime.
-pub fn parachain_build_import_queue(
-	client: Arc<FullClient>,
+pub fn parachain_build_import_queue<RuntimeApi, ExecutorDispatch>(
+	client: Arc<FullClient<RuntimeApi, ExecutorDispatch>>,
 	config: &Configuration,
 	telemetry: Option<TelemetryHandle>,
 	task_manager: &TaskManager,
-) -> Result<sc_consensus::DefaultImportQueue<Block, FullClient>, sc_service::Error> {
+) -> Result<
+	sc_consensus::DefaultImportQueue<Block, FullClient<RuntimeApi, ExecutorDispatch>>,
+	sc_service::Error,
+>
+where
+	RuntimeApi: sp_api::ConstructRuntimeApi<Block, FullClient<RuntimeApi, ExecutorDispatch>>
+		+ Send
+		+ Sync
+		+ 'static,
+	RuntimeApi::RuntimeApi: sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block>
+		+ sp_block_builder::BlockBuilder<Block>
+		+ sp_consensus_aura::AuraApi<Block, AuraId>
+		+ sp_api::ApiExt<Block, StateBackend = sc_client_api::StateBackendFor<FullBackend, Block>>,
+	ExecutorDispatch: NativeExecutionDispatch + 'static,
+{
 	let slot_duration = cumulus_client_consensus_aura::slot_duration(&*client)?;
 
 	cumulus_client_consensus_aura::import_queue::<
@@ -475,12 +538,34 @@
 }
 
 /// Start a normal parachain node.
-pub async fn start_node(
+pub async fn start_node<Runtime, RuntimeApi, ExecutorDispatch>(
 	parachain_config: Configuration,
 	polkadot_config: Configuration,
 	id: ParaId,
-) -> sc_service::error::Result<(TaskManager, Arc<FullClient>)> {
-	start_node_impl::<_, _>(
+) -> sc_service::error::Result<(TaskManager, Arc<FullClient<RuntimeApi, ExecutorDispatch>>)>
+where
+	Runtime: RuntimeInstance + Send + Sync + 'static,
+	<Runtime as RuntimeInstance>::CrossAccountId: Serialize,
+	for<'de> <Runtime as RuntimeInstance>::CrossAccountId: Deserialize<'de>,
+	RuntimeApi: sp_api::ConstructRuntimeApi<Block, FullClient<RuntimeApi, ExecutorDispatch>>
+		+ Send
+		+ Sync
+		+ 'static,
+	RuntimeApi::RuntimeApi: sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block>
+		+ fp_rpc::EthereumRuntimeRPCApi<Block>
+		+ sp_session::SessionKeys<Block>
+		+ sp_block_builder::BlockBuilder<Block>
+		+ pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<Block, Balance>
+		+ sp_api::ApiExt<Block, StateBackend = sc_client_api::StateBackendFor<FullBackend, Block>>
+		+ up_rpc::UniqueApi<Block, Runtime::CrossAccountId, AccountId>
+		+ substrate_frame_rpc_system::AccountNonceApi<Block, AccountId, Index>
+		+ sp_api::Metadata<Block>
+		+ sp_offchain::OffchainWorkerApi<Block>
+		+ cumulus_primitives_core::CollectCollationInfo<Block>
+		+ sp_consensus_aura::AuraApi<Block, AuraId>,
+	ExecutorDispatch: NativeExecutionDispatch + 'static,
+{
+	start_node_impl::<Runtime, RuntimeApi, ExecutorDispatch, _, _>(
 		parachain_config,
 		polkadot_config,
 		id,
modifiednode/rpc/Cargo.tomldiffbeforeafterboth
--- a/node/rpc/Cargo.toml
+++ b/node/rpc/Cargo.toml
@@ -48,13 +48,16 @@
 fc-db = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.17" }
 fc-mapping-sync = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.17" }
 
+pallet-common = { default-features = false, path = "../../pallets/common" }
+unique-runtime-common = { default-features = false, path = "../../runtime/common" }
 pallet-unique = { path = "../../pallets/unique" }
 uc-rpc = { path = "../../client/rpc" }
 up-rpc = { path = "../../primitives/rpc" }
-unique-runtime = { path = "../../runtime/unique", optional = true }
-quartz-runtime = { path = "../../runtime/quartz", optional = true }
-opal-runtime = { path = "../../runtime/opal", optional = true }
 
+[dependencies.serde]
+features = ['derive']
+version = '1.0.130'
+
 [features]
-default = ["unique-runtime"]
+default = []
 std = []
modifiednode/rpc/src/lib.rsdiffbeforeafterboth
before · node/rpc/src/lib.rs
1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617use sp_runtime::traits::BlakeTwo256;18use fc_rpc::{19	EthBlockDataCache, OverrideHandle, RuntimeApiStorageOverride, SchemaV1Override,20	StorageOverride, SchemaV2Override, SchemaV3Override,21};22use fc_rpc_core::types::{FilterPool, FeeHistoryCache};23use jsonrpc_pubsub::manager::SubscriptionManager;24use pallet_ethereum::EthereumStorageSchema;25use sc_client_api::{26	backend::{AuxStore, StorageProvider},27	client::BlockchainEvents,28	StateBackend, Backend,29};30use sc_finality_grandpa::{31	FinalityProofProvider, GrandpaJustificationStream, SharedAuthoritySet, SharedVoterState,32};33use sc_network::NetworkService;34use sc_rpc::SubscriptionTaskExecutor;35pub use sc_rpc_api::DenyUnsafe;36use sc_transaction_pool::{ChainApi, Pool};37use sp_api::ProvideRuntimeApi;38use sp_block_builder::BlockBuilder;39use sp_blockchain::{Error as BlockChainError, HeaderBackend, HeaderMetadata};40use sc_service::TransactionPool;41use std::{collections::BTreeMap, marker::PhantomData, sync::Arc};4243#[cfg(feature = "unique-runtime")]44use unique_runtime as runtime;4546#[cfg(feature = "quartz-runtime")]47use quartz_runtime as runtime;4849#[cfg(feature = "opal-runtime")]50use opal_runtime as runtime;5152use runtime::opaque::{Hash, AccountId, CrossAccountId, Index, Block, BlockNumber, Balance};5354/// Public io handler for exporting into other modules55pub type IoHandler = jsonrpc_core::IoHandler<sc_rpc::Metadata>;5657/// Extra dependencies for GRANDPA58pub struct GrandpaDeps<B> {59	/// Voting round info.60	pub shared_voter_state: SharedVoterState,61	/// Authority set info.62	pub shared_authority_set: SharedAuthoritySet<Hash, BlockNumber>,63	/// Receives notifications about justification events from Grandpa.64	pub justification_stream: GrandpaJustificationStream<Block>,65	/// Executor to drive the subscription manager in the Grandpa RPC handler.66	pub subscription_executor: SubscriptionTaskExecutor,67	/// Finality proof provider.68	pub finality_provider: Arc<FinalityProofProvider<B, Block>>,69}7071/// Full client dependencies.72pub struct FullDeps<C, P, SC, CA: ChainApi> {73	/// The client instance to use.74	pub client: Arc<C>,75	/// Transaction pool instance.76	pub pool: Arc<P>,77	/// Graph pool instance.78	pub graph: Arc<Pool<CA>>,79	/// The SelectChain Strategy80	pub select_chain: SC,81	/// The Node authority flag82	pub is_authority: bool,83	/// Whether to enable dev signer84	pub enable_dev_signer: bool,85	/// Network service86	pub network: Arc<NetworkService<Block, Hash>>,87	/// Whether to deny unsafe calls88	pub deny_unsafe: DenyUnsafe,89	/// EthFilterApi pool.90	pub filter_pool: Option<FilterPool>,91	/// Backend.92	pub backend: Arc<fc_db::Backend<Block>>,93	/// Maximum number of logs in a query.94	pub max_past_logs: u32,95	/// Maximum fee history cache size.96	pub fee_history_limit: u64,97	/// Fee history cache.98	pub fee_history_cache: FeeHistoryCache,99	/// Cache for Ethereum block data.100	pub block_data_cache: Arc<EthBlockDataCache<Block>>,101}102103struct AccountCodes<C, B> {104	client: Arc<C>,105	_marker: PhantomData<B>,106}107108impl<C, Block> AccountCodes<C, Block>109where110	Block: sp_api::BlockT,111	C: ProvideRuntimeApi<Block>,112{113	fn new(client: Arc<C>) -> Self {114		Self {115			client,116			_marker: PhantomData,117		}118	}119}120121impl<C, Block> fc_rpc::AccountCodeProvider<Block> for AccountCodes<C, Block>122where123	Block: sp_api::BlockT,124	C: ProvideRuntimeApi<Block>,125	C::Api: up_rpc::UniqueApi<Block, CrossAccountId, AccountId>,126{127	fn code(&self, block: &sp_api::BlockId<Block>, account: sp_core::H160) -> Option<Vec<u8>> {128		use up_rpc::UniqueApi;129		self.client130			.runtime_api()131			.eth_contract_code(block, account)132			.ok()133			.flatten()134	}135}136137pub fn overrides_handle<C, BE>(client: Arc<C>) -> Arc<OverrideHandle<Block>>138where139	C: ProvideRuntimeApi<Block> + StorageProvider<Block, BE> + AuxStore,140	C: HeaderBackend<Block> + HeaderMetadata<Block, Error = BlockChainError>,141	C: Send + Sync + 'static,142	C::Api: fp_rpc::EthereumRuntimeRPCApi<Block>,143	C::Api: up_rpc::UniqueApi<Block, CrossAccountId, AccountId>,144	BE: Backend<Block> + 'static,145	BE::State: StateBackend<BlakeTwo256>,146{147	let mut overrides_map = BTreeMap::new();148	overrides_map.insert(149		EthereumStorageSchema::V1,150		Box::new(SchemaV1Override::new_with_code_provider(151			client.clone(),152			Arc::new(AccountCodes::<C, Block>::new(client.clone())),153		)) as Box<dyn StorageOverride<_> + Send + Sync>,154	);155	overrides_map.insert(156		EthereumStorageSchema::V2,157		Box::new(SchemaV2Override::new(client.clone()))158			as Box<dyn StorageOverride<_> + Send + Sync>,159	);160	overrides_map.insert(161		EthereumStorageSchema::V3,162		Box::new(SchemaV3Override::new(client.clone()))163			as Box<dyn StorageOverride<_> + Send + Sync>,164	);165166	Arc::new(OverrideHandle {167		schemas: overrides_map,168		fallback: Box::new(RuntimeApiStorageOverride::new(client)),169	})170}171172/// Instantiate all Full RPC extensions.173pub fn create_full<C, P, SC, CA, A, B>(174	deps: FullDeps<C, P, SC, CA>,175	subscription_task_executor: SubscriptionTaskExecutor,176) -> jsonrpc_core::IoHandler<sc_rpc_api::Metadata>177where178	C: ProvideRuntimeApi<Block> + StorageProvider<Block, B> + AuxStore,179	C: HeaderBackend<Block> + HeaderMetadata<Block, Error = BlockChainError> + 'static,180	C: Send + Sync + 'static,181	C: BlockchainEvents<Block>,182	C::Api: substrate_frame_rpc_system::AccountNonceApi<Block, AccountId, Index>,183	C::Api: BlockBuilder<Block>,184	// C::Api: pallet_contracts_rpc::ContractsRuntimeApi<Block, AccountId, Balance, BlockNumber, Hash>,185	C::Api: pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi<Block, Balance>,186	C::Api: fp_rpc::EthereumRuntimeRPCApi<Block>,187	C::Api: up_rpc::UniqueApi<Block, CrossAccountId, AccountId>,188	B: sc_client_api::Backend<Block> + Send + Sync + 'static,189	B::State: sc_client_api::backend::StateBackend<sp_runtime::traits::HashFor<Block>>,190	P: TransactionPool<Block = Block> + 'static,191	CA: ChainApi<Block = Block> + 'static,192{193	use fc_rpc::{194		EthApi, EthApiServer, EthDevSigner, EthFilterApi, EthFilterApiServer, EthPubSubApi,195		EthPubSubApiServer, EthSigner, HexEncodedIdProvider, NetApi, NetApiServer, Web3Api,196		Web3ApiServer,197	};198	use uc_rpc::{UniqueApi, Unique};199	// use pallet_contracts_rpc::{Contracts, ContractsApi};200	use pallet_transaction_payment_rpc::{TransactionPayment, TransactionPaymentApi};201	use substrate_frame_rpc_system::{FullSystem, SystemApi};202203	let mut io = jsonrpc_core::IoHandler::default();204	let FullDeps {205		client,206		pool,207		graph,208		select_chain: _,209		fee_history_limit,210		fee_history_cache,211		block_data_cache,212		enable_dev_signer,213		is_authority,214		network,215		deny_unsafe,216		filter_pool,217		backend,218		max_past_logs,219	} = deps;220221	io.extend_with(SystemApi::to_delegate(FullSystem::new(222		client.clone(),223		pool.clone(),224		deny_unsafe,225	)));226227	io.extend_with(TransactionPaymentApi::to_delegate(TransactionPayment::new(228		client.clone(),229	)));230231	// io.extend_with(ContractsApi::to_delegate(Contracts::new(client.clone())));232233	let mut signers = Vec::new();234	if enable_dev_signer {235		signers.push(Box::new(EthDevSigner::new()) as Box<dyn EthSigner>);236	}237238	let overrides = overrides_handle(client.clone());239240	io.extend_with(EthApiServer::to_delegate(EthApi::new(241		client.clone(),242		pool.clone(),243		graph,244		runtime::TransactionConverter,245		network.clone(),246		signers,247		overrides.clone(),248		backend.clone(),249		is_authority,250		max_past_logs,251		block_data_cache.clone(),252		fee_history_limit,253		fee_history_cache,254	)));255	io.extend_with(UniqueApi::to_delegate(Unique::new(client.clone())));256257	if let Some(filter_pool) = filter_pool {258		io.extend_with(EthFilterApiServer::to_delegate(EthFilterApi::new(259			client.clone(),260			backend,261			filter_pool,262			500_usize, // max stored filters263			max_past_logs,264			block_data_cache,265		)));266	}267268	io.extend_with(NetApiServer::to_delegate(NetApi::new(269		client.clone(),270		network.clone(),271		// Whether to format the `peer_count` response as Hex (default) or not.272		true,273	)));274275	io.extend_with(Web3ApiServer::to_delegate(Web3Api::new(client.clone())));276277	io.extend_with(EthPubSubApiServer::to_delegate(EthPubSubApi::new(278		pool,279		client,280		network,281		SubscriptionManager::<HexEncodedIdProvider>::with_id_provider(282			HexEncodedIdProvider::default(),283			Arc::new(subscription_task_executor),284		),285		overrides,286	)));287288	io289}
after · node/rpc/src/lib.rs
1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617use sp_runtime::traits::BlakeTwo256;18use fc_rpc::{19	EthBlockDataCache, OverrideHandle, RuntimeApiStorageOverride, SchemaV1Override,20	StorageOverride, SchemaV2Override, SchemaV3Override,21};22use fc_rpc_core::types::{FilterPool, FeeHistoryCache};23use jsonrpc_pubsub::manager::SubscriptionManager;24use pallet_ethereum::EthereumStorageSchema;25use sc_client_api::{26	backend::{AuxStore, StorageProvider},27	client::BlockchainEvents,28	StateBackend, Backend,29};30use sc_finality_grandpa::{31	FinalityProofProvider, GrandpaJustificationStream, SharedAuthoritySet, SharedVoterState,32};33use sc_network::NetworkService;34use sc_rpc::SubscriptionTaskExecutor;35pub use sc_rpc_api::DenyUnsafe;36use sc_transaction_pool::{ChainApi, Pool};37use sp_api::ProvideRuntimeApi;38use sp_block_builder::BlockBuilder;39use sp_blockchain::{Error as BlockChainError, HeaderBackend, HeaderMetadata};40use sc_service::TransactionPool;41use std::{collections::BTreeMap, marker::PhantomData, sync::Arc};4243use unique_runtime_common::types::{44	Hash, AccountId, RuntimeInstance, Index, Block, BlockNumber, Balance,45};4647/// Public io handler for exporting into other modules48pub type IoHandler = jsonrpc_core::IoHandler<sc_rpc::Metadata>;4950/// Extra dependencies for GRANDPA51pub struct GrandpaDeps<B> {52	/// Voting round info.53	pub shared_voter_state: SharedVoterState,54	/// Authority set info.55	pub shared_authority_set: SharedAuthoritySet<Hash, BlockNumber>,56	/// Receives notifications about justification events from Grandpa.57	pub justification_stream: GrandpaJustificationStream<Block>,58	/// Executor to drive the subscription manager in the Grandpa RPC handler.59	pub subscription_executor: SubscriptionTaskExecutor,60	/// Finality proof provider.61	pub finality_provider: Arc<FinalityProofProvider<B, Block>>,62}6364/// Full client dependencies.65pub struct FullDeps<C, P, SC, CA: ChainApi> {66	/// The client instance to use.67	pub client: Arc<C>,68	/// Transaction pool instance.69	pub pool: Arc<P>,70	/// Graph pool instance.71	pub graph: Arc<Pool<CA>>,72	/// The SelectChain Strategy73	pub select_chain: SC,74	/// The Node authority flag75	pub is_authority: bool,76	/// Whether to enable dev signer77	pub enable_dev_signer: bool,78	/// Network service79	pub network: Arc<NetworkService<Block, Hash>>,80	/// Whether to deny unsafe calls81	pub deny_unsafe: DenyUnsafe,82	/// EthFilterApi pool.83	pub filter_pool: Option<FilterPool>,84	/// Backend.85	pub backend: Arc<fc_db::Backend<Block>>,86	/// Maximum number of logs in a query.87	pub max_past_logs: u32,88	/// Maximum fee history cache size.89	pub fee_history_limit: u64,90	/// Fee history cache.91	pub fee_history_cache: FeeHistoryCache,92	/// Cache for Ethereum block data.93	pub block_data_cache: Arc<EthBlockDataCache<Block>>,94}9596struct AccountCodes<C, B, R> {97	client: Arc<C>,98	_blk_marker: PhantomData<B>,99	_runtime_marker: PhantomData<R>,100}101102impl<C, Block, R> AccountCodes<C, Block, R>103where104	Block: sp_api::BlockT,105	C: ProvideRuntimeApi<Block>,106	R: RuntimeInstance,107{108	fn new(client: Arc<C>) -> Self {109		Self {110			client,111			_blk_marker: PhantomData,112			_runtime_marker: PhantomData,113		}114	}115}116117impl<C, Block, Runtime> fc_rpc::AccountCodeProvider<Block> for AccountCodes<C, Block, Runtime>118where119	Block: sp_api::BlockT,120	C: ProvideRuntimeApi<Block>,121	C::Api: up_rpc::UniqueApi<Block, <Runtime as RuntimeInstance>::CrossAccountId, AccountId>,122	Runtime: RuntimeInstance,123{124	fn code(&self, block: &sp_api::BlockId<Block>, account: sp_core::H160) -> Option<Vec<u8>> {125		use up_rpc::UniqueApi;126		self.client127			.runtime_api()128			.eth_contract_code(block, account)129			.ok()130			.flatten()131	}132}133134pub fn overrides_handle<C, BE, R>(client: Arc<C>) -> Arc<OverrideHandle<Block>>135where136	C: ProvideRuntimeApi<Block> + StorageProvider<Block, BE> + AuxStore,137	C: HeaderBackend<Block> + HeaderMetadata<Block, Error = BlockChainError>,138	C: Send + Sync + 'static,139	C::Api: fp_rpc::EthereumRuntimeRPCApi<Block>,140	C::Api: up_rpc::UniqueApi<Block, <R as RuntimeInstance>::CrossAccountId, AccountId>,141	BE: Backend<Block> + 'static,142	BE::State: StateBackend<BlakeTwo256>,143	R: RuntimeInstance + Send + Sync + 'static,144{145	let mut overrides_map = BTreeMap::new();146	overrides_map.insert(147		EthereumStorageSchema::V1,148		Box::new(SchemaV1Override::new_with_code_provider(149			client.clone(),150			Arc::new(AccountCodes::<C, Block, R>::new(client.clone())),151		)) as Box<dyn StorageOverride<_> + Send + Sync>,152	);153	overrides_map.insert(154		EthereumStorageSchema::V2,155		Box::new(SchemaV2Override::new(client.clone()))156			as Box<dyn StorageOverride<_> + Send + Sync>,157	);158	overrides_map.insert(159		EthereumStorageSchema::V3,160		Box::new(SchemaV3Override::new(client.clone()))161			as Box<dyn StorageOverride<_> + Send + Sync>,162	);163164	Arc::new(OverrideHandle {165		schemas: overrides_map,166		fallback: Box::new(RuntimeApiStorageOverride::new(client)),167	})168}169170/// Instantiate all Full RPC extensions.171pub fn create_full<C, P, SC, CA, R, A, B>(172	deps: FullDeps<C, P, SC, CA>,173	subscription_task_executor: SubscriptionTaskExecutor,174) -> jsonrpc_core::IoHandler<sc_rpc_api::Metadata>175where176	C: ProvideRuntimeApi<Block> + StorageProvider<Block, B> + AuxStore,177	C: HeaderBackend<Block> + HeaderMetadata<Block, Error = BlockChainError> + 'static,178	C: Send + Sync + 'static,179	C: BlockchainEvents<Block>,180	C::Api: substrate_frame_rpc_system::AccountNonceApi<Block, AccountId, Index>,181	C::Api: BlockBuilder<Block>,182	// C::Api: pallet_contracts_rpc::ContractsRuntimeApi<Block, AccountId, Balance, BlockNumber, Hash>,183	C::Api: pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi<Block, Balance>,184	C::Api: fp_rpc::EthereumRuntimeRPCApi<Block>,185	C::Api: up_rpc::UniqueApi<Block, <R as RuntimeInstance>::CrossAccountId, AccountId>,186	B: sc_client_api::Backend<Block> + Send + Sync + 'static,187	B::State: sc_client_api::backend::StateBackend<sp_runtime::traits::HashFor<Block>>,188	P: TransactionPool<Block = Block> + 'static,189	CA: ChainApi<Block = Block> + 'static,190	R: RuntimeInstance + Send + Sync + 'static,191	<R as RuntimeInstance>::CrossAccountId: serde::Serialize,192	for<'de> <R as RuntimeInstance>::CrossAccountId: serde::Deserialize<'de>,193{194	use fc_rpc::{195		EthApi, EthApiServer, EthDevSigner, EthFilterApi, EthFilterApiServer, EthPubSubApi,196		EthPubSubApiServer, EthSigner, HexEncodedIdProvider, NetApi, NetApiServer, Web3Api,197		Web3ApiServer,198	};199	use uc_rpc::{UniqueApi, Unique};200	// use pallet_contracts_rpc::{Contracts, ContractsApi};201	use pallet_transaction_payment_rpc::{TransactionPayment, TransactionPaymentApi};202	use substrate_frame_rpc_system::{FullSystem, SystemApi};203204	let mut io = jsonrpc_core::IoHandler::default();205	let FullDeps {206		client,207		pool,208		graph,209		select_chain: _,210		fee_history_limit,211		fee_history_cache,212		block_data_cache,213		enable_dev_signer,214		is_authority,215		network,216		deny_unsafe,217		filter_pool,218		backend,219		max_past_logs,220	} = deps;221222	io.extend_with(SystemApi::to_delegate(FullSystem::new(223		client.clone(),224		pool.clone(),225		deny_unsafe,226	)));227228	io.extend_with(TransactionPaymentApi::to_delegate(TransactionPayment::new(229		client.clone(),230	)));231232	// io.extend_with(ContractsApi::to_delegate(Contracts::new(client.clone())));233234	let mut signers = Vec::new();235	if enable_dev_signer {236		signers.push(Box::new(EthDevSigner::new()) as Box<dyn EthSigner>);237	}238239	let overrides = overrides_handle::<_, _, R>(client.clone());240241	io.extend_with(EthApiServer::to_delegate(EthApi::new(242		client.clone(),243		pool.clone(),244		graph,245		<R as RuntimeInstance>::get_transaction_converter(),246		network.clone(),247		signers,248		overrides.clone(),249		backend.clone(),250		is_authority,251		max_past_logs,252		block_data_cache.clone(),253		fee_history_limit,254		fee_history_cache,255	)));256	io.extend_with(UniqueApi::to_delegate(Unique::new(client.clone())));257258	if let Some(filter_pool) = filter_pool {259		io.extend_with(EthFilterApiServer::to_delegate(EthFilterApi::new(260			client.clone(),261			backend,262			filter_pool,263			500_usize, // max stored filters264			max_past_logs,265			block_data_cache,266		)));267	}268269	io.extend_with(NetApiServer::to_delegate(NetApi::new(270		client.clone(),271		network.clone(),272		// Whether to format the `peer_count` response as Hex (default) or not.273		true,274	)));275276	io.extend_with(Web3ApiServer::to_delegate(Web3Api::new(client.clone())));277278	io.extend_with(EthPubSubApiServer::to_delegate(EthPubSubApi::new(279		pool,280		client,281		network,282		SubscriptionManager::<HexEncodedIdProvider>::with_id_provider(283			HexEncodedIdProvider::default(),284			Arc::new(subscription_task_executor),285		),286		overrides,287	)));288289	io290}