mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 18:41:03 +00:00
Integrate Shell runtime into collator (#414)
* Introduce the converter into the hub * Parachain recognises Rococo governance body as admin * Whitespace * Use UsingComponents for fee payment in XCM * Fixes * Fixes for XCM permissions * Remove encode_call test * Fixes * Rococo Collator supports Shell runtime * Fixes * Fixes
This commit is contained in:
Generated
+255
-229
File diff suppressed because it is too large
Load Diff
@@ -52,6 +52,7 @@ sc-chain-spec = { git = "https://github.com/paritytech/substrate", branch = "mas
|
|||||||
sc-rpc = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
sc-rpc = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||||
sc-tracing = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
sc-tracing = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||||
sp-offchain = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
sp-offchain = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||||
|
sp-api = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||||
|
|
||||||
# RPC related dependencies
|
# RPC related dependencies
|
||||||
jsonrpc-core = "15.1.0"
|
jsonrpc-core = "15.1.0"
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ use sp_version::RuntimeVersion;
|
|||||||
|
|
||||||
// A few exports that help ease life for downstream crates.
|
// A few exports that help ease life for downstream crates.
|
||||||
pub use frame_support::{
|
pub use frame_support::{
|
||||||
construct_runtime, parameter_types,
|
construct_runtime, parameter_types, match_type,
|
||||||
traits::{Randomness, IsInVec, All},
|
traits::{Randomness, IsInVec, All},
|
||||||
weights::{
|
weights::{
|
||||||
constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_PER_SECOND},
|
constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_PER_SECOND},
|
||||||
@@ -306,17 +306,6 @@ parameter_types! {
|
|||||||
pub const WeightPrice: (MultiLocation, u128) = (X1(Parent), ROC);
|
pub const WeightPrice: (MultiLocation, u128) = (X1(Parent), ROC);
|
||||||
}
|
}
|
||||||
|
|
||||||
macro_rules! match_type {
|
|
||||||
( pub type $n:ident: impl Contains<$t:ty> = { $phead:pat $( | $ptail:pat )* } ; ) => {
|
|
||||||
pub struct $n;
|
|
||||||
impl frame_support::traits::Contains<$t> for $n {
|
|
||||||
fn contains(l: &$t) -> bool {
|
|
||||||
matches!(l, $phead $( | $ptail )* )
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
match_type! {
|
match_type! {
|
||||||
pub type ParentOrParentsUnitPlurality: impl Contains<MultiLocation> = {
|
pub type ParentOrParentsUnitPlurality: impl Contains<MultiLocation> = {
|
||||||
X1(Parent) | X2(Parent, Plurality { id: BodyId::Unit, .. })
|
X1(Parent) | X2(Parent, Plurality { id: BodyId::Unit, .. })
|
||||||
|
|||||||
@@ -26,6 +26,9 @@ use sp_runtime::traits::{IdentifyAccount, Verify};
|
|||||||
/// Specialized `ChainSpec` for the normal parachain runtime.
|
/// Specialized `ChainSpec` for the normal parachain runtime.
|
||||||
pub type ChainSpec = sc_service::GenericChainSpec<parachain_runtime::GenesisConfig, Extensions>;
|
pub type ChainSpec = sc_service::GenericChainSpec<parachain_runtime::GenesisConfig, Extensions>;
|
||||||
|
|
||||||
|
/// Specialized `ChainSpec` for the shell parachain runtime.
|
||||||
|
pub type ShellChainSpec = sc_service::GenericChainSpec<shell_runtime::GenesisConfig, Extensions>;
|
||||||
|
|
||||||
/// Helper function to generate a crypto pair from seed
|
/// Helper function to generate a crypto pair from seed
|
||||||
pub fn get_from_seed<TPublic: Public>(seed: &str) -> <TPublic::Pair as Pair>::Public {
|
pub fn get_from_seed<TPublic: Public>(seed: &str) -> <TPublic::Pair as Pair>::Public {
|
||||||
TPublic::Pair::from_string(&format!("//{}", seed), None)
|
TPublic::Pair::from_string(&format!("//{}", seed), None)
|
||||||
@@ -96,6 +99,23 @@ pub fn get_chain_spec(id: ParaId) -> ChainSpec {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn get_shell_chain_spec(id: ParaId) -> ShellChainSpec {
|
||||||
|
ShellChainSpec::from_genesis(
|
||||||
|
"Shell Local Testnet",
|
||||||
|
"shell_local_testnet",
|
||||||
|
ChainType::Local,
|
||||||
|
move || shell_testnet_genesis(id),
|
||||||
|
vec![],
|
||||||
|
None,
|
||||||
|
None,
|
||||||
|
None,
|
||||||
|
Extensions {
|
||||||
|
relay_chain: "westend-dev".into(),
|
||||||
|
para_id: id.into(),
|
||||||
|
},
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
pub fn staging_test_net(id: ParaId) -> ChainSpec {
|
pub fn staging_test_net(id: ParaId) -> ChainSpec {
|
||||||
ChainSpec::from_genesis(
|
ChainSpec::from_genesis(
|
||||||
"Staging Testnet",
|
"Staging Testnet",
|
||||||
@@ -144,3 +164,16 @@ fn testnet_genesis(
|
|||||||
parachain_info: parachain_runtime::ParachainInfoConfig { parachain_id: id },
|
parachain_info: parachain_runtime::ParachainInfoConfig { parachain_id: id },
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn shell_testnet_genesis(parachain_id: ParaId) -> shell_runtime::GenesisConfig {
|
||||||
|
shell_runtime::GenesisConfig {
|
||||||
|
frame_system: shell_runtime::SystemConfig {
|
||||||
|
code: shell_runtime::WASM_BINARY
|
||||||
|
.expect("WASM binary was not build, please build it!")
|
||||||
|
.to_vec(),
|
||||||
|
changes_trie_config: Default::default(),
|
||||||
|
},
|
||||||
|
pallet_balances: shell_runtime::BalancesConfig::default(),
|
||||||
|
parachain_info: shell_runtime::ParachainInfoConfig { parachain_id },
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ use sc_cli::{
|
|||||||
};
|
};
|
||||||
use sc_service::{
|
use sc_service::{
|
||||||
config::{BasePath, PrometheusConfig},
|
config::{BasePath, PrometheusConfig},
|
||||||
PartialComponents,
|
|
||||||
};
|
};
|
||||||
use sp_core::hexdisplay::HexDisplay;
|
use sp_core::hexdisplay::HexDisplay;
|
||||||
use sp_runtime::traits::Block as BlockT;
|
use sp_runtime::traits::Block as BlockT;
|
||||||
@@ -51,6 +50,7 @@ fn load_spec(
|
|||||||
"track" => Ok(Box::new(chain_spec::ChainSpec::from_json_bytes(
|
"track" => Ok(Box::new(chain_spec::ChainSpec::from_json_bytes(
|
||||||
&include_bytes!("../res/track.json")[..],
|
&include_bytes!("../res/track.json")[..],
|
||||||
)?)),
|
)?)),
|
||||||
|
"shell" => Ok(Box::new(chain_spec::get_shell_chain_spec(para_id))),
|
||||||
"" => Ok(Box::new(chain_spec::get_chain_spec(para_id))),
|
"" => Ok(Box::new(chain_spec::get_chain_spec(para_id))),
|
||||||
path => Ok(Box::new(chain_spec::ChainSpec::from_json_file(
|
path => Ok(Box::new(chain_spec::ChainSpec::from_json_file(
|
||||||
path.into(),
|
path.into(),
|
||||||
@@ -146,6 +146,31 @@ fn extract_genesis_wasm(chain_spec: &Box<dyn sc_service::ChainSpec>) -> Result<V
|
|||||||
.ok_or_else(|| "Could not find wasm file in genesis state!".into())
|
.ok_or_else(|| "Could not find wasm file in genesis state!".into())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn use_shell_runtime(chain_spec: &Box<dyn ChainSpec>) -> bool {
|
||||||
|
chain_spec.id().starts_with("track") || chain_spec.id().starts_with("shell")
|
||||||
|
}
|
||||||
|
|
||||||
|
use crate::service::{new_partial, RuntimeExecutor, ShellRuntimeExecutor};
|
||||||
|
|
||||||
|
macro_rules! construct_async_run {
|
||||||
|
(|$components:ident, $cli:ident, $cmd:ident, $config:ident| $( $code:tt )* ) => {{
|
||||||
|
let runner = $cli.create_runner($cmd)?;
|
||||||
|
if use_shell_runtime(&runner.config().chain_spec) {
|
||||||
|
runner.async_run(|$config| {
|
||||||
|
let $components = new_partial::<shell_runtime::RuntimeApi, ShellRuntimeExecutor>(&$config)?;
|
||||||
|
let task_manager = $components.task_manager;
|
||||||
|
{ $( $code )* }.map(|v| (v, task_manager))
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
runner.async_run(|$config| {
|
||||||
|
let $components = new_partial::<parachain_runtime::RuntimeApi, RuntimeExecutor>(&$config)?;
|
||||||
|
let task_manager = $components.task_manager;
|
||||||
|
{ $( $code )* }.map(|v| (v, task_manager))
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
}
|
||||||
|
|
||||||
/// Parse command line arguments into service configuration.
|
/// Parse command line arguments into service configuration.
|
||||||
pub fn run() -> Result<()> {
|
pub fn run() -> Result<()> {
|
||||||
let cli = Cli::from_args();
|
let cli = Cli::from_args();
|
||||||
@@ -155,52 +180,18 @@ pub fn run() -> Result<()> {
|
|||||||
let runner = cli.create_runner(cmd)?;
|
let runner = cli.create_runner(cmd)?;
|
||||||
runner.sync_run(|config| cmd.run(config.chain_spec, config.network))
|
runner.sync_run(|config| cmd.run(config.chain_spec, config.network))
|
||||||
}
|
}
|
||||||
Some(Subcommand::CheckBlock(cmd)) => {
|
Some(Subcommand::CheckBlock(cmd)) => construct_async_run! (|components, cli, cmd, config| {
|
||||||
let runner = cli.create_runner(cmd)?;
|
Ok(cmd.run(components.client, components.import_queue))
|
||||||
runner.async_run(|config| {
|
}),
|
||||||
let PartialComponents {
|
Some(Subcommand::ExportBlocks(cmd)) => construct_async_run! (|components, cli, cmd, config| {
|
||||||
client,
|
Ok(cmd.run(components.client, config.database))
|
||||||
task_manager,
|
}),
|
||||||
import_queue,
|
Some(Subcommand::ExportState(cmd)) => construct_async_run! (|components, cli, cmd, config| {
|
||||||
..
|
Ok(cmd.run(components.client, config.chain_spec))
|
||||||
} = crate::service::new_partial(&config)?;
|
}),
|
||||||
Ok((cmd.run(client, import_queue), task_manager))
|
Some(Subcommand::ImportBlocks(cmd)) => construct_async_run! (|components, cli, cmd, config| {
|
||||||
})
|
Ok(cmd.run(components.client, components.import_queue))
|
||||||
}
|
}),
|
||||||
Some(Subcommand::ExportBlocks(cmd)) => {
|
|
||||||
let runner = cli.create_runner(cmd)?;
|
|
||||||
runner.async_run(|config| {
|
|
||||||
let PartialComponents {
|
|
||||||
client,
|
|
||||||
task_manager,
|
|
||||||
..
|
|
||||||
} = crate::service::new_partial(&config)?;
|
|
||||||
Ok((cmd.run(client, config.database), task_manager))
|
|
||||||
})
|
|
||||||
}
|
|
||||||
Some(Subcommand::ExportState(cmd)) => {
|
|
||||||
let runner = cli.create_runner(cmd)?;
|
|
||||||
runner.async_run(|config| {
|
|
||||||
let PartialComponents {
|
|
||||||
client,
|
|
||||||
task_manager,
|
|
||||||
..
|
|
||||||
} = crate::service::new_partial(&config)?;
|
|
||||||
Ok((cmd.run(client, config.chain_spec), task_manager))
|
|
||||||
})
|
|
||||||
}
|
|
||||||
Some(Subcommand::ImportBlocks(cmd)) => {
|
|
||||||
let runner = cli.create_runner(cmd)?;
|
|
||||||
runner.async_run(|config| {
|
|
||||||
let PartialComponents {
|
|
||||||
client,
|
|
||||||
task_manager,
|
|
||||||
import_queue,
|
|
||||||
..
|
|
||||||
} = crate::service::new_partial(&config)?;
|
|
||||||
Ok((cmd.run(client, import_queue), task_manager))
|
|
||||||
})
|
|
||||||
}
|
|
||||||
Some(Subcommand::PurgeChain(cmd)) => {
|
Some(Subcommand::PurgeChain(cmd)) => {
|
||||||
let runner = cli.create_runner(cmd)?;
|
let runner = cli.create_runner(cmd)?;
|
||||||
|
|
||||||
@@ -222,18 +213,9 @@ pub fn run() -> Result<()> {
|
|||||||
cmd.run(config, polkadot_config)
|
cmd.run(config, polkadot_config)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
Some(Subcommand::Revert(cmd)) => {
|
Some(Subcommand::Revert(cmd)) => construct_async_run! (|components, cli, cmd, config| {
|
||||||
let runner = cli.create_runner(cmd)?;
|
Ok(cmd.run(components.client, components.backend))
|
||||||
runner.async_run(|config| {
|
}),
|
||||||
let PartialComponents {
|
|
||||||
client,
|
|
||||||
task_manager,
|
|
||||||
backend,
|
|
||||||
..
|
|
||||||
} = crate::service::new_partial(&config)?;
|
|
||||||
Ok((cmd.run(client, backend), task_manager))
|
|
||||||
})
|
|
||||||
}
|
|
||||||
Some(Subcommand::ExportGenesisState(params)) => {
|
Some(Subcommand::ExportGenesisState(params)) => {
|
||||||
let mut builder = sc_cli::LoggerBuilder::new("");
|
let mut builder = sc_cli::LoggerBuilder::new("");
|
||||||
builder.with_profiling(sc_tracing::TracingReceiver::Log, "");
|
builder.with_profiling(sc_tracing::TracingReceiver::Log, "");
|
||||||
@@ -281,6 +263,7 @@ pub fn run() -> Result<()> {
|
|||||||
}
|
}
|
||||||
None => {
|
None => {
|
||||||
let runner = cli.create_runner(&*cli.run)?;
|
let runner = cli.create_runner(&*cli.run)?;
|
||||||
|
let use_shell = use_shell_runtime(&runner.config().chain_spec);
|
||||||
|
|
||||||
runner.run_node_until_exit(|config| async move {
|
runner.run_node_until_exit(|config| async move {
|
||||||
// TODO
|
// TODO
|
||||||
@@ -319,10 +302,17 @@ pub fn run() -> Result<()> {
|
|||||||
info!("Parachain genesis state: {}", genesis_state);
|
info!("Parachain genesis state: {}", genesis_state);
|
||||||
info!("Is collating: {}", if collator { "yes" } else { "no" });
|
info!("Is collating: {}", if collator { "yes" } else { "no" });
|
||||||
|
|
||||||
crate::service::start_node(config, key, polkadot_config, id, collator)
|
if use_shell {
|
||||||
.await
|
crate::service::start_shell_node(config, key, polkadot_config, id, collator)
|
||||||
.map(|r| r.0)
|
.await
|
||||||
.map_err(Into::into)
|
.map(|r| r.0)
|
||||||
|
.map_err(Into::into)
|
||||||
|
} else {
|
||||||
|
crate::service::start_node(config, key, polkadot_config, id, collator)
|
||||||
|
.await
|
||||||
|
.map(|r| r.0)
|
||||||
|
.map_err(Into::into)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ use cumulus_client_service::{
|
|||||||
prepare_node_config, start_collator, start_full_node, StartCollatorParams, StartFullNodeParams,
|
prepare_node_config, start_collator, start_full_node, StartCollatorParams, StartFullNodeParams,
|
||||||
};
|
};
|
||||||
use cumulus_primitives_core::ParaId;
|
use cumulus_primitives_core::ParaId;
|
||||||
use parachain_runtime::RuntimeApi;
|
|
||||||
use polkadot_primitives::v0::CollatorPair;
|
use polkadot_primitives::v0::CollatorPair;
|
||||||
use rococo_parachain_primitives::Block;
|
use rococo_parachain_primitives::Block;
|
||||||
use sc_executor::native_executor_instance;
|
use sc_executor::native_executor_instance;
|
||||||
@@ -31,20 +30,28 @@ use sc_service::{Configuration, PartialComponents, Role, TFullBackend, TFullClie
|
|||||||
use sc_telemetry::{Telemetry, TelemetryWorker, TelemetryWorkerHandle};
|
use sc_telemetry::{Telemetry, TelemetryWorker, TelemetryWorkerHandle};
|
||||||
use sp_runtime::traits::BlakeTwo256;
|
use sp_runtime::traits::BlakeTwo256;
|
||||||
use sp_trie::PrefixedMemoryDB;
|
use sp_trie::PrefixedMemoryDB;
|
||||||
|
use sp_api::ConstructRuntimeApi;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
// Native executor instance.
|
// Native executor instance.
|
||||||
native_executor_instance!(
|
native_executor_instance!(
|
||||||
pub Executor,
|
pub RuntimeExecutor,
|
||||||
parachain_runtime::api::dispatch,
|
parachain_runtime::api::dispatch,
|
||||||
parachain_runtime::native_version,
|
parachain_runtime::native_version,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Native executor instance.
|
||||||
|
native_executor_instance!(
|
||||||
|
pub ShellRuntimeExecutor,
|
||||||
|
shell_runtime::api::dispatch,
|
||||||
|
shell_runtime::native_version,
|
||||||
|
);
|
||||||
|
|
||||||
/// Starts a `ServiceBuilder` for a full service.
|
/// Starts a `ServiceBuilder` for a full service.
|
||||||
///
|
///
|
||||||
/// Use this macro if you don't actually need the full service, but just the builder in order to
|
/// 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.
|
/// be able to perform chain operations.
|
||||||
pub fn new_partial(
|
pub fn new_partial<RuntimeApi, Executor>(
|
||||||
config: &Configuration,
|
config: &Configuration,
|
||||||
) -> Result<
|
) -> Result<
|
||||||
PartialComponents<
|
PartialComponents<
|
||||||
@@ -56,7 +63,22 @@ pub fn new_partial(
|
|||||||
(Option<Telemetry>, Option<TelemetryWorkerHandle>),
|
(Option<Telemetry>, Option<TelemetryWorkerHandle>),
|
||||||
>,
|
>,
|
||||||
sc_service::Error,
|
sc_service::Error,
|
||||||
> {
|
> where
|
||||||
|
RuntimeApi: ConstructRuntimeApi<Block, TFullClient<Block, RuntimeApi, Executor>>
|
||||||
|
+ Send
|
||||||
|
+ Sync
|
||||||
|
+ 'static,
|
||||||
|
RuntimeApi::RuntimeApi: sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block>
|
||||||
|
+ sp_api::Metadata<Block>
|
||||||
|
+ sp_session::SessionKeys<Block>
|
||||||
|
+ sp_api::ApiExt<
|
||||||
|
Block,
|
||||||
|
StateBackend = sc_client_api::StateBackendFor<TFullBackend<Block>, Block>,
|
||||||
|
> + 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,
|
||||||
|
{
|
||||||
let inherent_data_providers = sp_inherents::InherentDataProviders::new();
|
let inherent_data_providers = sp_inherents::InherentDataProviders::new();
|
||||||
|
|
||||||
let telemetry = config.telemetry_endpoints.clone()
|
let telemetry = config.telemetry_endpoints.clone()
|
||||||
@@ -122,7 +144,7 @@ pub fn new_partial(
|
|||||||
///
|
///
|
||||||
/// This is the actual implementation that is abstract over the executor and the runtime api.
|
/// This is the actual implementation that is abstract over the executor and the runtime api.
|
||||||
#[sc_tracing::logging::prefix_logs_with("Parachain")]
|
#[sc_tracing::logging::prefix_logs_with("Parachain")]
|
||||||
async fn start_node_impl<RB>(
|
async fn start_node_impl<RuntimeApi, Executor, RB>(
|
||||||
parachain_config: Configuration,
|
parachain_config: Configuration,
|
||||||
collator_key: CollatorPair,
|
collator_key: CollatorPair,
|
||||||
polkadot_config: Configuration,
|
polkadot_config: Configuration,
|
||||||
@@ -131,6 +153,20 @@ async fn start_node_impl<RB>(
|
|||||||
rpc_ext_builder: RB,
|
rpc_ext_builder: RB,
|
||||||
) -> sc_service::error::Result<(TaskManager, Arc<TFullClient<Block, RuntimeApi, Executor>>)>
|
) -> sc_service::error::Result<(TaskManager, Arc<TFullClient<Block, RuntimeApi, Executor>>)>
|
||||||
where
|
where
|
||||||
|
RuntimeApi: ConstructRuntimeApi<Block, TFullClient<Block, RuntimeApi, Executor>>
|
||||||
|
+ Send
|
||||||
|
+ Sync
|
||||||
|
+ 'static,
|
||||||
|
RuntimeApi::RuntimeApi: sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block>
|
||||||
|
+ sp_api::Metadata<Block>
|
||||||
|
+ sp_session::SessionKeys<Block>
|
||||||
|
+ sp_api::ApiExt<
|
||||||
|
Block,
|
||||||
|
StateBackend = sc_client_api::StateBackendFor<TFullBackend<Block>, Block>,
|
||||||
|
> + 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,
|
||||||
RB: Fn(
|
RB: Fn(
|
||||||
Arc<TFullClient<Block, RuntimeApi, Executor>>,
|
Arc<TFullClient<Block, RuntimeApi, Executor>>,
|
||||||
) -> jsonrpc_core::IoHandler<sc_rpc::Metadata>
|
) -> jsonrpc_core::IoHandler<sc_rpc::Metadata>
|
||||||
@@ -143,7 +179,7 @@ where
|
|||||||
|
|
||||||
let parachain_config = prepare_node_config(parachain_config);
|
let parachain_config = prepare_node_config(parachain_config);
|
||||||
|
|
||||||
let params = new_partial(¶chain_config)?;
|
let params = new_partial::<RuntimeApi, Executor>(¶chain_config)?;
|
||||||
params
|
params
|
||||||
.inherent_data_providers
|
.inherent_data_providers
|
||||||
.register_provider(sp_timestamp::InherentDataProvider)
|
.register_provider(sp_timestamp::InherentDataProvider)
|
||||||
@@ -259,21 +295,42 @@ where
|
|||||||
Ok((task_manager, client))
|
Ok((task_manager, client))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Start a normal parachain node.
|
/// Start a rococo-test parachain node.
|
||||||
pub async fn start_node(
|
pub async fn start_node(
|
||||||
parachain_config: Configuration,
|
parachain_config: Configuration,
|
||||||
collator_key: CollatorPair,
|
collator_key: CollatorPair,
|
||||||
polkadot_config: Configuration,
|
polkadot_config: Configuration,
|
||||||
id: ParaId,
|
id: ParaId,
|
||||||
validator: bool,
|
validator: bool,
|
||||||
) -> sc_service::error::Result<(TaskManager, Arc<TFullClient<Block, RuntimeApi, Executor>>)> {
|
) -> sc_service::error::Result<
|
||||||
start_node_impl(
|
(TaskManager, Arc<TFullClient<Block, parachain_runtime::RuntimeApi, RuntimeExecutor>>)
|
||||||
|
> {
|
||||||
|
start_node_impl::<parachain_runtime::RuntimeApi, RuntimeExecutor, _>(
|
||||||
parachain_config,
|
parachain_config,
|
||||||
collator_key,
|
collator_key,
|
||||||
polkadot_config,
|
polkadot_config,
|
||||||
id,
|
id,
|
||||||
validator,
|
validator,
|
||||||
|_| Default::default(),
|
|_| Default::default(),
|
||||||
)
|
).await
|
||||||
.await
|
}
|
||||||
|
|
||||||
|
/// Start a rococo-shell parachain node.
|
||||||
|
pub async fn start_shell_node(
|
||||||
|
parachain_config: Configuration,
|
||||||
|
collator_key: CollatorPair,
|
||||||
|
polkadot_config: Configuration,
|
||||||
|
id: ParaId,
|
||||||
|
validator: bool,
|
||||||
|
) -> sc_service::error::Result<
|
||||||
|
(TaskManager, Arc<TFullClient<Block, shell_runtime::RuntimeApi, ShellRuntimeExecutor>>)
|
||||||
|
> {
|
||||||
|
start_node_impl::<shell_runtime::RuntimeApi, ShellRuntimeExecutor, _>(
|
||||||
|
parachain_config,
|
||||||
|
collator_key,
|
||||||
|
polkadot_config,
|
||||||
|
id,
|
||||||
|
validator,
|
||||||
|
|_| Default::default(),
|
||||||
|
).await
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user