Unverified Commit 5679bc89 authored by Bastian Köcher's avatar Bastian Köcher Committed by GitHub
Browse files

Fix transaction payment runtime api companion (#1519)

* Fix transaction payment runtime api companion

Companion for Substrate pr: https://github.com/paritytech/substrate/pull/6792

* 'Update substrate'

Co-authored-by: parity-processbot <>
parent 1e11614a
Pipeline #102480 passed with stages
in 22 minutes and 29 seconds
This diff is collapsed.
......@@ -153,7 +153,6 @@ pub fn run() -> Result<()> {
service::new_chain_ops::<
service::kusama_runtime::RuntimeApi,
service::KusamaExecutor,
service::kusama_runtime::UncheckedExtrinsic,
>(config)
)
} else if chain_spec.is_westend() {
......@@ -161,7 +160,6 @@ pub fn run() -> Result<()> {
service::new_chain_ops::<
service::westend_runtime::RuntimeApi,
service::WestendExecutor,
service::westend_runtime::UncheckedExtrinsic,
>(config)
)
} else {
......@@ -169,7 +167,6 @@ pub fn run() -> Result<()> {
service::new_chain_ops::<
service::polkadot_runtime::RuntimeApi,
service::PolkadotExecutor,
service::polkadot_runtime::UncheckedExtrinsic,
>(config)
)
}
......
......@@ -121,7 +121,7 @@ pub trait BuildParachainContext {
type ParachainContext: self::ParachainContext;
/// Build the `ParachainContext`.
fn build<Client, SP, Extrinsic>(
fn build<Client, SP>(
self,
client: Arc<Client>,
spawner: SP,
......@@ -129,9 +129,8 @@ pub trait BuildParachainContext {
) -> Result<Self::ParachainContext, ()>
where
Client: ProvideRuntimeApi<Block> + HeaderBackend<Block> + BlockchainEvents<Block> + Send + Sync + 'static,
Client::Api: RuntimeApiCollection<Extrinsic>,
Client::Api: RuntimeApiCollection,
<Client::Api as ApiExt<Block>>::StateBackend: StateBackend<HashFor<Block>>,
Extrinsic: codec::Codec + Send + Sync + 'static,
SP: SpawnNamed + Clone + Send + Sync + 'static;
}
......@@ -203,7 +202,7 @@ pub async fn collate<P>(
}
#[cfg(feature = "service-rewr")]
fn build_collator_service<SP, P, C, R, Extrinsic>(
fn build_collator_service<SP, P, C, R>(
_spawner: SP,
_handles: FullNodeHandles,
_client: Arc<C>,
......@@ -224,14 +223,12 @@ fn build_collator_service<SP, P, C, R, Extrinsic>(
StateBackend = <service::TFullBackend<service::Block> as service::Backend<service::Block>>::State,
>
+ RuntimeApiCollection<
Extrinsic,
StateBackend = <service::TFullBackend<service::Block> as service::Backend<service::Block>>::State,
>
+ Sync + Send,
P: BuildParachainContext,
P::ParachainContext: Send + 'static,
<P::ParachainContext as ParachainContext>::ProduceCandidate: Send,
Extrinsic: service::Codec + Send + Sync + 'static,
SP: SpawnNamed + Clone + Send + Sync + 'static,
{
Err("Collator is not functional with the new service yet".into())
......@@ -239,7 +236,7 @@ fn build_collator_service<SP, P, C, R, Extrinsic>(
#[cfg(not(feature = "service-rewr"))]
fn build_collator_service<P, C, R, Extrinsic>(
fn build_collator_service<P, C, R>(
spawner: SpawnTaskHandle,
handles: FullNodeHandles,
client: Arc<C>,
......@@ -260,14 +257,12 @@ fn build_collator_service<P, C, R, Extrinsic>(
StateBackend = <service::TFullBackend<service::Block> as service::Backend<service::Block>>::State,
>
+ RuntimeApiCollection<
Extrinsic,
StateBackend = <service::TFullBackend<service::Block> as service::Backend<service::Block>>::State,
>
+ Sync + Send,
P: BuildParachainContext,
P::ParachainContext: Send + 'static,
<P::ParachainContext as ParachainContext>::ProduceCandidate: Send,
Extrinsic: service::Codec + Send + Sync + 'static,
{
let polkadot_network = handles.polkadot_network
.ok_or_else(|| "Collator cannot run when Polkadot-specific networking has not been started")?;
......@@ -497,7 +492,7 @@ mod tests {
impl BuildParachainContext for BuildDummyParachainContext {
type ParachainContext = DummyParachainContext;
fn build<C, SP, Extrinsic>(
fn build<C, SP>(
self,
_: Arc<C>,
_: SP,
......
......@@ -78,24 +78,23 @@ native_executor_instance!(
);
/// A set of APIs that polkadot-like runtimes must implement.
pub trait RuntimeApiCollection<Extrinsic: codec::Codec + Send + Sync + 'static>:
pub trait RuntimeApiCollection:
sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block>
+ sp_api::ApiExt<Block, Error = sp_blockchain::Error>
+ babe_primitives::BabeApi<Block>
+ grandpa_primitives::GrandpaApi<Block>
+ sp_block_builder::BlockBuilder<Block>
+ system_rpc_runtime_api::AccountNonceApi<Block, AccountId, Nonce>
+ pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<Block, Balance, Extrinsic>
+ pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<Block, Balance>
+ sp_api::Metadata<Block>
+ sp_offchain::OffchainWorkerApi<Block>
+ sp_session::SessionKeys<Block>
+ authority_discovery_primitives::AuthorityDiscoveryApi<Block>
where
Extrinsic: RuntimeExtrinsic,
<Self as sp_api::ApiExt<Block>>::StateBackend: sp_api::StateBackend<HashFor<Block>>,
{}
impl<Api, Extrinsic> RuntimeApiCollection<Extrinsic> for Api
impl<Api> RuntimeApiCollection for Api
where
Api:
sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block>
......@@ -104,19 +103,14 @@ where
+ grandpa_primitives::GrandpaApi<Block>
+ sp_block_builder::BlockBuilder<Block>
+ system_rpc_runtime_api::AccountNonceApi<Block, AccountId, Nonce>
+ pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<Block, Balance, Extrinsic>
+ pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<Block, Balance>
+ sp_api::Metadata<Block>
+ sp_offchain::OffchainWorkerApi<Block>
+ sp_session::SessionKeys<Block>
+ authority_discovery_primitives::AuthorityDiscoveryApi<Block>,
Extrinsic: RuntimeExtrinsic,
<Self as sp_api::ApiExt<Block>>::StateBackend: sp_api::StateBackend<HashFor<Block>>,
{}
pub trait RuntimeExtrinsic: codec::Codec + Send + Sync + 'static {}
impl<E> RuntimeExtrinsic for E where E: codec::Codec + Send + Sync + 'static {}
/// Can be called for a `Configuration` to check if it is a configuration for the `Kusama` network.
pub trait IdentifyVariant {
/// Returns if this is a configuration for the `Kusama` network.
......@@ -157,7 +151,7 @@ type LightClient<RuntimeApi, Executor> =
service::TLightClientWithBackend<Block, RuntimeApi, Executor, LightBackend>;
#[cfg(feature = "full-node")]
fn new_partial<RuntimeApi, Executor, Extrinsic>(config: &mut Configuration) -> Result<
fn new_partial<RuntimeApi, Executor>(config: &mut Configuration) -> Result<
service::PartialComponents<
FullClient<RuntimeApi, Executor>, FullBackend, FullSelectChain,
consensus_common::DefaultImportQueue<Block, FullClient<RuntimeApi, Executor>>,
......@@ -179,9 +173,8 @@ fn new_partial<RuntimeApi, Executor, Extrinsic>(config: &mut Configuration) -> R
where
RuntimeApi: ConstructRuntimeApi<Block, FullClient<RuntimeApi, Executor>> + Send + Sync + 'static,
RuntimeApi::RuntimeApi:
RuntimeApiCollection<Extrinsic, StateBackend = sc_client_api::StateBackendFor<FullBackend, Block>>,
RuntimeApiCollection<StateBackend = sc_client_api::StateBackendFor<FullBackend, Block>>,
Executor: NativeExecutionDispatch + 'static,
Extrinsic: RuntimeExtrinsic,
{
set_prometheus_registry(config)?;
......@@ -303,7 +296,7 @@ fn real_overseer<S: SpawnNamed>(
}
#[cfg(feature = "full-node")]
fn new_full<RuntimeApi, Executor, Extrinsic>(
fn new_full<RuntimeApi, Executor>(
mut config: Configuration,
collating_for: Option<(CollatorId, ParaId)>,
_max_block_data_size: Option<u64>,
......@@ -317,9 +310,8 @@ fn new_full<RuntimeApi, Executor, Extrinsic>(
where
RuntimeApi: ConstructRuntimeApi<Block, FullClient<RuntimeApi, Executor>> + Send + Sync + 'static,
RuntimeApi::RuntimeApi:
RuntimeApiCollection<Extrinsic, StateBackend = sc_client_api::StateBackendFor<FullBackend, Block>>,
RuntimeApiCollection<StateBackend = sc_client_api::StateBackendFor<FullBackend, Block>>,
Executor: NativeExecutionDispatch + 'static,
Extrinsic: RuntimeExtrinsic,
{
use sc_client_api::ExecutorProvider;
use sp_core::traits::BareCryptoStorePtr;
......@@ -335,8 +327,8 @@ fn new_full<RuntimeApi, Executor, Extrinsic>(
client, backend, mut task_manager, keystore, select_chain, import_queue, transaction_pool,
inherent_data_providers,
other: (rpc_extensions_builder, import_setup, rpc_setup)
} = new_partial::<RuntimeApi, Executor, Extrinsic>(&mut config)?;
} = new_partial::<RuntimeApi, Executor>(&mut config)?;
let prometheus_registry = config.prometheus_registry().cloned();
let finality_proof_provider =
......@@ -525,13 +517,12 @@ fn new_full<RuntimeApi, Executor, Extrinsic>(
pub struct FullNodeHandles;
/// Builds a new service for a light client.
fn new_light<Runtime, Dispatch, Extrinsic>(mut config: Configuration) -> Result<TaskManager, Error>
fn new_light<Runtime, Dispatch>(mut config: Configuration) -> Result<TaskManager, Error>
where
Runtime: 'static + Send + Sync + ConstructRuntimeApi<Block, LightClient<Runtime, Dispatch>>,
<Runtime as ConstructRuntimeApi<Block, LightClient<Runtime, Dispatch>>>::RuntimeApi:
RuntimeApiCollection<Extrinsic, StateBackend = sc_client_api::StateBackendFor<LightBackend, Block>>,
RuntimeApiCollection<StateBackend = sc_client_api::StateBackendFor<LightBackend, Block>>,
Dispatch: NativeExecutionDispatch + 'static,
Extrinsic: RuntimeExtrinsic,
{
crate::set_prometheus_registry(&mut config)?;
use sc_client_api::backend::RemoteBackend;
......@@ -594,7 +585,7 @@ fn new_light<Runtime, Dispatch, Extrinsic>(mut config: Configuration) -> Result<
finality_proof_request_builder: Some(finality_proof_request_builder),
finality_proof_provider: Some(finality_proof_provider),
})?;
if config.offchain_worker.enabled {
service::build_offchain_workers(
&config, backend.clone(), task_manager.spawn_handle(), client.clone(), network.clone(),
......@@ -610,7 +601,7 @@ fn new_light<Runtime, Dispatch, Extrinsic>(mut config: Configuration) -> Result<
let rpc_extensions = polkadot_rpc::create_light(light_deps);
service::spawn_tasks(service::SpawnTasksParams {
service::spawn_tasks(service::SpawnTasksParams {
on_demand: Some(on_demand),
remote_blockchain: Some(backend.remote_blockchain()),
rpc_extensions_builder: Box::new(service::NoopRpcExtensionBuilder(rpc_extensions)),
......@@ -619,13 +610,13 @@ fn new_light<Runtime, Dispatch, Extrinsic>(mut config: Configuration) -> Result<
config, keystore, backend, transaction_pool, client, network, network_status_sinks,
system_rpc_tx,
})?;
Ok(task_manager)
}
/// Builds a new object suitable for chain operations.
#[cfg(feature = "full-node")]
pub fn new_chain_ops<Runtime, Dispatch, Extrinsic>(mut config: Configuration) -> Result<
pub fn new_chain_ops<Runtime, Dispatch>(mut config: Configuration) -> Result<
(
Arc<FullClient<Runtime, Dispatch>>,
Arc<FullBackend>,
......@@ -637,13 +628,12 @@ pub fn new_chain_ops<Runtime, Dispatch, Extrinsic>(mut config: Configuration) ->
where
Runtime: ConstructRuntimeApi<Block, FullClient<Runtime, Dispatch>> + Send + Sync + 'static,
Runtime::RuntimeApi:
RuntimeApiCollection<Extrinsic, StateBackend = sc_client_api::StateBackendFor<FullBackend, Block>>,
RuntimeApiCollection<StateBackend = sc_client_api::StateBackendFor<FullBackend, Block>>,
Dispatch: NativeExecutionDispatch + 'static,
Extrinsic: RuntimeExtrinsic,
{
config.keystore = service::config::KeystoreConfig::InMemory;
let service::PartialComponents { client, backend, import_queue, task_manager, .. }
= new_partial::<Runtime, Dispatch, Extrinsic>(&mut config)?;
= new_partial::<Runtime, Dispatch>(&mut config)?;
Ok((client, backend, import_queue, task_manager))
}
......@@ -667,7 +657,7 @@ pub fn polkadot_new_full(
FullNodeHandles,
), ServiceError>
{
let (components, client) = new_full::<polkadot_runtime::RuntimeApi, PolkadotExecutor, _>(
let (components, client) = new_full::<polkadot_runtime::RuntimeApi, PolkadotExecutor>(
config,
collating_for,
max_block_data_size,
......@@ -699,7 +689,7 @@ pub fn kusama_new_full(
FullNodeHandles,
), ServiceError>
{
let (components, client) = new_full::<kusama_runtime::RuntimeApi, KusamaExecutor, _>(
let (components, client) = new_full::<kusama_runtime::RuntimeApi, KusamaExecutor>(
config,
collating_for,
max_block_data_size,
......@@ -731,7 +721,7 @@ pub fn westend_new_full(
FullNodeHandles,
), ServiceError>
{
let (components, client) = new_full::<westend_runtime::RuntimeApi, WestendExecutor, _>(
let (components, client) = new_full::<westend_runtime::RuntimeApi, WestendExecutor>(
config,
collating_for,
max_block_data_size,
......@@ -746,17 +736,17 @@ pub fn westend_new_full(
/// Create a new Polkadot service for a light client.
pub fn polkadot_new_light(config: Configuration) -> Result<TaskManager, ServiceError>
{
new_light::<polkadot_runtime::RuntimeApi, PolkadotExecutor, _>(config)
new_light::<polkadot_runtime::RuntimeApi, PolkadotExecutor>(config)
}
/// Create a new Kusama service for a light client.
pub fn kusama_new_light(config: Configuration) -> Result<TaskManager, ServiceError>
{
new_light::<kusama_runtime::RuntimeApi, KusamaExecutor, _>(config)
new_light::<kusama_runtime::RuntimeApi, KusamaExecutor>(config)
}
/// Create a new Westend service for a light client.
pub fn westend_new_light(config: Configuration, ) -> Result<TaskManager, ServiceError>
{
new_light::<westend_runtime::RuntimeApi, KusamaExecutor, _>(config)
new_light::<westend_runtime::RuntimeApi, KusamaExecutor>(config)
}
......@@ -77,7 +77,7 @@ pub fn polkadot_test_new_full(
ServiceError,
> {
let (task_manager, client, handles, network, rpc_handlers) =
new_full::<polkadot_test_runtime::RuntimeApi, PolkadotTestExecutor, _>(
new_full::<polkadot_test_runtime::RuntimeApi, PolkadotTestExecutor>(
config,
collating_for,
max_block_data_size,
......
......@@ -100,7 +100,7 @@ impl ParachainContext for AdderContext {
impl BuildParachainContext for AdderContext {
type ParachainContext = Self;
fn build<Client, SP, Extrinsic>(
fn build<Client, SP>(
self,
_: Arc<Client>,
_: SP,
......
......@@ -81,16 +81,15 @@ pub struct FullDeps<C, P, SC> {
}
/// Instantiate all RPC extensions.
pub fn create_full<C, P, UE, SC>(deps: FullDeps<C, P, SC>) -> RpcExtension where
pub fn create_full<C, P, SC>(deps: FullDeps<C, P, SC>) -> RpcExtension where
C: ProvideRuntimeApi<Block>,
C: HeaderBackend<Block> + HeaderMetadata<Block, Error=BlockChainError>,
C: Send + Sync + 'static,
C::Api: frame_rpc_system::AccountNonceApi<Block, AccountId, Nonce>,
C::Api: pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi<Block, Balance, UE>,
C::Api: pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi<Block, Balance>,
C::Api: BabeApi<Block>,
C::Api: BlockBuilder<Block>,
P: TransactionPool + Sync + Send + 'static,
UE: codec::Codec + Send + Sync + 'static,
SC: SelectChain<Block> + 'static,
{
use frame_rpc_system::{FullSystem, SystemApi};
......@@ -145,16 +144,15 @@ pub fn create_full<C, P, UE, SC>(deps: FullDeps<C, P, SC>) -> RpcExtension where
}
/// Instantiate all RPC extensions for light node.
pub fn create_light<C, P, F, UE>(deps: LightDeps<C, F, P>) -> RpcExtension
pub fn create_light<C, P, F>(deps: LightDeps<C, F, P>) -> RpcExtension
where
C: ProvideRuntimeApi<Block>,
C: HeaderBackend<Block>,
C: Send + Sync + 'static,
C::Api: frame_rpc_system::AccountNonceApi<Block, AccountId, Nonce>,
C::Api: pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi<Block, Balance, UE>,
C::Api: pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi<Block, Balance>,
P: TransactionPool + Sync + Send + 'static,
F: Fetcher<Block> + 'static,
UE: codec::Codec + Send + Sync + 'static,
{
use frame_rpc_system::{LightSystem, SystemApi};
......
......@@ -1254,9 +1254,8 @@ sp_api::impl_runtime_apis! {
impl transaction_payment_rpc_runtime_api::TransactionPaymentApi<
Block,
Balance,
UncheckedExtrinsic,
> for Runtime {
fn query_info(uxt: UncheckedExtrinsic, len: u32) -> RuntimeDispatchInfo<Balance> {
fn query_info(uxt: <Block as BlockT>::Extrinsic, len: u32) -> RuntimeDispatchInfo<Balance> {
TransactionPayment::query_info(uxt, len)
}
}
......
......@@ -1394,9 +1394,8 @@ sp_api::impl_runtime_apis! {
impl transaction_payment_rpc_runtime_api::TransactionPaymentApi<
Block,
Balance,
UncheckedExtrinsic,
> for Runtime {
fn query_info(uxt: UncheckedExtrinsic, len: u32) -> RuntimeDispatchInfo<Balance> {
fn query_info(uxt: <Block as BlockT>::Extrinsic, len: u32) -> RuntimeDispatchInfo<Balance> {
TransactionPayment::query_info(uxt, len)
}
}
......
......@@ -313,9 +313,8 @@ sp_api::impl_runtime_apis! {
impl transaction_payment_rpc_runtime_api::TransactionPaymentApi<
Block,
Balance,
UncheckedExtrinsic,
> for Runtime {
fn query_info(uxt: UncheckedExtrinsic, len: u32) -> RuntimeDispatchInfo<Balance> {
fn query_info(uxt: <Block as BlockT>::Extrinsic, len: u32) -> RuntimeDispatchInfo<Balance> {
TransactionPayment::query_info(uxt, len)
}
}
......
......@@ -788,9 +788,8 @@ sp_api::impl_runtime_apis! {
impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<
Block,
Balance,
UncheckedExtrinsic,
> for Runtime {
fn query_info(uxt: UncheckedExtrinsic, len: u32) -> RuntimeDispatchInfo<Balance> {
fn query_info(uxt: <Block as BlockT>::Extrinsic, len: u32) -> RuntimeDispatchInfo<Balance> {
TransactionPayment::query_info(uxt, len)
}
}
......
......@@ -1036,9 +1036,8 @@ sp_api::impl_runtime_apis! {
impl transaction_payment_rpc_runtime_api::TransactionPaymentApi<
Block,
Balance,
UncheckedExtrinsic,
> for Runtime {
fn query_info(uxt: UncheckedExtrinsic, len: u32) -> RuntimeDispatchInfo<Balance> {
fn query_info(uxt: <Block as BlockT>::Extrinsic, len: u32) -> RuntimeDispatchInfo<Balance> {
TransactionPayment::query_info(uxt, len)
}
}
......
......@@ -76,7 +76,7 @@ native_executor_instance!(
);
/// A set of APIs that polkadot-like runtimes must implement.
pub trait RuntimeApiCollection<Extrinsic: codec::Codec + Send + Sync + 'static>:
pub trait RuntimeApiCollection:
sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block>
+ sp_api::ApiExt<Block, Error = sp_blockchain::Error>
+ babe_primitives::BabeApi<Block>
......@@ -84,17 +84,16 @@ pub trait RuntimeApiCollection<Extrinsic: codec::Codec + Send + Sync + 'static>:
+ ParachainHost<Block>
+ sp_block_builder::BlockBuilder<Block>
+ system_rpc_runtime_api::AccountNonceApi<Block, AccountId, Nonce>
+ pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<Block, Balance, Extrinsic>
+ pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<Block, Balance>
+ sp_api::Metadata<Block>
+ sp_offchain::OffchainWorkerApi<Block>
+ sp_session::SessionKeys<Block>
+ authority_discovery_primitives::AuthorityDiscoveryApi<Block>
where
Extrinsic: RuntimeExtrinsic,
<Self as sp_api::ApiExt<Block>>::StateBackend: sp_api::StateBackend<BlakeTwo256>,
{}
impl<Api, Extrinsic> RuntimeApiCollection<Extrinsic> for Api
impl<Api> RuntimeApiCollection for Api
where
Api:
sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block>
......@@ -104,19 +103,14 @@ where
+ ParachainHost<Block>
+ sp_block_builder::BlockBuilder<Block>
+ system_rpc_runtime_api::AccountNonceApi<Block, AccountId, Nonce>
+ pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<Block, Balance, Extrinsic>
+ pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<Block, Balance>
+ sp_api::Metadata<Block>
+ sp_offchain::OffchainWorkerApi<Block>
+ sp_session::SessionKeys<Block>
+ authority_discovery_primitives::AuthorityDiscoveryApi<Block>,
Extrinsic: RuntimeExtrinsic,
<Self as sp_api::ApiExt<Block>>::StateBackend: sp_api::StateBackend<BlakeTwo256>,
{}
pub trait RuntimeExtrinsic: codec::Codec + Send + Sync + 'static {}
impl<E> RuntimeExtrinsic for E where E: codec::Codec + Send + Sync + 'static {}
/// Can be called for a `Configuration` to check if it is a configuration for the `Kusama` network.
pub trait IdentifyVariant {
/// Returns if this is a configuration for the `Kusama` network.
......@@ -148,7 +142,7 @@ type LightClient<RuntimeApi, Executor> =
service::TLightClientWithBackend<Block, RuntimeApi, Executor, LightBackend>;
#[cfg(feature = "full-node")]
pub fn new_partial<RuntimeApi, Executor, Extrinsic>(config: &mut Configuration, test: bool) -> Result<
pub fn new_partial<RuntimeApi, Executor>(config: &mut Configuration, test: bool) -> Result<
service::PartialComponents<
FullClient<RuntimeApi, Executor>, FullBackend, FullSelectChain,
consensus_common::DefaultImportQueue<Block, FullClient<RuntimeApi, Executor>>,
......@@ -170,9 +164,8 @@ pub fn new_partial<RuntimeApi, Executor, Extrinsic>(config: &mut Configuration,
where
RuntimeApi: ConstructRuntimeApi<Block, FullClient<RuntimeApi, Executor>> + Send + Sync + 'static,
RuntimeApi::RuntimeApi:
RuntimeApiCollection<Extrinsic, StateBackend = sc_client_api::StateBackendFor<FullBackend, Block>>,
RuntimeApiCollection<StateBackend = sc_client_api::StateBackendFor<FullBackend, Block>>,
Executor: NativeExecutionDispatch + 'static,
Extrinsic: RuntimeExtrinsic,
{
if !test {
// If we're using prometheus, use a registry with a prefix of `polkadot`.
......@@ -274,7 +267,7 @@ pub fn new_partial<RuntimeApi, Executor, Extrinsic>(config: &mut Configuration,
}
#[cfg(feature = "full-node")]
pub fn new_full<RuntimeApi, Executor, Extrinsic>(
pub fn new_full<RuntimeApi, Executor>(
mut config: Configuration,
collating_for: Option<(CollatorId, parachain::Id)>,
max_block_data_size: Option<u64>,
......@@ -292,9 +285,8 @@ pub fn new_full<RuntimeApi, Executor, Extrinsic>(
where
RuntimeApi: ConstructRuntimeApi<Block, FullClient<RuntimeApi, Executor>> + Send + Sync + 'static,
RuntimeApi::RuntimeApi:
RuntimeApiCollection<Extrinsic, StateBackend = sc_client_api::StateBackendFor<FullBackend, Block>>,
RuntimeApiCollection<StateBackend = sc_client_api::StateBackendFor<FullBackend, Block>>,
Executor: NativeExecutionDispatch + 'static,
Extrinsic: RuntimeExtrinsic,
{
use sc_network::Event;
use sc_client_api::ExecutorProvider;
......@@ -316,7 +308,7 @@ pub fn new_full<RuntimeApi, Executor, Extrinsic>(
client, backend, mut task_manager, keystore, select_chain, import_queue, transaction_pool,
inherent_data_providers,
other: (rpc_extensions_builder, import_setup, rpc_setup)
} = new_partial::<RuntimeApi, Executor, Extrinsic>(&mut config, test)?;
} = new_partial::<RuntimeApi, Executor>(&mut config, test)?;
let prometheus_registry = config.prometheus_registry().cloned();
......@@ -589,13 +581,12 @@ pub fn new_full<RuntimeApi, Executor, Extrinsic>(
}
/// Builds a new service for a light client.
fn new_light<Runtime, Dispatch, Extrinsic>(mut config: Configuration) -> Result<(TaskManager, Arc<RpcHandlers>), Error>
fn new_light<Runtime, Dispatch>(mut config: Configuration) -> Result<(TaskManager, Arc<RpcHandlers>), Error>
where
Runtime: 'static + Send + Sync + ConstructRuntimeApi<Block, LightClient<Runtime, Dispatch>>,
<Runtime as ConstructRuntimeApi<Block, LightClient<Runtime, Dispatch>>>::RuntimeApi:
RuntimeApiCollection<Extrinsic, StateBackend = sc_client_api::StateBackendFor<LightBackend, Block>>,
RuntimeApiCollection<StateBackend = sc_client_api::StateBackendFor<LightBackend, Block>>,
Dispatch: NativeExecutionDispatch + 'static,
Extrinsic: RuntimeExtrinsic,
{
use sc_client_api::backend::RemoteBackend;
......@@ -662,7 +653,7 @@ fn new_light<Runtime, Dispatch, Extrinsic>(mut config: Configuration) -> Result<
finality_proof_request_builder: Some(finality_proof_request_builder),
finality_proof_provider: Some(finality_proof_provider),
})?;
if config.offchain_worker.enabled {
service::build_offchain_workers(
&config, backend.clone(), task_manager.spawn_handle(), client.clone(), network.clone(),
......@@ -678,7 +669,7 @@ fn new_light<Runtime, Dispatch, Extrinsic>(mut config: Configuration) -> Result<
let rpc_extensions = polkadot_rpc::create_light(light_deps);
let rpc_handlers = service::spawn_tasks(service::SpawnTasksParams {
let rpc_handlers = service::spawn_tasks(service::SpawnTasksParams {
on_demand: Some(on_demand),
remote_blockchain: Some(backend.remote_blockchain()),
rpc_extensions_builder: Box::new(service::NoopRpcExtensionBuilder(rpc_extensions)),
......@@ -693,7 +684,7 @@ fn new_light<Runtime, Dispatch, Extrinsic>(mut config: Configuration) -> Result<
/// Builds a new object suitable for chain operations.
#[cfg(feature = "full-node")]
pub fn new_chain_ops<Runtime, Dispatch, Extrinsic>(mut config: Configuration) -> Result<
pub fn new_chain_ops<Runtime, Dispatch>(mut config: Configuration) -> Result<
(
Arc<FullClient<Runtime, Dispatch>>,
Arc<FullBackend>,
......@@ -705,13 +696,12 @@ pub fn new_chain_ops<Runtime, Dispatch, Extrinsic>(mut config: Configuration) ->
where
Runtime: ConstructRuntimeApi<Block, FullClient<Runtime, Dispatch>> + Send + Sync + 'static,
Runtime::RuntimeApi:
RuntimeApiCollection<Extrinsic, StateBackend = sc_client_api::StateBackendFor<FullBackend, Block>>,
RuntimeApiCollection<StateBackend = sc_client_api::StateBackendFor<FullBackend, Block>>,
Dispatch: NativeExecutionDispatch + 'static,
Extrinsic: RuntimeExtrinsic,
{
config.keystore = service::config::KeystoreConfig::InMemory;
let service::PartialComponents { client, backend, import_queue, task_manager, .. }
= new_partial::<Runtime, Dispatch, Extrinsic>(&mut config, false)?;
= new_partial::<Runtime, Dispatch>(&mut config, false)?;
Ok((client, backend, import_queue, task_manager))
}
......@@ -735,7 +725,7 @@ pub fn polkadot_new_full(
FullNodeHandles,
), ServiceError>
{
let (service, client, handles, _, _) = new_full::<polkadot_runtime::RuntimeApi, PolkadotExecutor, _>(
let (service, client, handles, _, _) = new_full::<polkadot_runtime::RuntimeApi, PolkadotExecutor>(
config,
collating_for,
max_block_data_size,
......@@ -768,7 +758,7 @@ pub fn kusama_new_full(
FullNodeHandles
), ServiceError>
{
let (service, client, handles, _, _) = new_full::<kusama_runtime::RuntimeApi, KusamaExecutor, _>(
let (service, client, handles, _, _) = new_full::<kusama_runtime::RuntimeApi, KusamaExecutor>(
config,
collating_for,
max_block_data_size,
......@@ -801,7 +791,7 @@ pub fn westend_new_full(
FullNodeHandles,
), ServiceError>