mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 04:41: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:
Generated
+265
-265
File diff suppressed because it is too large
Load Diff
@@ -11,6 +11,7 @@ url = "2.4.0"
|
||||
|
||||
# Substrate
|
||||
sc-cli = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
sc-chain-spec = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
sc-service = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
|
||||
@@ -27,6 +27,7 @@ use std::{
|
||||
|
||||
use codec::Encode;
|
||||
use sc_chain_spec::ChainSpec;
|
||||
use sc_client_api::ExecutorProvider;
|
||||
use sc_service::{
|
||||
config::{PrometheusConfig, TelemetryEndpoints},
|
||||
BasePath, TransactionPoolOptions,
|
||||
@@ -149,9 +150,14 @@ impl ExportGenesisStateCommand {
|
||||
pub fn run<Block: BlockT>(
|
||||
&self,
|
||||
chain_spec: &dyn ChainSpec,
|
||||
genesis_state_version: StateVersion,
|
||||
client: &impl ExecutorProvider<Block>,
|
||||
) -> sc_cli::Result<()> {
|
||||
let block: Block = generate_genesis_block(chain_spec, genesis_state_version)?;
|
||||
let state_version = sc_chain_spec::resolve_state_version_from_wasm(
|
||||
&chain_spec.build_storage()?,
|
||||
client.executor(),
|
||||
)?;
|
||||
|
||||
let block: Block = generate_genesis_block(chain_spec, state_version)?;
|
||||
let raw_header = block.header().encode();
|
||||
let output_buf = if self.raw {
|
||||
raw_header
|
||||
|
||||
@@ -22,7 +22,7 @@ sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master
|
||||
sp-state-machine = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
|
||||
# Polkadot
|
||||
polkadot-cli = { git = "https://github.com/paritytech/polkadot", branch = "master", default-features = false, features = ["cli", "polkadot-native"] }
|
||||
polkadot-cli = { git = "https://github.com/paritytech/polkadot", branch = "master", default-features = false, features = ["cli"] }
|
||||
polkadot-service = { git = "https://github.com/paritytech/polkadot", branch = "master" }
|
||||
|
||||
# Cumulus
|
||||
|
||||
@@ -1,18 +1,15 @@
|
||||
use std::net::SocketAddr;
|
||||
|
||||
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 parachain_template_runtime::Block;
|
||||
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 crate::{
|
||||
chain_spec,
|
||||
@@ -63,10 +60,6 @@ impl SubstrateCli for Cli {
|
||||
fn load_spec(&self, id: &str) -> std::result::Result<Box<dyn sc_service::ChainSpec>, String> {
|
||||
load_spec(id)
|
||||
}
|
||||
|
||||
fn native_runtime_version(_: &Box<dyn ChainSpec>) -> &'static RuntimeVersion {
|
||||
¶chain_template_runtime::VERSION
|
||||
}
|
||||
}
|
||||
|
||||
impl SubstrateCli for RelayChainCli {
|
||||
@@ -103,10 +96,6 @@ impl SubstrateCli for RelayChainCli {
|
||||
fn load_spec(&self, id: &str) -> std::result::Result<Box<dyn sc_service::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)
|
||||
}
|
||||
}
|
||||
|
||||
macro_rules! construct_async_run {
|
||||
@@ -175,10 +164,10 @@ pub fn run() -> Result<()> {
|
||||
},
|
||||
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::<Block>(&*spec, state_version)
|
||||
runner.sync_run(|config| {
|
||||
let partials = new_partial(&config)?;
|
||||
|
||||
cmd.run(&*config.chain_spec, &*partials.client)
|
||||
})
|
||||
},
|
||||
Some(Subcommand::ExportGenesisWasm(cmd)) => {
|
||||
@@ -258,11 +247,12 @@ pub fn run() -> Result<()> {
|
||||
let collator_options = cli.run.collator_options();
|
||||
|
||||
runner.run_node_until_exit(|config| async move {
|
||||
let hwbench = (!cli.no_hardware_benchmarks).then_some(
|
||||
config.database.path().map(|database_path| {
|
||||
let hwbench = (!cli.no_hardware_benchmarks)
|
||||
.then_some(config.database.path().map(|database_path| {
|
||||
let _ = std::fs::create_dir_all(database_path);
|
||||
sc_sysinfo::gather_hwbench(Some(database_path))
|
||||
})).flatten();
|
||||
}))
|
||||
.flatten();
|
||||
|
||||
let para_id = chain_spec::Extensions::try_get(&*config.chain_spec)
|
||||
.map(|e| e.para_id)
|
||||
@@ -276,25 +266,26 @@ pub fn run() -> Result<()> {
|
||||
let id = ParaId::from(para_id);
|
||||
|
||||
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: Block = generate_genesis_block(&*config.chain_spec, state_version)
|
||||
.map_err(|e| format!("{:?}", e))?;
|
||||
let genesis_state = format!("0x{:?}", HexDisplay::from(&block.header().encode()));
|
||||
AccountIdConversion::<polkadot_primitives::AccountId>::into_account_truncating(
|
||||
&id,
|
||||
);
|
||||
|
||||
let tokio_handle = config.tokio_handle.clone();
|
||||
let polkadot_config =
|
||||
SubstrateCli::create_configuration(&polkadot_cli, &polkadot_cli, tokio_handle)
|
||||
.map_err(|err| format!("Relay chain argument error: {}", err))?;
|
||||
|
||||
info!("Parachain id: {:?}", id);
|
||||
info!("Parachain Account: {}", parachain_account);
|
||||
info!("Parachain genesis state: {}", genesis_state);
|
||||
info!("Parachain Account: {parachain_account}");
|
||||
info!("Is collating: {}", if config.role.is_authority() { "yes" } else { "no" });
|
||||
|
||||
if !collator_options.relay_chain_rpc_urls.is_empty() && !cli.relay_chain_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.");
|
||||
if !collator_options.relay_chain_rpc_urls.is_empty() &&
|
||||
!cli.relay_chain_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."
|
||||
);
|
||||
}
|
||||
|
||||
crate::service::start_parachain_node(
|
||||
|
||||
@@ -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`.
|
||||
|
||||
@@ -19,7 +19,7 @@ use std::{net::SocketAddr, path::PathBuf};
|
||||
use polkadot_service::{ChainSpec, ParaId, PrometheusConfig};
|
||||
use sc_cli::{
|
||||
CliConfiguration, DefaultConfigurationValues, ImportParams, KeystoreParams, NetworkParams,
|
||||
Result as CliResult, RuntimeVersion, SharedParams, SubstrateCli,
|
||||
Result as CliResult, SharedParams, SubstrateCli,
|
||||
};
|
||||
use sc_service::BasePath;
|
||||
|
||||
@@ -296,10 +296,6 @@ impl SubstrateCli for TestCollatorCli {
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
fn native_runtime_version(_: &Box<dyn ChainSpec>) -> &'static RuntimeVersion {
|
||||
&cumulus_test_service::runtime::VERSION
|
||||
}
|
||||
}
|
||||
|
||||
impl SubstrateCli for RelayChainCli {
|
||||
@@ -337,8 +333,4 @@ impl SubstrateCli for RelayChainCli {
|
||||
<polkadot_cli::Cli as SubstrateCli>::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)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,14 +103,6 @@ fn main() -> Result<(), sc_cli::Error> {
|
||||
¶chain_id,
|
||||
);
|
||||
|
||||
let state_version =
|
||||
RelayChainCli::native_runtime_version(&config.chain_spec).state_version();
|
||||
|
||||
let block: parachains_common::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)
|
||||
@@ -118,7 +110,6 @@ fn main() -> Result<(), sc_cli::Error> {
|
||||
|
||||
tracing::info!("Parachain id: {:?}", parachain_id);
|
||||
tracing::info!("Parachain Account: {}", parachain_account);
|
||||
tracing::info!("Parachain genesis state: {}", genesis_state);
|
||||
tracing::info!(
|
||||
"Is collating: {}",
|
||||
if config.role.is_authority() { "yes" } else { "no" }
|
||||
|
||||
Reference in New Issue
Block a user