Companion for substrate#10632 (#4689)

* Companion for substrate#10632

Signed-off-by: koushiro <koushiro.cqx@gmail.com>

* cargo format

Signed-off-by: koushiro <koushiro.cqx@gmail.com>

* Fix bags-list

Signed-off-by: koushiro <koushiro.cqx@gmail.com>

* Update Substrate

* Fix

Signed-off-by: koushiro <koushiro.cqx@gmail.com>

* Fix bridges test

* FMT

Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>
Co-authored-by: Bastian Köcher <info@kchr.de>
This commit is contained in:
Qinxuan Chen
2022-01-25 18:58:17 +08:00
committed by GitHub
parent 6b7e40cd6c
commit f4ec9b0341
14 changed files with 335 additions and 358 deletions
+2 -2
View File
@@ -13,7 +13,7 @@ name = "malus"
path = "src/malus.rs"
[dependencies]
polkadot-cli = { path = "../../cli", default-features = false, features = [ "cli", "malus" ] }
polkadot-cli = { path = "../../cli", default-features = false, features = ["cli", "malus"] }
polkadot-node-subsystem = { path = "../subsystem" }
polkadot-node-subsystem-util = { path = "../subsystem-util" }
polkadot-node-subsystem-types = { path = "../subsystem-types" }
@@ -26,9 +26,9 @@ polkadot-node-core-pvf = { path = "../core/pvf" }
parity-util-mem = { version = "0.10.0", default-features = false, features = ["jemalloc-global"] }
color-eyre = { version = "0.5.11", default-features = false }
assert_matches = "1.5"
structopt = "0.3.25"
async-trait = "0.1.52"
sp-keystore = { git = "https://github.com/paritytech/substrate", branch = "master" }
clap = { version = "3.0", features = ["derive"] }
futures = "0.3.19"
futures-timer = "3.0.2"
tracing = "0.1.26"
+10 -10
View File
@@ -16,9 +16,9 @@
//! A malus or nemesis node launch code.
use clap::{AppSettings, Parser};
use color_eyre::eyre;
use polkadot_cli::{Cli, RunCmd};
use structopt::StructOpt;
pub(crate) mod interceptor;
pub(crate) mod shared;
@@ -28,9 +28,9 @@ mod variants;
use variants::*;
/// Define the different variants of behavior.
#[derive(Debug, StructOpt)]
#[structopt(about = "Malus - the nemesis of polkadot.")]
#[structopt(rename_all = "kebab-case")]
#[derive(Debug, Parser)]
#[clap(about = "Malus - the nemesis of polkadot.", version)]
#[clap(rename_all = "kebab-case")]
enum NemesisVariant {
/// Suggest a candidate with an invalid proof of validity.
SuggestGarbageCandidate(RunCmd),
@@ -40,18 +40,18 @@ enum NemesisVariant {
DisputeAncestor(RunCmd),
#[allow(missing_docs)]
#[structopt(name = "prepare-worker", setting = structopt::clap::AppSettings::Hidden)]
#[clap(name = "prepare-worker", setting = AppSettings::Hidden)]
PvfPrepareWorker(polkadot_cli::ValidationWorkerCommand),
#[allow(missing_docs)]
#[structopt(name = "execute-worker", setting = structopt::clap::AppSettings::Hidden)]
#[clap(name = "execute-worker", setting = AppSettings::Hidden)]
PvfExecuteWorker(polkadot_cli::ValidationWorkerCommand),
}
#[derive(Debug, StructOpt)]
#[derive(Debug, Parser)]
#[allow(missing_docs)]
struct MalusCli {
#[structopt(subcommand)]
#[clap(subcommand)]
pub variant: NemesisVariant,
}
@@ -99,7 +99,7 @@ impl MalusCli {
fn main() -> eyre::Result<()> {
color_eyre::install()?;
let cli = MalusCli::from_args();
let cli = MalusCli::parse();
cli.launch()?;
Ok(())
}
@@ -110,7 +110,7 @@ mod tests {
#[test]
fn subcommand_works() {
let cli = MalusCli::from_iter_safe(IntoIterator::into_iter([
let cli = MalusCli::try_parse_from(IntoIterator::into_iter([
"malus",
"dispute-ancestor",
"--bob",