mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-06 11:28:02 +00:00
6963272451
* draft * revert * WIP * all that remains is tests * update Cargo.lock * tests WIP * WIP refactor node-template-runtime and node-runtime * implments sc_cli::RuntimeAdapter for node_template_runtime::Runtime * final draft * fix update_config for subcommands * proper AccountId decoding * test-runtime tests * revert * move RuntimeAdapter to cli-utils * use &'static str for TryFrom::<&'a str>::Error for Ss58AddressFormat * tests * add frame-system to sc-cli dev-dependencies * add frame-system to sc-cli dev-dependencies * fix ui test * wip * fixed inspect test * bump impl version * bump impl version, fixx spaces remove todos * pallet-balances-cli, rustc for some reason cannot resolve pallet_balances_cli in node-cli 😩 * wip * Subcommand::run takes &self * can't believe i missed that 🤦🏾♂️ * bump wasm-bindgen for some reason * adds key subcommand, rename generate-node-key to generate-node-id * cargo update and crossed fingers 🤞🏽 * update ui test * update more ui tests * should be all good now * revert subkey change * revert subkey change * adds frame-utilities-cli * Apply suggestions from code review Co-authored-by: Benjamin Kampmann <ben@gnunicorn.org> * removes frame from sc-cli, fix license * my editor and ci disagrees on line width * bump spec version * turn off default features for parity-scale-codec * enable full_crypto feature for sp-core in cli-utils * merge frame-utilities-cli with pallet-balances-cli * remove full_crypto feature from sp_core in cli-utils * bump Cargo.lock * cli-utils -> frame-utils * rename BlockNumber to GenericNumber, fix spaces * fix spaces * construct additional_signed manually * sign test * remove unused vars * implement subkey with frame-utilities-cli and sc_cli * fix moduleid test * CI and clion disagree on line widths * adds associated Params type to SignedExtensionProvider * Apply suggestions from code review Co-authored-by: Benjamin Kampmann <ben@gnunicorn.org> * move some code around * removes unneccesary generic params * moves module_id back to frame_utilities_cli * Apply suggestions from code review Co-authored-by: Benjamin Kampmann <ben@gnunicorn.org> Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> * remove print_ext * remove MaybeDisplay from pallet_balances::Trait::Balance * a lot of stuff tbh * adds ExtrasParamsBuilder * remove tests for ModuleIdCmd * address comments from PR * bump Cargo.lock * manually insert key into keystore * remove unnecessary SharedParams * add validation to vanity pattern, remove unused arg * remove SharedParams from Sign, Vanity, Verify * remove SharedParams from ModuleIdCmd, remove expect from Verify, new line to Cargo.toml * remove SharedParams from InsertCmd * 🤦🏾♂️ * deleted prometheus.yml * move a few things around * fix vanity test Co-authored-by: Benjamin Kampmann <ben@gnunicorn.org> Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> Co-authored-by: Benjamin Kampmann <ben@parity.io>
110 lines
3.4 KiB
Rust
110 lines
3.4 KiB
Rust
// This file is part of Substrate.
|
|
|
|
// Copyright (C) 2017-2020 Parity Technologies (UK) Ltd.
|
|
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
|
|
|
|
// This program 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.
|
|
|
|
// This program 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 this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
use crate::{chain_spec, service, Cli, Subcommand};
|
|
use node_executor::Executor;
|
|
use node_runtime::{Block, RuntimeApi};
|
|
use sc_cli::{Result, SubstrateCli, RuntimeVersion, Role, ChainSpec};
|
|
use sc_service::PartialComponents;
|
|
use crate::service::new_partial;
|
|
|
|
impl SubstrateCli for Cli {
|
|
fn impl_name() -> String {
|
|
"Substrate Node".into()
|
|
}
|
|
|
|
fn impl_version() -> String {
|
|
env!("SUBSTRATE_CLI_IMPL_VERSION").into()
|
|
}
|
|
|
|
fn description() -> String {
|
|
env!("CARGO_PKG_DESCRIPTION").into()
|
|
}
|
|
|
|
fn author() -> String {
|
|
env!("CARGO_PKG_AUTHORS").into()
|
|
}
|
|
|
|
fn support_url() -> String {
|
|
"https://github.com/paritytech/substrate/issues/new".into()
|
|
}
|
|
|
|
fn copyright_start_year() -> i32 {
|
|
2017
|
|
}
|
|
|
|
fn load_spec(&self, id: &str) -> std::result::Result<Box<dyn sc_service::ChainSpec>, String> {
|
|
Ok(match id {
|
|
"dev" => Box::new(chain_spec::development_config()),
|
|
"local" => Box::new(chain_spec::local_testnet_config()),
|
|
"" | "fir" | "flaming-fir" => Box::new(chain_spec::flaming_fir_config()?),
|
|
"staging" => Box::new(chain_spec::staging_testnet_config()),
|
|
path => Box::new(chain_spec::ChainSpec::from_json_file(
|
|
std::path::PathBuf::from(path),
|
|
)?),
|
|
})
|
|
}
|
|
|
|
fn native_runtime_version(_: &Box<dyn ChainSpec>) -> &'static RuntimeVersion {
|
|
&node_runtime::VERSION
|
|
}
|
|
}
|
|
|
|
/// Parse command line arguments into service configuration.
|
|
pub fn run() -> Result<()> {
|
|
let cli = Cli::from_args();
|
|
|
|
match &cli.subcommand {
|
|
None => {
|
|
let runner = cli.create_runner(&cli.run)?;
|
|
runner.run_node_until_exit(|config| match config.role {
|
|
Role::Light => service::new_light(config),
|
|
_ => service::new_full(config),
|
|
})
|
|
}
|
|
Some(Subcommand::Inspect(cmd)) => {
|
|
let runner = cli.create_runner(cmd)?;
|
|
|
|
runner.sync_run(|config| cmd.run::<Block, RuntimeApi, Executor>(config))
|
|
}
|
|
Some(Subcommand::Benchmark(cmd)) => {
|
|
if cfg!(feature = "runtime-benchmarks") {
|
|
let runner = cli.create_runner(cmd)?;
|
|
|
|
runner.sync_run(|config| cmd.run::<Block, Executor>(config))
|
|
} else {
|
|
println!("Benchmarking wasn't enabled when building the node. \
|
|
You can enable it with `--features runtime-benchmarks`.");
|
|
Ok(())
|
|
}
|
|
}
|
|
Some(Subcommand::Key(cmd)) => cmd.run(),
|
|
Some(Subcommand::Sign(cmd)) => cmd.run(),
|
|
Some(Subcommand::Verify(cmd)) => cmd.run(),
|
|
Some(Subcommand::Vanity(cmd)) => cmd.run(),
|
|
Some(Subcommand::Base(subcommand)) => {
|
|
let runner = cli.create_runner(subcommand)?;
|
|
runner.run_subcommand(subcommand, |config| {
|
|
let PartialComponents { client, backend, task_manager, import_queue, ..}
|
|
= new_partial(&config)?;
|
|
Ok((client, backend, import_queue, task_manager))
|
|
})
|
|
}
|
|
}
|
|
}
|