mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-22 07:55:42 +00:00
234c42c2df
* Initial network interface preparations * Implement get_storage_by_key * Implement `validators` and `session_index_for_child` * Implement persisted_validation_data and candidate_pending_availability * Fix method name for persisted_validation_data and add encoded params * Implement `retrieve_dmq_contents` and `retrieve_all_inbound_hrmp_channel_contents` * Implement `prove_read` * Introduce separate RPC client, expose JsonRpSee errors * Simplify closure in call_remote_runtime_function * Implement import stream, upgrade JsonRpSee * Implement finality stream * Remove unused method from interface * Implement `is_major_syncing` * Implement `wait_on_block` * Fix tests * Unify error handling `ApiError` * Replace WaitError with RelayChainError * Wrap BlockChainError in RelayChainError * Unify error handling in relay chain intefaces * Fix return type of proof method * Improve error handling of new methods * Improve error handling and move logging outside of interface * Clean up * Remove unwanted changes, clean up * Remove unused import * Add format for StatemachineError and remove nused From trait * Use 'thiserror' crate to simplify error handling * Expose error for overseer, further simplify error handling * Reintroduce network interface * Implement cli option * Adjust call_state method to use hashes * Disable PoV recovery when RPC is used * Add integration test for network full node * Use Hash instead of BlockId to ensure compatibility with RPC interface * Fix cargo check warnings * Implement retries * Remove `expect` statements from code * Update jsonrpsee to 0.8.0 and make collator keys optional * Make cli arguments conflicting * Remove unused `block_status` method * Add clippy fixes * Cargo fmt * Validate relay chain rpc url * Clean up dependencies and add one more integration test * Clean up * Clean up dependencies of relay-chain-network * Use hash instead of blockid for rpc methods * Fix tests * Update client/cli/src/lib.rs Co-authored-by: Koute <koute@users.noreply.github.com> * Improve error message of cli validation * Add rpc client constructor * Do not use debug formatting for errors * Improve logging for remote runtime methods * Only retry on transport problems * Use PHash by value, rename test * Improve tracing, return error on relay-chain-interface build * Fix naming, use generics instead of deserializing manually * Rename RelayChainLocal and RelayChainNetwork * lock * Format * Use impl trait for encodable runtime payload * Only instantiate full node in tests when we need it * Upgrade scale-codec to 3.0.0 * Improve expect log Co-authored-by: Koute <koute@users.noreply.github.com>
140 lines
4.1 KiB
Rust
140 lines
4.1 KiB
Rust
// Copyright 2019-2021 Parity Technologies (UK) Ltd.
|
|
// This file is part of Cumulus.
|
|
|
|
// Cumulus 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.
|
|
|
|
// Cumulus 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 Cumulus. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
use crate::chain_spec;
|
|
use clap::Parser;
|
|
use sc_cli;
|
|
use std::path::PathBuf;
|
|
|
|
/// Sub-commands supported by the collator.
|
|
#[derive(Debug, clap::Subcommand)]
|
|
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 subcommmand benchmarking runtime pallets.
|
|
#[clap(name = "benchmark", about = "Benchmark runtime pallets.")]
|
|
Benchmark(frame_benchmarking_cli::BenchmarkCmd),
|
|
|
|
/// Try some testing command against a specified runtime state.
|
|
TryRuntime(try_runtime_cli::TryRuntimeCmd),
|
|
|
|
/// Key management CLI utilities
|
|
#[clap(subcommand)]
|
|
Key(sc_cli::KeySubcommand),
|
|
}
|
|
|
|
/// Command for exporting the genesis state of the parachain
|
|
#[derive(Debug, Parser)]
|
|
pub struct ExportGenesisStateCommand {
|
|
/// Output file name or stdout if unspecified.
|
|
#[clap(parse(from_os_str))]
|
|
pub output: Option<PathBuf>,
|
|
|
|
/// Write output in binary. Default is to write in hex.
|
|
#[clap(short, long)]
|
|
pub raw: bool,
|
|
|
|
/// The name of the chain for that the genesis state should be exported.
|
|
#[clap(long)]
|
|
pub chain: Option<String>,
|
|
}
|
|
|
|
/// Command for exporting the genesis wasm file.
|
|
#[derive(Debug, Parser)]
|
|
pub struct ExportGenesisWasmCommand {
|
|
/// Output file name or stdout if unspecified.
|
|
#[clap(parse(from_os_str))]
|
|
pub output: Option<PathBuf>,
|
|
|
|
/// Write output in binary. Default is to write in hex.
|
|
#[clap(short, long)]
|
|
pub raw: bool,
|
|
|
|
/// The name of the chain for that the genesis wasm file should be exported.
|
|
#[clap(long)]
|
|
pub chain: Option<String>,
|
|
}
|
|
|
|
#[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(flatten)]
|
|
pub run: cumulus_client_cli::RunCmd,
|
|
|
|
/// Relay chain arguments
|
|
#[clap(raw = true, conflicts_with = "relay-chain-rpc-url")]
|
|
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::parse_from(relay_chain_args) }
|
|
}
|
|
}
|