malus: add finality_delay cli flag (#5770)

* add malus_finality_delay flag

* cargo update -p sp-io

* no warnings when malus is disabled

* subpar workaround for feature unification problem

* remove malus_finality_delay from regular cli

* document finality_delay param, rename cli arg
This commit is contained in:
Andronik
2022-07-23 01:24:33 +02:00
committed by GitHub
parent d6334447ae
commit b1f8445d62
6 changed files with 40 additions and 6 deletions
+6 -2
View File
@@ -53,6 +53,8 @@ enum NemesisVariant {
struct MalusCli {
#[clap(subcommand)]
pub variant: NemesisVariant,
/// Sets the minimum delay between the best and finalized block.
pub finality_delay: Option<u32>,
}
fn run_cmd(run: RunCmd) -> Cli {
@@ -62,14 +64,16 @@ fn run_cmd(run: RunCmd) -> Cli {
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)?,
polkadot_cli::run_node(run_cmd(cmd), BackGarbageCandidate, finality_delay)?,
NemesisVariant::SuggestGarbageCandidate(cmd) =>
polkadot_cli::run_node(run_cmd(cmd), BackGarbageCandidateWrapper)?,
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::PvfPrepareWorker(cmd) => {
#[cfg(target_os = "android")]