mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 14:01:02 +00:00
Fix Polkadot CLI arguments not properly parsed (#163)
* Initial commit
Forked at: d1d40765c7
Parent branch: origin/master
* Fix polkadot cli arguments not properly parsed
* Update test/parachain/src/command.rs
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
This commit is contained in:
@@ -22,7 +22,7 @@ use log::info;
|
|||||||
use parachain_runtime::Block;
|
use parachain_runtime::Block;
|
||||||
use polkadot_parachain::primitives::AccountIdConversion;
|
use polkadot_parachain::primitives::AccountIdConversion;
|
||||||
use sc_cli::{
|
use sc_cli::{
|
||||||
ChainSpec, CliConfiguration, Error, ImportParams, KeystoreParams, NetworkParams, Result, Role,
|
ChainSpec, CliConfiguration, Error, ImportParams, KeystoreParams, NetworkParams, Result,
|
||||||
RuntimeVersion, SharedParams, SubstrateCli,
|
RuntimeVersion, SharedParams, SubstrateCli,
|
||||||
};
|
};
|
||||||
use sc_service::config::{BasePath, PrometheusConfig};
|
use sc_service::config::{BasePath, PrometheusConfig};
|
||||||
@@ -155,7 +155,12 @@ pub fn run() -> Result<()> {
|
|||||||
runner.run_subcommand(subcommand, |mut config| {
|
runner.run_subcommand(subcommand, |mut config| {
|
||||||
let params = crate::service::new_partial(&mut config)?;
|
let params = crate::service::new_partial(&mut config)?;
|
||||||
|
|
||||||
Ok((params.client, params.backend, params.import_queue, params.task_manager))
|
Ok((
|
||||||
|
params.client,
|
||||||
|
params.backend,
|
||||||
|
params.import_queue,
|
||||||
|
params.task_manager,
|
||||||
|
))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
Some(Subcommand::ExportGenesisState(params)) => {
|
Some(Subcommand::ExportGenesisState(params)) => {
|
||||||
@@ -193,10 +198,6 @@ pub fn run() -> Result<()> {
|
|||||||
let genesis_state = format!("0x{:?}", HexDisplay::from(&block.header().encode()));
|
let genesis_state = format!("0x{:?}", HexDisplay::from(&block.header().encode()));
|
||||||
|
|
||||||
runner.run_node_until_exit(|config| {
|
runner.run_node_until_exit(|config| {
|
||||||
if matches!(config.role, Role::Light) {
|
|
||||||
return Err("Light client not supporter!".into());
|
|
||||||
}
|
|
||||||
|
|
||||||
polkadot_cli.base_path =
|
polkadot_cli.base_path =
|
||||||
config.base_path.as_ref().map(|x| x.path().join("polkadot"));
|
config.base_path.as_ref().map(|x| x.path().join("polkadot"));
|
||||||
|
|
||||||
@@ -208,9 +209,19 @@ pub fn run() -> Result<()> {
|
|||||||
info!("Parachain id: {:?}", id);
|
info!("Parachain id: {:?}", id);
|
||||||
info!("Parachain Account: {}", parachain_account);
|
info!("Parachain Account: {}", parachain_account);
|
||||||
info!("Parachain genesis state: {}", genesis_state);
|
info!("Parachain genesis state: {}", genesis_state);
|
||||||
|
info!(
|
||||||
|
"Is collating: {}",
|
||||||
|
if cli.run.base.validator { "yes" } else { "no" }
|
||||||
|
);
|
||||||
|
|
||||||
crate::service::run_collator(config, key, polkadot_config, id, cli.run.base.validator)
|
crate::service::run_collator(
|
||||||
.map(|(x, _)| x)
|
config,
|
||||||
|
key,
|
||||||
|
polkadot_config,
|
||||||
|
id,
|
||||||
|
cli.run.base.validator,
|
||||||
|
)
|
||||||
|
.map(|(x, _)| x)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -254,6 +265,10 @@ impl CliConfiguration for PolkadotCli {
|
|||||||
)?))
|
)?))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn rpc_ipc(&self) -> Result<Option<String>> {
|
||||||
|
self.base.base.rpc_ipc()
|
||||||
|
}
|
||||||
|
|
||||||
fn rpc_ws(&self) -> Result<Option<SocketAddr>> {
|
fn rpc_ws(&self) -> Result<Option<SocketAddr>> {
|
||||||
let ws_external = self.base.base.ws_external;
|
let ws_external = self.base.base.ws_external;
|
||||||
let unsafe_ws_external = self.base.base.unsafe_ws_external;
|
let unsafe_ws_external = self.base.base.unsafe_ws_external;
|
||||||
@@ -294,6 +309,54 @@ impl CliConfiguration for PolkadotCli {
|
|||||||
fn init<C: SubstrateCli>(&self) -> Result<()> {
|
fn init<C: SubstrateCli>(&self) -> Result<()> {
|
||||||
unreachable!("PolkadotCli is never initialized; qed");
|
unreachable!("PolkadotCli is never initialized; qed");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn role(&self, is_dev: bool) -> Result<sc_service::Role> {
|
||||||
|
self.base.base.role(is_dev)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn transaction_pool(&self) -> Result<sc_service::config::TransactionPoolOptions> {
|
||||||
|
self.base.base.transaction_pool()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn state_cache_child_ratio(&self) -> Result<Option<usize>> {
|
||||||
|
self.base.base.state_cache_child_ratio()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn rpc_methods(&self) -> Result<sc_service::config::RpcMethods> {
|
||||||
|
self.base.base.rpc_methods()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn rpc_ws_max_connections(&self) -> Result<Option<usize>> {
|
||||||
|
self.base.base.rpc_ws_max_connections()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn rpc_cors(&self, is_dev: bool) -> Result<Option<Vec<String>>> {
|
||||||
|
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()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn force_authoring(&self) -> Result<bool> {
|
||||||
|
self.base.base.force_authoring()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn disable_grandpa(&self) -> Result<bool> {
|
||||||
|
self.base.base.disable_grandpa()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn max_runtime_instances(&self) -> Result<Option<usize>> {
|
||||||
|
self.base.base.max_runtime_instances()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn announce_block(&self) -> Result<bool> {
|
||||||
|
self.base.base.announce_block()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// copied directly from substrate
|
// copied directly from substrate
|
||||||
|
|||||||
@@ -108,6 +108,13 @@ pub fn run_collator(
|
|||||||
TaskManager,
|
TaskManager,
|
||||||
Arc<TFullClient<parachain_runtime::opaque::Block, parachain_runtime::RuntimeApi, crate::service::Executor>>,
|
Arc<TFullClient<parachain_runtime::opaque::Block, parachain_runtime::RuntimeApi, crate::service::Executor>>,
|
||||||
)> {
|
)> {
|
||||||
|
if matches!(parachain_config.role, Role::Light) {
|
||||||
|
return Err("Light client not supported!".into());
|
||||||
|
}
|
||||||
|
if matches!(polkadot_config.role, Role::Light) {
|
||||||
|
return Err("Light client not supported!".into());
|
||||||
|
}
|
||||||
|
|
||||||
let mut parachain_config = prepare_collator_config(parachain_config);
|
let mut parachain_config = prepare_collator_config(parachain_config);
|
||||||
|
|
||||||
parachain_config.informant_output_format = OutputFormat {
|
parachain_config.informant_output_format = OutputFormat {
|
||||||
|
|||||||
Reference in New Issue
Block a user