mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 16:51:02 +00:00
Companion for Substrate#14511 (#2821)
* Companion for Substrate#14511 https://github.com/paritytech/substrate/pull/14511 * update lockfile for {"substrate", "polkadot"} --------- Co-authored-by: parity-processbot <>
This commit is contained in:
@@ -19,19 +19,16 @@ use crate::{
|
||||
cli::{Cli, RelayChainCli, Subcommand},
|
||||
service::{new_partial, Block},
|
||||
};
|
||||
use codec::Encode;
|
||||
use cumulus_client_cli::generate_genesis_block;
|
||||
use cumulus_primitives_core::ParaId;
|
||||
use frame_benchmarking_cli::{BenchmarkCmd, SUBSTRATE_REFERENCE_HARDWARE};
|
||||
use log::{info, warn};
|
||||
use parachains_common::{AssetHubPolkadotAuraId, AuraId};
|
||||
use sc_cli::{
|
||||
ChainSpec, CliConfiguration, DefaultConfigurationValues, ImportParams, KeystoreParams,
|
||||
NetworkParams, Result, RuntimeVersion, SharedParams, SubstrateCli,
|
||||
NetworkParams, Result, SharedParams, SubstrateCli,
|
||||
};
|
||||
use sc_service::config::{BasePath, PrometheusConfig};
|
||||
use sp_core::hexdisplay::HexDisplay;
|
||||
use sp_runtime::traits::{AccountIdConversion, Block as BlockT};
|
||||
use sp_runtime::traits::AccountIdConversion;
|
||||
use std::{net::SocketAddr, path::PathBuf};
|
||||
|
||||
/// Helper enum that is used for better distinction of different parachain/runtime configuration
|
||||
@@ -345,24 +342,6 @@ impl SubstrateCli for Cli {
|
||||
fn load_spec(&self, id: &str) -> std::result::Result<Box<dyn ChainSpec>, String> {
|
||||
load_spec(id)
|
||||
}
|
||||
|
||||
fn native_runtime_version(chain_spec: &Box<dyn ChainSpec>) -> &'static RuntimeVersion {
|
||||
match chain_spec.runtime() {
|
||||
Runtime::AssetHubPolkadot => &asset_hub_polkadot_runtime::VERSION,
|
||||
Runtime::AssetHubKusama => &asset_hub_kusama_runtime::VERSION,
|
||||
Runtime::AssetHubWestend => &asset_hub_westend_runtime::VERSION,
|
||||
Runtime::CollectivesPolkadot | Runtime::CollectivesWestend =>
|
||||
&collectives_polkadot_runtime::VERSION,
|
||||
Runtime::Shell => &shell_runtime::VERSION,
|
||||
Runtime::Seedling => &seedling_runtime::VERSION,
|
||||
Runtime::ContractsRococo => &contracts_rococo_runtime::VERSION,
|
||||
Runtime::BridgeHub(bridge_hub_runtime_type) =>
|
||||
bridge_hub_runtime_type.runtime_version(),
|
||||
Runtime::Penpal(_) => &penpal_runtime::VERSION,
|
||||
Runtime::Glutton => &glutton_runtime::VERSION,
|
||||
Runtime::Default => &rococo_parachain_runtime::VERSION,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl SubstrateCli for RelayChainCli {
|
||||
@@ -399,10 +378,6 @@ impl SubstrateCli for RelayChainCli {
|
||||
fn load_spec(&self, id: &str) -> std::result::Result<Box<dyn ChainSpec>, String> {
|
||||
polkadot_cli::Cli::from_iter([RelayChainCli::executable_name()].iter()).load_spec(id)
|
||||
}
|
||||
|
||||
fn native_runtime_version(chain_spec: &Box<dyn ChainSpec>) -> &'static RuntimeVersion {
|
||||
polkadot_cli::Cli::native_runtime_version(chain_spec)
|
||||
}
|
||||
}
|
||||
|
||||
/// Creates partial components for the runtimes that are supported by the benchmarks.
|
||||
@@ -586,7 +561,7 @@ macro_rules! construct_async_run {
|
||||
runner.async_run(|$config| {
|
||||
let $components = new_partial::<
|
||||
rococo_parachain_runtime::RuntimeApi,
|
||||
_
|
||||
_,
|
||||
>(
|
||||
&$config,
|
||||
crate::service::rococo_parachain_build_import_queue,
|
||||
@@ -660,14 +635,10 @@ pub fn run() -> Result<()> {
|
||||
cmd.run(config, polkadot_config)
|
||||
})
|
||||
},
|
||||
Some(Subcommand::ExportGenesisState(cmd)) => {
|
||||
let runner = cli.create_runner(cmd)?;
|
||||
runner.sync_run(|_config| {
|
||||
let spec = cli.load_spec(&cmd.shared_params.chain.clone().unwrap_or_default())?;
|
||||
let state_version = Cli::native_runtime_version(&spec).state_version();
|
||||
cmd.run::<crate::service::Block>(&*spec, state_version)
|
||||
})
|
||||
},
|
||||
Some(Subcommand::ExportGenesisState(cmd)) =>
|
||||
construct_async_run!(|components, cli, cmd, config| {
|
||||
Ok(async move { cmd.run(&*config.chain_spec, &*components.client) })
|
||||
}),
|
||||
Some(Subcommand::ExportGenesisWasm(cmd)) => {
|
||||
let runner = cli.create_runner(cmd)?;
|
||||
runner.sync_run(|_config| {
|
||||
@@ -797,13 +768,6 @@ pub fn run() -> Result<()> {
|
||||
let parachain_account =
|
||||
AccountIdConversion::<polkadot_primitives::AccountId>::into_account_truncating(&id);
|
||||
|
||||
let state_version = Cli::native_runtime_version(&config.chain_spec).state_version();
|
||||
|
||||
let block: crate::service::Block =
|
||||
generate_genesis_block(&*config.chain_spec, state_version)
|
||||
.map_err(|e| format!("{:?}", e))?;
|
||||
let genesis_state = format!("0x{:?}", HexDisplay::from(&block.header().encode()));
|
||||
|
||||
let tokio_handle = config.tokio_handle.clone();
|
||||
let polkadot_config =
|
||||
SubstrateCli::create_configuration(&polkadot_cli, &polkadot_cli, tokio_handle)
|
||||
@@ -811,11 +775,14 @@ pub fn run() -> Result<()> {
|
||||
|
||||
info!("Parachain id: {:?}", id);
|
||||
info!("Parachain Account: {}", parachain_account);
|
||||
info!("Parachain genesis state: {}", genesis_state);
|
||||
info!("Is collating: {}", if config.role.is_authority() { "yes" } else { "no" });
|
||||
|
||||
if !collator_options.relay_chain_rpc_urls.is_empty() && !cli.relaychain_args.is_empty() {
|
||||
warn!("Detected relay chain node arguments together with --relay-chain-rpc-url. This command starts a minimal Polkadot node that only uses a network-related subset of all relay chain CLI options.");
|
||||
warn!(
|
||||
"Detected relay chain node arguments together with --relay-chain-rpc-url. \
|
||||
This command starts a minimal Polkadot node that only uses a \
|
||||
network-related subset of all relay chain CLI options."
|
||||
);
|
||||
}
|
||||
|
||||
match config.chain_spec.runtime() {
|
||||
|
||||
Reference in New Issue
Block a user