mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 10:31:03 +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:
@@ -74,7 +74,8 @@ pallet-transaction-payment-rpc = { git = "https://github.com/paritytech/substrat
|
||||
substrate-state-trie-migration-rpc = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
|
||||
# Polkadot
|
||||
polkadot-cli = { git = "https://github.com/paritytech/polkadot", branch = "master" }
|
||||
# Use rococo-native as this is currently the default "local" relay chain
|
||||
polkadot-cli = { git = "https://github.com/paritytech/polkadot", branch = "master", features = ["rococo-native"] }
|
||||
polkadot-primitives = { git = "https://github.com/paritytech/polkadot", branch = "master" }
|
||||
polkadot-service = { git = "https://github.com/paritytech/polkadot", branch = "master" }
|
||||
xcm = { git = "https://github.com/paritytech/polkadot", branch = "master" }
|
||||
@@ -99,8 +100,6 @@ nix = { version = "0.26.1", features = ["signal"] }
|
||||
tempfile = "3.6.0"
|
||||
tokio = { version = "1.29.1", features = ["macros", "time", "parking_lot"] }
|
||||
wait-timeout = "0.2"
|
||||
# purge_chain_works works with rococo-local and needs to allow this
|
||||
polkadot-cli = { git = "https://github.com/paritytech/polkadot", branch = "master", features = ["rococo-native"] }
|
||||
|
||||
[features]
|
||||
default = []
|
||||
|
||||
@@ -18,7 +18,6 @@ use crate::chain_spec::{get_account_id_from_seed, get_collator_keys_from_seed};
|
||||
use cumulus_primitives_core::ParaId;
|
||||
use parachains_common::Balance as BridgeHubBalance;
|
||||
use sc_chain_spec::ChainSpec;
|
||||
use sc_cli::RuntimeVersion;
|
||||
use sp_core::sr25519;
|
||||
use std::{path::PathBuf, str::FromStr};
|
||||
|
||||
@@ -165,26 +164,6 @@ impl BridgeHubRuntimeType {
|
||||
))),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn runtime_version(&self) -> &'static RuntimeVersion {
|
||||
match self {
|
||||
BridgeHubRuntimeType::Polkadot |
|
||||
BridgeHubRuntimeType::PolkadotLocal |
|
||||
BridgeHubRuntimeType::PolkadotDevelopment => &bridge_hub_polkadot_runtime::VERSION,
|
||||
BridgeHubRuntimeType::Kusama |
|
||||
BridgeHubRuntimeType::KusamaLocal |
|
||||
BridgeHubRuntimeType::KusamaDevelopment => &bridge_hub_kusama_runtime::VERSION,
|
||||
BridgeHubRuntimeType::Westend => &bridge_hub_kusama_runtime::VERSION,
|
||||
BridgeHubRuntimeType::Rococo |
|
||||
BridgeHubRuntimeType::RococoLocal |
|
||||
BridgeHubRuntimeType::RococoDevelopment |
|
||||
BridgeHubRuntimeType::Wococo |
|
||||
BridgeHubRuntimeType::WococoLocal => {
|
||||
// this is intentional, for Rococo/Wococo we just want to have one runtime, which is configured for both sides
|
||||
&bridge_hub_rococo_runtime::VERSION
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Check if 'id' satisfy BridgeHub-like format
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -317,7 +317,7 @@ where
|
||||
&task_manager,
|
||||
)?;
|
||||
|
||||
let params = PartialComponents {
|
||||
Ok(PartialComponents {
|
||||
backend,
|
||||
client,
|
||||
import_queue,
|
||||
@@ -326,9 +326,7 @@ where
|
||||
transaction_pool,
|
||||
select_chain: (),
|
||||
other: (block_import, telemetry, telemetry_worker_handle),
|
||||
};
|
||||
|
||||
Ok(params)
|
||||
})
|
||||
}
|
||||
|
||||
/// Start a shell node with the given parachain `Configuration` and relay chain `Configuration`.
|
||||
|
||||
Reference in New Issue
Block a user