mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-08 11:18:01 +00:00
Upgrade Substrate & Polkadot (#583)
This commit is contained in:
Generated
+832
-1319
File diff suppressed because it is too large
Load Diff
@@ -63,7 +63,7 @@ sp-consensus-aura = { git = "https://github.com/paritytech/substrate", branch =
|
||||
substrate-prometheus-endpoint = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
|
||||
# RPC related dependencies
|
||||
jsonrpc-core = "15.1.0"
|
||||
jsonrpc-core = "18.0.0"
|
||||
sc-transaction-pool-api = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
frame-rpc-system = { package = "substrate-frame-rpc-system", git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
pallet-transaction-payment-rpc = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
|
||||
@@ -370,7 +370,7 @@ impl pallet_xcm::Config for Runtime {
|
||||
type XcmExecuteFilter = Everything;
|
||||
type XcmExecutor = XcmExecutor<XcmConfig>;
|
||||
type XcmTeleportFilter = Everything;
|
||||
type XcmReserveTransferFilter = ();
|
||||
type XcmReserveTransferFilter = frame_support::traits::Nothing;
|
||||
type Weigher = FixedWeightBounds<UnitWeightCost, Call>;
|
||||
type LocationInverter = LocationInverter<Ancestry>;
|
||||
}
|
||||
|
||||
@@ -583,10 +583,6 @@ impl CliConfiguration<Self> for RelayChainCli {
|
||||
self.base.base.rpc_cors(is_dev)
|
||||
}
|
||||
|
||||
fn telemetry_external_transport(&self) -> Result<Option<sc_service::config::ExtTransport>> {
|
||||
self.base.base.telemetry_external_transport()
|
||||
}
|
||||
|
||||
fn default_heap_pages(&self) -> Result<Option<u64>> {
|
||||
self.base.base.default_heap_pages()
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ use cumulus_primitives_core::{
|
||||
relay_chain::v1::{Hash as PHash, PersistedValidationData},
|
||||
ParaId,
|
||||
};
|
||||
use polkadot_service::NativeExecutionDispatch;
|
||||
|
||||
use crate::rpc;
|
||||
pub use parachains_common::{AccountId, Balance, Block, Hash, Header, Index as Nonce};
|
||||
@@ -38,8 +39,7 @@ use sc_consensus::{
|
||||
import_queue::{BasicQueue, Verifier as VerifierT},
|
||||
BlockImportParams,
|
||||
};
|
||||
use sc_executor::native_executor_instance;
|
||||
pub use sc_executor::NativeExecutor;
|
||||
use sc_executor::NativeElseWasmExecutor;
|
||||
use sc_network::NetworkService;
|
||||
use sc_service::{Configuration, PartialComponents, Role, TFullBackend, TFullClient, TaskManager};
|
||||
use sc_telemetry::{Telemetry, TelemetryHandle, TelemetryWorker, TelemetryWorkerHandle};
|
||||
@@ -54,43 +54,80 @@ use sp_runtime::{
|
||||
use std::sync::Arc;
|
||||
use substrate_prometheus_endpoint::Registry;
|
||||
|
||||
// Native executor instance.
|
||||
native_executor_instance!(
|
||||
pub RococoParachainRuntimeExecutor,
|
||||
rococo_parachain_runtime::api::dispatch,
|
||||
rococo_parachain_runtime::native_version,
|
||||
);
|
||||
/// Native executor instance.
|
||||
pub struct RococoParachainRuntimeExecutor;
|
||||
|
||||
// Native executor instance.
|
||||
native_executor_instance!(
|
||||
pub ShellRuntimeExecutor,
|
||||
shell_runtime::api::dispatch,
|
||||
shell_runtime::native_version,
|
||||
);
|
||||
impl sc_executor::NativeExecutionDispatch for RococoParachainRuntimeExecutor {
|
||||
type ExtendHostFunctions = ();
|
||||
|
||||
fn dispatch(method: &str, data: &[u8]) -> Option<Vec<u8>> {
|
||||
rococo_parachain_runtime::api::dispatch(method, data)
|
||||
}
|
||||
|
||||
fn native_version() -> sc_executor::NativeVersion {
|
||||
rococo_parachain_runtime::native_version()
|
||||
}
|
||||
}
|
||||
|
||||
/// Native executor instance.
|
||||
pub struct ShellRuntimeExecutor;
|
||||
|
||||
impl sc_executor::NativeExecutionDispatch for ShellRuntimeExecutor {
|
||||
type ExtendHostFunctions = ();
|
||||
|
||||
fn dispatch(method: &str, data: &[u8]) -> Option<Vec<u8>> {
|
||||
shell_runtime::api::dispatch(method, data)
|
||||
}
|
||||
|
||||
fn native_version() -> sc_executor::NativeVersion {
|
||||
shell_runtime::native_version()
|
||||
}
|
||||
}
|
||||
|
||||
// Native Statemint executor instance.
|
||||
native_executor_instance!(
|
||||
pub StatemintRuntimeExecutor,
|
||||
statemint_runtime::api::dispatch,
|
||||
statemint_runtime::native_version,
|
||||
frame_benchmarking::benchmarking::HostFunctions,
|
||||
);
|
||||
pub struct StatemintRuntimeExecutor;
|
||||
|
||||
// Native Statemine executor instance.
|
||||
native_executor_instance!(
|
||||
pub StatemineRuntimeExecutor,
|
||||
statemine_runtime::api::dispatch,
|
||||
statemine_runtime::native_version,
|
||||
frame_benchmarking::benchmarking::HostFunctions,
|
||||
);
|
||||
impl sc_executor::NativeExecutionDispatch for StatemintRuntimeExecutor {
|
||||
type ExtendHostFunctions = frame_benchmarking::benchmarking::HostFunctions;
|
||||
|
||||
// Native Westmint executor instance.
|
||||
native_executor_instance!(
|
||||
pub WestmintRuntimeExecutor,
|
||||
westmint_runtime::api::dispatch,
|
||||
westmint_runtime::native_version,
|
||||
frame_benchmarking::benchmarking::HostFunctions,
|
||||
);
|
||||
fn dispatch(method: &str, data: &[u8]) -> Option<Vec<u8>> {
|
||||
statemint_runtime::api::dispatch(method, data)
|
||||
}
|
||||
|
||||
fn native_version() -> sc_executor::NativeVersion {
|
||||
statemint_runtime::native_version()
|
||||
}
|
||||
}
|
||||
|
||||
/// Native Statemine executor instance.
|
||||
pub struct StatemineRuntimeExecutor;
|
||||
|
||||
impl sc_executor::NativeExecutionDispatch for StatemineRuntimeExecutor {
|
||||
type ExtendHostFunctions = frame_benchmarking::benchmarking::HostFunctions;
|
||||
|
||||
fn dispatch(method: &str, data: &[u8]) -> Option<Vec<u8>> {
|
||||
statemine_runtime::api::dispatch(method, data)
|
||||
}
|
||||
|
||||
fn native_version() -> sc_executor::NativeVersion {
|
||||
statemine_runtime::native_version()
|
||||
}
|
||||
}
|
||||
|
||||
/// Native Westmint executor instance.
|
||||
pub struct WestmintRuntimeExecutor;
|
||||
|
||||
impl sc_executor::NativeExecutionDispatch for WestmintRuntimeExecutor {
|
||||
type ExtendHostFunctions = frame_benchmarking::benchmarking::HostFunctions;
|
||||
|
||||
fn dispatch(method: &str, data: &[u8]) -> Option<Vec<u8>> {
|
||||
westmint_runtime::api::dispatch(method, data)
|
||||
}
|
||||
|
||||
fn native_version() -> sc_executor::NativeVersion {
|
||||
westmint_runtime::native_version()
|
||||
}
|
||||
}
|
||||
|
||||
/// Starts a `ServiceBuilder` for a full service.
|
||||
///
|
||||
@@ -101,17 +138,23 @@ pub fn new_partial<RuntimeApi, Executor, BIQ>(
|
||||
build_import_queue: BIQ,
|
||||
) -> Result<
|
||||
PartialComponents<
|
||||
TFullClient<Block, RuntimeApi, Executor>,
|
||||
TFullClient<Block, RuntimeApi, NativeElseWasmExecutor<Executor>>,
|
||||
TFullBackend<Block>,
|
||||
(),
|
||||
sc_consensus::DefaultImportQueue<Block, TFullClient<Block, RuntimeApi, Executor>>,
|
||||
sc_transaction_pool::FullPool<Block, TFullClient<Block, RuntimeApi, Executor>>,
|
||||
sc_consensus::DefaultImportQueue<
|
||||
Block,
|
||||
TFullClient<Block, RuntimeApi, NativeElseWasmExecutor<Executor>>,
|
||||
>,
|
||||
sc_transaction_pool::FullPool<
|
||||
Block,
|
||||
TFullClient<Block, RuntimeApi, NativeElseWasmExecutor<Executor>>,
|
||||
>,
|
||||
(Option<Telemetry>, Option<TelemetryWorkerHandle>),
|
||||
>,
|
||||
sc_service::Error,
|
||||
>
|
||||
where
|
||||
RuntimeApi: ConstructRuntimeApi<Block, TFullClient<Block, RuntimeApi, Executor>>
|
||||
RuntimeApi: ConstructRuntimeApi<Block, TFullClient<Block, RuntimeApi, NativeElseWasmExecutor<Executor>>>
|
||||
+ Send
|
||||
+ Sync
|
||||
+ 'static,
|
||||
@@ -124,14 +167,17 @@ where
|
||||
> + sp_offchain::OffchainWorkerApi<Block>
|
||||
+ sp_block_builder::BlockBuilder<Block>,
|
||||
sc_client_api::StateBackendFor<TFullBackend<Block>, Block>: sp_api::StateBackend<BlakeTwo256>,
|
||||
Executor: sc_executor::NativeExecutionDispatch + 'static,
|
||||
Executor: NativeExecutionDispatch + 'static,
|
||||
BIQ: FnOnce(
|
||||
Arc<TFullClient<Block, RuntimeApi, Executor>>,
|
||||
Arc<TFullClient<Block, RuntimeApi, NativeElseWasmExecutor<Executor>>>,
|
||||
&Configuration,
|
||||
Option<TelemetryHandle>,
|
||||
&TaskManager,
|
||||
) -> Result<
|
||||
sc_consensus::DefaultImportQueue<Block, TFullClient<Block, RuntimeApi, Executor>>,
|
||||
sc_consensus::DefaultImportQueue<
|
||||
Block,
|
||||
TFullClient<Block, RuntimeApi, NativeElseWasmExecutor<Executor>>,
|
||||
>,
|
||||
sc_service::Error,
|
||||
>,
|
||||
{
|
||||
@@ -146,10 +192,17 @@ where
|
||||
})
|
||||
.transpose()?;
|
||||
|
||||
let executor = sc_executor::NativeElseWasmExecutor::<Executor>::new(
|
||||
config.wasm_method,
|
||||
config.default_heap_pages,
|
||||
config.max_runtime_instances,
|
||||
);
|
||||
|
||||
let (client, backend, keystore_container, task_manager) =
|
||||
sc_service::new_full_parts::<Block, RuntimeApi, Executor>(
|
||||
sc_service::new_full_parts::<Block, RuntimeApi, _>(
|
||||
&config,
|
||||
telemetry.as_ref().map(|(_, telemetry)| telemetry.handle()),
|
||||
executor,
|
||||
)?;
|
||||
let client = Arc::new(client);
|
||||
|
||||
@@ -200,9 +253,12 @@ async fn start_shell_node_impl<RuntimeApi, Executor, RB, BIQ, BIC>(
|
||||
rpc_ext_builder: RB,
|
||||
build_import_queue: BIQ,
|
||||
build_consensus: BIC,
|
||||
) -> sc_service::error::Result<(TaskManager, Arc<TFullClient<Block, RuntimeApi, Executor>>)>
|
||||
) -> sc_service::error::Result<(
|
||||
TaskManager,
|
||||
Arc<TFullClient<Block, RuntimeApi, NativeElseWasmExecutor<Executor>>>,
|
||||
)>
|
||||
where
|
||||
RuntimeApi: ConstructRuntimeApi<Block, TFullClient<Block, RuntimeApi, Executor>>
|
||||
RuntimeApi: ConstructRuntimeApi<Block, TFullClient<Block, RuntimeApi, NativeElseWasmExecutor<Executor>>>
|
||||
+ Send
|
||||
+ Sync
|
||||
+ 'static,
|
||||
@@ -218,26 +274,34 @@ where
|
||||
sc_client_api::StateBackendFor<TFullBackend<Block>, Block>: sp_api::StateBackend<BlakeTwo256>,
|
||||
Executor: sc_executor::NativeExecutionDispatch + 'static,
|
||||
RB: Fn(
|
||||
Arc<TFullClient<Block, RuntimeApi, Executor>>,
|
||||
Arc<TFullClient<Block, RuntimeApi, NativeElseWasmExecutor<Executor>>>,
|
||||
) -> Result<jsonrpc_core::IoHandler<sc_rpc::Metadata>, sc_service::Error>
|
||||
+ Send
|
||||
+ 'static,
|
||||
BIQ: FnOnce(
|
||||
Arc<TFullClient<Block, RuntimeApi, Executor>>,
|
||||
Arc<TFullClient<Block, RuntimeApi, NativeElseWasmExecutor<Executor>>>,
|
||||
&Configuration,
|
||||
Option<TelemetryHandle>,
|
||||
&TaskManager,
|
||||
) -> Result<
|
||||
sc_consensus::DefaultImportQueue<Block, TFullClient<Block, RuntimeApi, Executor>>,
|
||||
sc_consensus::DefaultImportQueue<
|
||||
Block,
|
||||
TFullClient<Block, RuntimeApi, NativeElseWasmExecutor<Executor>>,
|
||||
>,
|
||||
sc_service::Error,
|
||||
>,
|
||||
BIC: FnOnce(
|
||||
Arc<TFullClient<Block, RuntimeApi, Executor>>,
|
||||
Arc<TFullClient<Block, RuntimeApi, NativeElseWasmExecutor<Executor>>>,
|
||||
Option<&Registry>,
|
||||
Option<TelemetryHandle>,
|
||||
&TaskManager,
|
||||
&polkadot_service::NewFull<polkadot_service::Client>,
|
||||
Arc<sc_transaction_pool::FullPool<Block, TFullClient<Block, RuntimeApi, Executor>>>,
|
||||
Arc<
|
||||
sc_transaction_pool::FullPool<
|
||||
Block,
|
||||
TFullClient<Block, RuntimeApi, NativeElseWasmExecutor<Executor>>,
|
||||
>,
|
||||
>,
|
||||
Arc<NetworkService<Block, Hash>>,
|
||||
SyncCryptoStorePtr,
|
||||
bool,
|
||||
@@ -365,9 +429,12 @@ async fn start_node_impl<RuntimeApi, Executor, RB, BIQ, BIC>(
|
||||
_rpc_ext_builder: RB,
|
||||
build_import_queue: BIQ,
|
||||
build_consensus: BIC,
|
||||
) -> sc_service::error::Result<(TaskManager, Arc<TFullClient<Block, RuntimeApi, Executor>>)>
|
||||
) -> sc_service::error::Result<(
|
||||
TaskManager,
|
||||
Arc<TFullClient<Block, RuntimeApi, NativeElseWasmExecutor<Executor>>>,
|
||||
)>
|
||||
where
|
||||
RuntimeApi: ConstructRuntimeApi<Block, TFullClient<Block, RuntimeApi, Executor>>
|
||||
RuntimeApi: ConstructRuntimeApi<Block, TFullClient<Block, RuntimeApi, NativeElseWasmExecutor<Executor>>>
|
||||
+ Send
|
||||
+ Sync
|
||||
+ 'static,
|
||||
@@ -390,21 +457,29 @@ where
|
||||
+ Send
|
||||
+ 'static,
|
||||
BIQ: FnOnce(
|
||||
Arc<TFullClient<Block, RuntimeApi, Executor>>,
|
||||
Arc<TFullClient<Block, RuntimeApi, NativeElseWasmExecutor<Executor>>>,
|
||||
&Configuration,
|
||||
Option<TelemetryHandle>,
|
||||
&TaskManager,
|
||||
) -> Result<
|
||||
sc_consensus::DefaultImportQueue<Block, TFullClient<Block, RuntimeApi, Executor>>,
|
||||
sc_consensus::DefaultImportQueue<
|
||||
Block,
|
||||
TFullClient<Block, RuntimeApi, NativeElseWasmExecutor<Executor>>,
|
||||
>,
|
||||
sc_service::Error,
|
||||
> + 'static,
|
||||
BIC: FnOnce(
|
||||
Arc<TFullClient<Block, RuntimeApi, Executor>>,
|
||||
Arc<TFullClient<Block, RuntimeApi, NativeElseWasmExecutor<Executor>>>,
|
||||
Option<&Registry>,
|
||||
Option<TelemetryHandle>,
|
||||
&TaskManager,
|
||||
&polkadot_service::NewFull<polkadot_service::Client>,
|
||||
Arc<sc_transaction_pool::FullPool<Block, TFullClient<Block, RuntimeApi, Executor>>>,
|
||||
Arc<
|
||||
sc_transaction_pool::FullPool<
|
||||
Block,
|
||||
TFullClient<Block, RuntimeApi, NativeElseWasmExecutor<Executor>>,
|
||||
>,
|
||||
>,
|
||||
Arc<NetworkService<Block, Hash>>,
|
||||
SyncCryptoStorePtr,
|
||||
bool,
|
||||
@@ -536,7 +611,11 @@ where
|
||||
/// Build the import queue for the rococo parachain runtime.
|
||||
pub fn rococo_parachain_build_import_queue(
|
||||
client: Arc<
|
||||
TFullClient<Block, rococo_parachain_runtime::RuntimeApi, RococoParachainRuntimeExecutor>,
|
||||
TFullClient<
|
||||
Block,
|
||||
rococo_parachain_runtime::RuntimeApi,
|
||||
NativeElseWasmExecutor<RococoParachainRuntimeExecutor>,
|
||||
>,
|
||||
>,
|
||||
config: &Configuration,
|
||||
telemetry: Option<TelemetryHandle>,
|
||||
@@ -544,7 +623,11 @@ pub fn rococo_parachain_build_import_queue(
|
||||
) -> Result<
|
||||
sc_consensus::DefaultImportQueue<
|
||||
Block,
|
||||
TFullClient<Block, rococo_parachain_runtime::RuntimeApi, RococoParachainRuntimeExecutor>,
|
||||
TFullClient<
|
||||
Block,
|
||||
rococo_parachain_runtime::RuntimeApi,
|
||||
NativeElseWasmExecutor<RococoParachainRuntimeExecutor>,
|
||||
>,
|
||||
>,
|
||||
sc_service::Error,
|
||||
> {
|
||||
@@ -587,7 +670,13 @@ pub async fn start_rococo_parachain_node(
|
||||
id: ParaId,
|
||||
) -> sc_service::error::Result<(
|
||||
TaskManager,
|
||||
Arc<TFullClient<Block, rococo_parachain_runtime::RuntimeApi, RococoParachainRuntimeExecutor>>,
|
||||
Arc<
|
||||
TFullClient<
|
||||
Block,
|
||||
rococo_parachain_runtime::RuntimeApi,
|
||||
NativeElseWasmExecutor<RococoParachainRuntimeExecutor>,
|
||||
>,
|
||||
>,
|
||||
)> {
|
||||
start_node_impl::<rococo_parachain_runtime::RuntimeApi, RococoParachainRuntimeExecutor, _, _, _>(
|
||||
parachain_config,
|
||||
@@ -677,14 +766,16 @@ pub async fn start_rococo_parachain_node(
|
||||
|
||||
/// Build the import queue for the shell runtime.
|
||||
pub fn shell_build_import_queue(
|
||||
client: Arc<TFullClient<Block, shell_runtime::RuntimeApi, ShellRuntimeExecutor>>,
|
||||
client: Arc<
|
||||
TFullClient<Block, shell_runtime::RuntimeApi, NativeElseWasmExecutor<ShellRuntimeExecutor>>,
|
||||
>,
|
||||
config: &Configuration,
|
||||
_: Option<TelemetryHandle>,
|
||||
task_manager: &TaskManager,
|
||||
) -> Result<
|
||||
sc_consensus::DefaultImportQueue<
|
||||
Block,
|
||||
TFullClient<Block, shell_runtime::RuntimeApi, ShellRuntimeExecutor>,
|
||||
TFullClient<Block, shell_runtime::RuntimeApi, NativeElseWasmExecutor<ShellRuntimeExecutor>>,
|
||||
>,
|
||||
sc_service::Error,
|
||||
> {
|
||||
@@ -705,9 +796,17 @@ pub async fn start_shell_node(
|
||||
id: ParaId,
|
||||
) -> sc_service::error::Result<(
|
||||
TaskManager,
|
||||
Arc<TFullClient<Block, shell_runtime::RuntimeApi, ShellRuntimeExecutor>>,
|
||||
Arc<
|
||||
TFullClient<Block, shell_runtime::RuntimeApi, NativeElseWasmExecutor<ShellRuntimeExecutor>>,
|
||||
>,
|
||||
)> {
|
||||
start_shell_node_impl::<shell_runtime::RuntimeApi, ShellRuntimeExecutor, _, _, _>(
|
||||
start_shell_node_impl::<
|
||||
shell_runtime::RuntimeApi,
|
||||
ShellRuntimeExecutor,
|
||||
_,
|
||||
_,
|
||||
_,
|
||||
>(
|
||||
parachain_config,
|
||||
polkadot_config,
|
||||
id,
|
||||
@@ -879,16 +978,19 @@ where
|
||||
|
||||
/// Build the import queue for the statemint/statemine/westmine runtime.
|
||||
pub fn statemint_build_import_queue<RuntimeApi, Executor>(
|
||||
client: Arc<TFullClient<Block, RuntimeApi, Executor>>,
|
||||
client: Arc<TFullClient<Block, RuntimeApi, NativeElseWasmExecutor<Executor>>>,
|
||||
config: &Configuration,
|
||||
telemetry_handle: Option<TelemetryHandle>,
|
||||
task_manager: &TaskManager,
|
||||
) -> Result<
|
||||
sc_consensus::DefaultImportQueue<Block, TFullClient<Block, RuntimeApi, Executor>>,
|
||||
sc_consensus::DefaultImportQueue<
|
||||
Block,
|
||||
TFullClient<Block, RuntimeApi, NativeElseWasmExecutor<Executor>>,
|
||||
>,
|
||||
sc_service::Error,
|
||||
>
|
||||
where
|
||||
RuntimeApi: ConstructRuntimeApi<Block, TFullClient<Block, RuntimeApi, Executor>>
|
||||
RuntimeApi: ConstructRuntimeApi<Block, TFullClient<Block, RuntimeApi, NativeElseWasmExecutor<Executor>>>
|
||||
+ Send
|
||||
+ Sync
|
||||
+ 'static,
|
||||
@@ -961,9 +1063,12 @@ pub async fn start_statemint_node<RuntimeApi, Executor>(
|
||||
parachain_config: Configuration,
|
||||
polkadot_config: Configuration,
|
||||
id: ParaId,
|
||||
) -> sc_service::error::Result<(TaskManager, Arc<TFullClient<Block, RuntimeApi, Executor>>)>
|
||||
) -> sc_service::error::Result<(
|
||||
TaskManager,
|
||||
Arc<TFullClient<Block, RuntimeApi, NativeElseWasmExecutor<Executor>>>,
|
||||
)>
|
||||
where
|
||||
RuntimeApi: ConstructRuntimeApi<Block, TFullClient<Block, RuntimeApi, Executor>>
|
||||
RuntimeApi: ConstructRuntimeApi<Block, TFullClient<Block, RuntimeApi, NativeElseWasmExecutor<Executor>>>
|
||||
+ Send
|
||||
+ Sync
|
||||
+ 'static,
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
//! A Cumulus test client.
|
||||
|
||||
mod block_builder;
|
||||
use codec::{Encode, Decode};
|
||||
use codec::{Decode, Encode};
|
||||
use runtime::{
|
||||
Balance, Block, BlockHashCount, Call, GenesisConfig, Runtime, Signature, SignedExtra,
|
||||
SignedPayload, UncheckedExtrinsic, VERSION,
|
||||
@@ -39,12 +39,20 @@ pub use substrate_test_client::*;
|
||||
pub type ParachainBlockData = cumulus_primitives_core::ParachainBlockData<Block>;
|
||||
|
||||
mod local_executor {
|
||||
use substrate_test_client::sc_executor::native_executor_instance;
|
||||
native_executor_instance!(
|
||||
pub LocalExecutor,
|
||||
cumulus_test_runtime::api::dispatch,
|
||||
cumulus_test_runtime::native_version,
|
||||
);
|
||||
/// Native executor instance.
|
||||
pub struct LocalExecutor;
|
||||
|
||||
impl sc_executor::NativeExecutionDispatch for LocalExecutor {
|
||||
type ExtendHostFunctions = ();
|
||||
|
||||
fn dispatch(method: &str, data: &[u8]) -> Option<Vec<u8>> {
|
||||
cumulus_test_runtime::api::dispatch(method, data)
|
||||
}
|
||||
|
||||
fn native_version() -> sc_executor::NativeVersion {
|
||||
cumulus_test_runtime::native_version()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Native executor used for tests.
|
||||
@@ -55,7 +63,7 @@ pub type Backend = substrate_test_client::Backend<Block>;
|
||||
|
||||
/// Test client executor.
|
||||
pub type Executor =
|
||||
client::LocalCallExecutor<Block, Backend, sc_executor::NativeExecutor<LocalExecutor>>;
|
||||
client::LocalCallExecutor<Block, Backend, sc_executor::NativeElseWasmExecutor<LocalExecutor>>;
|
||||
|
||||
/// Test client builder for Cumulus
|
||||
pub type TestClientBuilder =
|
||||
|
||||
@@ -57,7 +57,7 @@ cumulus-test-runtime = { path = "../runtime" }
|
||||
cumulus-test-relay-validation-worker-provider = { path = "../relay-validation-worker-provider" }
|
||||
|
||||
# RPC related dependencies
|
||||
jsonrpc-core = "15.1.0"
|
||||
jsonrpc-core = "18.0.0"
|
||||
|
||||
[dev-dependencies]
|
||||
futures = "0.3.5"
|
||||
|
||||
@@ -31,8 +31,6 @@ use cumulus_primitives_core::ParaId;
|
||||
use cumulus_test_runtime::{Hash, Header, NodeBlock as Block, RuntimeApi};
|
||||
use polkadot_primitives::v1::{CollatorPair, Hash as PHash, PersistedValidationData};
|
||||
use sc_client_api::execution_extensions::ExecutionStrategies;
|
||||
use sc_executor::native_executor_instance;
|
||||
pub use sc_executor::NativeExecutor;
|
||||
use sc_network::{config::TransportConfig, multiaddr, NetworkService};
|
||||
use sc_service::{
|
||||
config::{
|
||||
@@ -78,15 +76,27 @@ impl ParachainConsensus<Block> for NullConsensus {
|
||||
/// The signature of the announce block fn.
|
||||
pub type AnnounceBlockFn = Arc<dyn Fn(Hash, Option<Vec<u8>>) + Send + Sync>;
|
||||
|
||||
// Native executor instance.
|
||||
native_executor_instance!(
|
||||
pub RuntimeExecutor,
|
||||
cumulus_test_runtime::api::dispatch,
|
||||
cumulus_test_runtime::native_version,
|
||||
);
|
||||
/// Native executor instance.
|
||||
pub struct RuntimeExecutor;
|
||||
|
||||
impl sc_executor::NativeExecutionDispatch for RuntimeExecutor {
|
||||
type ExtendHostFunctions = ();
|
||||
|
||||
fn dispatch(method: &str, data: &[u8]) -> Option<Vec<u8>> {
|
||||
cumulus_test_runtime::api::dispatch(method, data)
|
||||
}
|
||||
|
||||
fn native_version() -> sc_executor::NativeVersion {
|
||||
cumulus_test_runtime::native_version()
|
||||
}
|
||||
}
|
||||
|
||||
/// The client type being used by the test service.
|
||||
pub type Client = TFullClient<runtime::NodeBlock, runtime::RuntimeApi, RuntimeExecutor>;
|
||||
pub type Client = TFullClient<
|
||||
runtime::NodeBlock,
|
||||
runtime::RuntimeApi,
|
||||
sc_executor::NativeElseWasmExecutor<RuntimeExecutor>,
|
||||
>;
|
||||
|
||||
/// Starts a `ServiceBuilder` for a full service.
|
||||
///
|
||||
@@ -105,8 +115,14 @@ pub fn new_partial(
|
||||
>,
|
||||
sc_service::Error,
|
||||
> {
|
||||
let executor = sc_executor::NativeElseWasmExecutor::<RuntimeExecutor>::new(
|
||||
config.wasm_method,
|
||||
config.default_heap_pages,
|
||||
config.max_runtime_instances,
|
||||
);
|
||||
|
||||
let (client, backend, keystore_container, task_manager) =
|
||||
sc_service::new_full_parts::<Block, RuntimeApi, RuntimeExecutor>(&config, None)?;
|
||||
sc_service::new_full_parts::<Block, RuntimeApi, _>(&config, None, executor)?;
|
||||
let client = Arc::new(client);
|
||||
|
||||
let registry = config.prometheus_registry();
|
||||
@@ -155,14 +171,12 @@ async fn start_node_impl<RB>(
|
||||
consensus: Consensus,
|
||||
) -> sc_service::error::Result<(
|
||||
TaskManager,
|
||||
Arc<TFullClient<Block, RuntimeApi, RuntimeExecutor>>,
|
||||
Arc<Client>,
|
||||
Arc<NetworkService<Block, H256>>,
|
||||
RpcHandlers,
|
||||
)>
|
||||
where
|
||||
RB: Fn(
|
||||
Arc<TFullClient<Block, RuntimeApi, RuntimeExecutor>>,
|
||||
) -> Result<jsonrpc_core::IoHandler<sc_rpc::Metadata>, sc_service::Error>
|
||||
RB: Fn(Arc<Client>) -> Result<jsonrpc_core::IoHandler<sc_rpc::Metadata>, sc_service::Error>
|
||||
+ Send
|
||||
+ 'static,
|
||||
{
|
||||
@@ -629,7 +643,6 @@ pub fn node_config(
|
||||
rpc_max_payload: None,
|
||||
prometheus_config: None,
|
||||
telemetry_endpoints: None,
|
||||
telemetry_external_transport: None,
|
||||
default_heap_pages: None,
|
||||
offchain_worker: OffchainWorkerConfig {
|
||||
enabled: true,
|
||||
|
||||
Reference in New Issue
Block a user