mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 23:51:01 +00:00
4d42bb22f3
* cargo update -p parachain-info * flush * it compiles * clippy * temporary add more logging to cargo deny * Revert "temporary add more logging to cargo deny" This reverts commit 20daa88bca6d9a01dbe933579b1d57ae5c3a7bd8. * list installed Rust binaries before running cargo deny * changed prev commit * once again * try cargo update? * post-update fixes (nothing important)
110 lines
3.2 KiB
Rust
110 lines
3.2 KiB
Rust
// Copyright 2020-2021 Parity Technologies (UK) Ltd.
|
|
// This file is part of Parity Bridges Common.
|
|
|
|
// Parity Bridges Common is free software: you can redistribute it and/or modify
|
|
// it under the terms of the GNU General Public License as published by
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
// (at your option) any later version.
|
|
|
|
// Parity Bridges Common is distributed in the hope that it will be useful,
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
// GNU General Public License for more details.
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
// along with Parity Bridges Common. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
#![allow(clippy::large_enum_variant)]
|
|
|
|
use crate::chain_spec;
|
|
use clap::Parser;
|
|
use cumulus_client_cli::{ExportGenesisStateCommand, ExportGenesisWasmCommand};
|
|
use std::path::PathBuf;
|
|
|
|
/// Sub-commands supported by the collator.
|
|
#[derive(Debug, Parser)]
|
|
pub enum Subcommand {
|
|
/// Export the genesis state of the parachain.
|
|
#[clap(name = "export-genesis-state")]
|
|
ExportGenesisState(ExportGenesisStateCommand),
|
|
|
|
/// Export the genesis wasm of the parachain.
|
|
#[clap(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 subcommand benchmarking runtime pallets.
|
|
#[clap(subcommand)]
|
|
Benchmark(frame_benchmarking_cli::BenchmarkCmd),
|
|
}
|
|
|
|
#[derive(Debug, Parser)]
|
|
#[clap(
|
|
propagate_version = true,
|
|
args_conflicts_with_subcommands = true,
|
|
subcommand_negates_reqs = true
|
|
)]
|
|
pub struct Cli {
|
|
#[clap(subcommand)]
|
|
pub subcommand: Option<Subcommand>,
|
|
|
|
#[clap(long)]
|
|
pub parachain_id: Option<u32>,
|
|
|
|
#[clap(flatten)]
|
|
pub run: cumulus_client_cli::RunCmd,
|
|
|
|
/// Relaychain arguments
|
|
#[clap(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.path().join("rialto-bridge-node");
|
|
Self {
|
|
base_path: Some(base_path),
|
|
chain_id,
|
|
base: polkadot_cli::RunCmd::parse_from(relay_chain_args),
|
|
}
|
|
}
|
|
}
|