mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-01 11:17:56 +00:00
391d2f5241
* Add Canvas node as Parachain template * Remove `pallet-contracts` * Point to local Cumulus dependency * Use double quotes instead of single quotes * Get rid of GPL licensing * Remove references to Canvas * Get rid of warnings * Remove GLP-3 License copy-pasta file * Copy in README from `substrate-parachain-template` * Add mention of `polkadot-launch` tool * Add missing screenshot asset * Remove Canvas hidden files and scripts * Rename `template` to `parachain-template` * Remove a few more Canvas references * Add `pallet-template` * Get `pallet-template` compiling * Remove TODOs about Weights * Sort some dependencies * Remove contracts specific const * Change binary name back to `parachain-collator` * RustFmt * Fix mock tests * Purge sneaky whitespace * Add template pallet index to runtime Co-authored-by: Ricardo Rius <9488369+riusricardo@users.noreply.github.com> * Add force authoring to collator `polkadot-launch` config Co-authored-by: Ricardo Rius <9488369+riusricardo@users.noreply.github.com> * Refer README readers to `substrate-parachain-template` * Remove license header in `build.rs` Co-authored-by: Michael Müller <michi@parity.io> * Fix punctuation nitpick Co-authored-by: Michael Müller <michi@parity.io> * Remove unused `lib.rs` file * Add note about Rococo network Co-authored-by: Ricardo Rius <9488369+riusricardo@users.noreply.github.com> Co-authored-by: Michael Müller <michi@parity.io>
122 lines
3.5 KiB
Rust
122 lines
3.5 KiB
Rust
use crate::chain_spec;
|
|
use std::path::PathBuf;
|
|
use structopt::StructOpt;
|
|
|
|
/// Sub-commands supported by the collator.
|
|
#[derive(Debug, StructOpt)]
|
|
pub enum Subcommand {
|
|
/// Export the genesis state of the parachain.
|
|
#[structopt(name = "export-genesis-state")]
|
|
ExportGenesisState(ExportGenesisStateCommand),
|
|
|
|
/// Export the genesis wasm of the parachain.
|
|
#[structopt(name = "export-genesis-wasm")]
|
|
ExportGenesisWasm(ExportGenesisWasmCommand),
|
|
|
|
/// Build a chain specification.
|
|
BuildSpec(sc_cli::BuildSpecCmd),
|
|
|
|
/// Validate blocks.
|
|
CheckBlock(sc_cli::CheckBlockCmd),
|
|
|
|
/// Export blocks.
|
|
ExportBlocks(sc_cli::ExportBlocksCmd),
|
|
|
|
/// Export the state of a given block into a chain spec.
|
|
ExportState(sc_cli::ExportStateCmd),
|
|
|
|
/// Import blocks.
|
|
ImportBlocks(sc_cli::ImportBlocksCmd),
|
|
|
|
/// Remove the whole chain.
|
|
PurgeChain(cumulus_client_cli::PurgeChainCmd),
|
|
|
|
/// Revert the chain to a previous state.
|
|
Revert(sc_cli::RevertCmd),
|
|
|
|
/// The custom benchmark subcommmand benchmarking runtime pallets.
|
|
#[structopt(name = "benchmark", about = "Benchmark runtime pallets.")]
|
|
Benchmark(frame_benchmarking_cli::BenchmarkCmd),
|
|
}
|
|
|
|
/// Command for exporting the genesis state of the parachain
|
|
#[derive(Debug, StructOpt)]
|
|
pub struct ExportGenesisStateCommand {
|
|
/// Output file name or stdout if unspecified.
|
|
#[structopt(parse(from_os_str))]
|
|
pub output: Option<PathBuf>,
|
|
|
|
/// Id of the parachain this state is for.
|
|
///
|
|
/// Default: 100
|
|
#[structopt(long, conflicts_with = "chain")]
|
|
pub parachain_id: Option<u32>,
|
|
|
|
/// Write output in binary. Default is to write in hex.
|
|
#[structopt(short, long)]
|
|
pub raw: bool,
|
|
|
|
/// The name of the chain for that the genesis state should be exported.
|
|
#[structopt(long, conflicts_with = "parachain-id")]
|
|
pub chain: Option<String>,
|
|
}
|
|
|
|
/// Command for exporting the genesis wasm file.
|
|
#[derive(Debug, StructOpt)]
|
|
pub struct ExportGenesisWasmCommand {
|
|
/// Output file name or stdout if unspecified.
|
|
#[structopt(parse(from_os_str))]
|
|
pub output: Option<PathBuf>,
|
|
|
|
/// Write output in binary. Default is to write in hex.
|
|
#[structopt(short, long)]
|
|
pub raw: bool,
|
|
|
|
/// The name of the chain for that the genesis wasm file should be exported.
|
|
#[structopt(long)]
|
|
pub chain: Option<String>,
|
|
}
|
|
|
|
#[derive(Debug, StructOpt)]
|
|
#[structopt(settings = &[
|
|
structopt::clap::AppSettings::GlobalVersion,
|
|
structopt::clap::AppSettings::ArgsNegateSubcommands,
|
|
structopt::clap::AppSettings::SubcommandsNegateReqs,
|
|
])]
|
|
pub struct Cli {
|
|
#[structopt(subcommand)]
|
|
pub subcommand: Option<Subcommand>,
|
|
|
|
#[structopt(flatten)]
|
|
pub run: cumulus_client_cli::RunCmd,
|
|
|
|
/// Relaychain arguments
|
|
#[structopt(raw = true)]
|
|
pub relaychain_args: Vec<String>,
|
|
}
|
|
|
|
#[derive(Debug)]
|
|
pub struct RelayChainCli {
|
|
/// The actual relay chain cli object.
|
|
pub base: polkadot_cli::RunCmd,
|
|
|
|
/// Optional chain id that should be passed to the relay chain.
|
|
pub chain_id: Option<String>,
|
|
|
|
/// The base path that should be used by the relay chain.
|
|
pub base_path: Option<PathBuf>,
|
|
}
|
|
|
|
impl RelayChainCli {
|
|
/// Parse the relay chain CLI parameters using the para chain `Configuration`.
|
|
pub fn new<'a>(
|
|
para_config: &sc_service::Configuration,
|
|
relay_chain_args: impl Iterator<Item = &'a String>,
|
|
) -> Self {
|
|
let extension = chain_spec::Extensions::try_get(&*para_config.chain_spec);
|
|
let chain_id = extension.map(|e| e.relay_chain.clone());
|
|
let base_path = para_config.base_path.as_ref().map(|x| x.path().join("polkadot"));
|
|
Self { base_path, chain_id, base: polkadot_cli::RunCmd::from_iter(relay_chain_args) }
|
|
}
|
|
}
|