mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-14 13:21:10 +00:00
Expose node subcommands in Malus CLI (#6135)
* Expose the full Cli through malus Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * fix lonely test Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>
This commit is contained in:
@@ -18,7 +18,7 @@
|
||||
|
||||
use clap::Parser;
|
||||
use color_eyre::eyre;
|
||||
use polkadot_cli::{Cli, RunCmd};
|
||||
use polkadot_cli::Cli;
|
||||
|
||||
pub(crate) mod interceptor;
|
||||
pub(crate) mod shared;
|
||||
@@ -33,9 +33,9 @@ use variants::*;
|
||||
#[clap(rename_all = "kebab-case")]
|
||||
enum NemesisVariant {
|
||||
/// Suggest a candidate with an invalid proof of validity.
|
||||
SuggestGarbageCandidate(RunCmd),
|
||||
SuggestGarbageCandidate(Cli),
|
||||
/// Back a candidate with a specifically crafted proof of validity.
|
||||
BackGarbageCandidate(RunCmd),
|
||||
BackGarbageCandidate(Cli),
|
||||
/// Delayed disputing of ancestors that are perfectly fine.
|
||||
DisputeAncestor(DisputeAncestorOptions),
|
||||
|
||||
@@ -57,24 +57,24 @@ struct MalusCli {
|
||||
pub finality_delay: Option<u32>,
|
||||
}
|
||||
|
||||
fn run_cmd(run: RunCmd) -> Cli {
|
||||
Cli { subcommand: None, run }
|
||||
}
|
||||
|
||||
impl MalusCli {
|
||||
/// Launch a malus node.
|
||||
fn launch(self) -> eyre::Result<()> {
|
||||
let finality_delay = self.finality_delay;
|
||||
match self.variant {
|
||||
NemesisVariant::BackGarbageCandidate(cmd) =>
|
||||
polkadot_cli::run_node(run_cmd(cmd), BackGarbageCandidate, finality_delay)?,
|
||||
NemesisVariant::SuggestGarbageCandidate(cmd) =>
|
||||
polkadot_cli::run_node(run_cmd(cmd), BackGarbageCandidateWrapper, finality_delay)?,
|
||||
NemesisVariant::DisputeAncestor(opts) => polkadot_cli::run_node(
|
||||
run_cmd(opts.clone().cmd),
|
||||
DisputeValidCandidates::new(opts),
|
||||
finality_delay,
|
||||
)?,
|
||||
NemesisVariant::BackGarbageCandidate(cli) =>
|
||||
polkadot_cli::run_node(cli, BackGarbageCandidate, finality_delay)?,
|
||||
NemesisVariant::SuggestGarbageCandidate(cli) =>
|
||||
polkadot_cli::run_node(cli, BackGarbageCandidateWrapper, finality_delay)?,
|
||||
NemesisVariant::DisputeAncestor(opts) => {
|
||||
let DisputeAncestorOptions { fake_validation, fake_validation_error, cli } = opts;
|
||||
|
||||
polkadot_cli::run_node(
|
||||
cli,
|
||||
DisputeValidCandidates { fake_validation, fake_validation_error },
|
||||
finality_delay,
|
||||
)?
|
||||
},
|
||||
NemesisVariant::PvfPrepareWorker(cmd) => {
|
||||
#[cfg(target_os = "android")]
|
||||
{
|
||||
@@ -126,7 +126,7 @@ mod tests {
|
||||
variant: NemesisVariant::DisputeAncestor(run),
|
||||
..
|
||||
} => {
|
||||
assert!(run.cmd.base.bob);
|
||||
assert!(run.cli.run.base.bob);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user