From 4ef3c22327aa75f7f8601e909d564c740eb286ed Mon Sep 17 00:00:00 2001 From: Overkillus Date: Mon, 6 Nov 2023 17:37:44 +0000 Subject: [PATCH 01/26] simple passthrough interceptor --- polkadot/node/malus/src/malus.rs | 11 ++ .../variants/dispute_finalized_candidates.rs | 132 ++++++++++++++++++ polkadot/node/malus/src/variants/mod.rs | 2 + 3 files changed, 145 insertions(+) create mode 100644 polkadot/node/malus/src/variants/dispute_finalized_candidates.rs diff --git a/polkadot/node/malus/src/malus.rs b/polkadot/node/malus/src/malus.rs index 69dd7c869fc0..994961a224ba 100644 --- a/polkadot/node/malus/src/malus.rs +++ b/polkadot/node/malus/src/malus.rs @@ -36,6 +36,8 @@ enum NemesisVariant { BackGarbageCandidate(BackGarbageCandidateOptions), /// Delayed disputing of ancestors that are perfectly fine. DisputeAncestor(DisputeAncestorOptions), + /// Delayed disputing of finalized candidates. + DisputeFinalizedCandidates(DisputeFinalizedCandidatesOptions), } #[derive(Debug, Parser)] @@ -80,6 +82,15 @@ impl MalusCli { finality_delay, )? }, + NemesisVariant::DisputeFinalizedCandidates(opts) => { + let DisputeFinalizedCandidatesOptions { dispute_offset, cli } = opts; + + polkadot_cli::run_node( + cli, + DisputeFinalizedCandidates { dispute_offset }, + finality_delay, + )? + }, } Ok(()) } diff --git a/polkadot/node/malus/src/variants/dispute_finalized_candidates.rs b/polkadot/node/malus/src/variants/dispute_finalized_candidates.rs new file mode 100644 index 000000000000..fedc80f210e1 --- /dev/null +++ b/polkadot/node/malus/src/variants/dispute_finalized_candidates.rs @@ -0,0 +1,132 @@ +// Copyright (C) Parity Technologies (UK) Ltd. +// This file is part of Polkadot. + +// Polkadot 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. + +// Polkadot 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 Polkadot. If not, see . + +//! A malicious node variant that attempts to dispute finalized candidates. +//! +//! Attention: For usage with `zombienet` only! + +#![allow(missing_docs)] + +use polkadot_cli::{ + prepared_overseer_builder, + service::{ + AuthorityDiscoveryApi, AuxStore, BabeApi, Block, Error, HeaderBackend, Overseer, + OverseerConnector, OverseerGen, OverseerGenArgs, OverseerHandle, ParachainHost, + ProvideRuntimeApi, + }, + Cli, +}; +use polkadot_node_subsystem::{messages::ApprovalVotingMessage, SpawnGlue}; +use polkadot_node_subsystem_types::{DefaultSubsystemClient, OverseerSignal}; +use sp_core::traits::SpawnNamed; +use futures::channel::oneshot; + +// Filter wrapping related types. +use crate::{ + interceptor::*, + shared::MALUS, +}; + +use std::sync::Arc; + +/// Wraps around ApprovalVotingSubsystem and replaces it. +/// Listens to finalization messages and if possible triggers disputes for their ancestors. +#[derive(Clone)] +struct AncestorDisputer { + spawner: Spawner, //stores the actual ApprovalVotingSubsystem spawner + dispute_offset: u32, //relative depth of the disputed block to the finalized block, 0=finalized, 1=parent of finalized +} + +impl MessageInterceptor for AncestorDisputer +where + Sender: overseer::ApprovalVotingSenderTrait + Clone + Send + 'static, + Spawner: overseer::gen::Spawner + Clone + 'static, +{ + type Message = ApprovalVotingMessage; + + /// Intercept incoming `OverseerSignal::BlockFinalized' and pass the rest as normal. + fn intercept_incoming( + &self, + subsystem_sender: &mut Sender, + msg: FromOrchestra, + ) -> Option> { + match msg { + FromOrchestra::Communication{msg} => Some(FromOrchestra::Communication{msg}), + FromOrchestra::Signal(OverseerSignal::BlockFinalized(h, n)) => { + + gum::info!( + target: MALUS, + "😈 Block Finalized Interception!" + ); + + // Passthrough the finalization signal as usual (using it as hook only) + Some(FromOrchestra::Signal(OverseerSignal::BlockFinalized(h, n))) + }, + FromOrchestra::Signal(signal) => Some(FromOrchestra::Signal(signal)), + } + } +} + +//---------------------------------------------------------------------------------- + +#[derive(Debug, clap::Parser)] +#[clap(rename_all = "kebab-case")] +#[allow(missing_docs)] +pub struct DisputeFinalizedCandidatesOptions { + /// relative depth of the disputed block to the finalized block, 0=finalized, 1=parent of finalized + #[clap(long, ignore_case = true, default_value_t = 2, value_parser = clap::value_parser!(u32).range(0..=10))] + pub dispute_offset: u32, + + #[clap(flatten)] + pub cli: Cli, +} +/// DisputeFinalizedCandidates implementation wrapper which implements `OverseerGen` glue. +pub(crate) struct DisputeFinalizedCandidates { + /// relative depth of the disputed block to the finalized block, 0=finalized, 1=parent of finalized + pub dispute_offset: u32, +} + +impl OverseerGen for DisputeFinalizedCandidates { + fn generate( + &self, + connector: OverseerConnector, + args: OverseerGenArgs<'_, Spawner, RuntimeClient>, + ) -> Result< + (Overseer, Arc>>, OverseerHandle), + Error, + > + where + RuntimeClient: 'static + ProvideRuntimeApi + HeaderBackend + AuxStore, + RuntimeClient::Api: ParachainHost + BabeApi + AuthorityDiscoveryApi, + Spawner: 'static + SpawnNamed + Clone + Unpin, + { + gum::info!( + target: MALUS, + "😈 Started Malus node that disputes finalized blocks after they are {:?} finalizations deep.", + &self.dispute_offset, + ); + + let ancestor_disputer = AncestorDisputer { + spawner: SpawnGlue(args.spawner.clone()), + dispute_offset: self.dispute_offset, + }; + + prepared_overseer_builder(args)? + .replace_approval_voting(move |cb| InterceptedSubsystem::new(cb, ancestor_disputer)) + .build_with_connector(connector) + .map_err(|e| e.into()) + } +} diff --git a/polkadot/node/malus/src/variants/mod.rs b/polkadot/node/malus/src/variants/mod.rs index 3789f33ac98b..d39e68f2caec 100644 --- a/polkadot/node/malus/src/variants/mod.rs +++ b/polkadot/node/malus/src/variants/mod.rs @@ -20,10 +20,12 @@ mod back_garbage_candidate; mod common; mod dispute_valid_candidates; mod suggest_garbage_candidate; +mod dispute_finalized_candidates; pub(crate) use self::{ back_garbage_candidate::{BackGarbageCandidateOptions, BackGarbageCandidates}, dispute_valid_candidates::{DisputeAncestorOptions, DisputeValidCandidates}, suggest_garbage_candidate::{SuggestGarbageCandidateOptions, SuggestGarbageCandidates}, + dispute_finalized_candidates::{DisputeFinalizedCandidatesOptions, DisputeFinalizedCandidates}, }; pub(crate) use common::*; From 46f6fc375ae81823a85ab0d812c4a0334432677c Mon Sep 17 00:00:00 2001 From: Overkillus Date: Mon, 6 Nov 2023 17:38:03 +0000 Subject: [PATCH 02/26] fixing docs --- polkadot/node/malus/src/variants/common.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/polkadot/node/malus/src/variants/common.rs b/polkadot/node/malus/src/variants/common.rs index 365b2f16ac21..ec716071c0d3 100644 --- a/polkadot/node/malus/src/variants/common.rs +++ b/polkadot/node/malus/src/variants/common.rs @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with Polkadot. If not, see . -//! Implements common code for nemesis. Currently, only `FakeValidationResult` +//! Implements common code for nemesis. Currently, only `ReplaceValidationResult` //! interceptor is implemented. use crate::{ interceptor::*, From ac283de0a541ad1ac6a5166b5f1cf6310a783f45 Mon Sep 17 00:00:00 2001 From: Overkillus Date: Mon, 6 Nov 2023 17:38:24 +0000 Subject: [PATCH 03/26] simple network for testing logs --- .../functional/0006-dispute-finalized.toml | 69 +++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 polkadot/zombienet_tests/functional/0006-dispute-finalized.toml diff --git a/polkadot/zombienet_tests/functional/0006-dispute-finalized.toml b/polkadot/zombienet_tests/functional/0006-dispute-finalized.toml new file mode 100644 index 000000000000..b04e3011cd1e --- /dev/null +++ b/polkadot/zombienet_tests/functional/0006-dispute-finalized.toml @@ -0,0 +1,69 @@ +[settings] +timeout = 1000 + +[relaychain.genesis.runtime.configuration.config] + max_validators_per_core = 5 + needed_approvals = 4 + +[relaychain] +default_image = "{{ZOMBIENET_INTEGRATION_TEST_IMAGE}}" +chain = "rococo-local" +chain_spec_command = "polkadot build-spec --chain rococo-local --disable-default-bootnode" +default_command = "polkadot" + +[relaychain.default_resources] +limits = { memory = "4G", cpu = "2" } +requests = { memory = "2G", cpu = "1" } + + [[relaychain.nodes]] + image = "{{MALUS_IMAGE}}" + name = "alice" + command = "malus dispute-finalized-candidates" + args = [ "--alice", " -lparachain=debug,MALUS=trace" ] + + [[relaychain.nodes]] + name = "bob" + args = [ "--bob", "-lparachain=debug"] + + [[relaychain.nodes]] + name = "charlie" + args = [ "--charlie", "-lparachain=debug" ] + + [[relaychain.nodes]] + name = "dave" + args = [ "--dave", "-lparachain=debug"] + + [[relaychain.nodes]] + name = "ferdie" + args = [ "--ferdie", "-lparachain=debug" ] + + [[relaychain.nodes]] + name = "eve" + args = [ "--eve", "-lparachain=debug"] + + [[relaychain.nodes]] + name = "one" + args = [ "--one", "-lparachain=debug" ] + + [[relaychain.nodes]] + name = "two" + args = [ "--two", "-lparachain=debug"] + +{% for id in range(2000,2004) %} +[[parachains]] +id = {{id}} +addToGenesis = true +genesis_state_generator = "undying-collator export-genesis-state --pov-size={{25000*(id-1999)}} --pvf-complexity={{id - 1999}}" + + [parachains.collator] + image = "{{COL_IMAGE}}" + name = "collator" + command = "undying-collator" + args = ["-lparachain=debug", "--pov-size={{25000*(id-1999)}}", "--parachain-id={{id}}", "--pvf-complexity={{id - 1999}}"] + +{% endfor %} + +[types.Header] +number = "u64" +parent_hash = "Hash" +post_state = "Hash" From b2972c8ea32774dccf0712aa1d8af800e3ea56fa Mon Sep 17 00:00:00 2001 From: Overkillus Date: Mon, 6 Nov 2023 17:39:57 +0000 Subject: [PATCH 04/26] ancestor hash finder --- .../variants/dispute_finalized_candidates.rs | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/polkadot/node/malus/src/variants/dispute_finalized_candidates.rs b/polkadot/node/malus/src/variants/dispute_finalized_candidates.rs index fedc80f210e1..f49ec45f499c 100644 --- a/polkadot/node/malus/src/variants/dispute_finalized_candidates.rs +++ b/polkadot/node/malus/src/variants/dispute_finalized_candidates.rs @@ -72,6 +72,48 @@ where "😈 Block Finalized Interception!" ); + //Ensure that the block is actually deep enough to be disputed + if n <= self.dispute_offset { + return Some(FromOrchestra::Signal(OverseerSignal::BlockFinalized(h, n))); + } + + let dispute_offset = self.dispute_offset; + let mut sender = subsystem_sender.clone(); + self.spawner.spawn_blocking( + "malus-dispute-finalized-block", + Some("malus"), + Box::pin(async move { + // Query chain for the block header at the disputed depth + let (tx, rx) = oneshot::channel(); + sender.send_message(ChainApiMessage::FinalizedBlockHash(n - dispute_offset, tx)).await; + + // Fetch hash of the block to be disputed + let disputable_hash = match rx.await { + Ok(Ok(Some(hash))) => hash, + _ => { + gum::info!( + target: MALUS, + "😈 Target ancestor already out of scope!" + ); + return; // Early return from the async block + }, + }; + + gum::info!( + target: MALUS, + "😈 Time to dispute: {:?}", disputable_hash + ); + + // Start dispute + // subsystem_sender.send_unbounded_message(DisputeCoordinatorMessage::IssueLocalStatement( + // session_index, + // candidate_hash, + // candidate.clone(), + // false, // indicates candidate is invalid -> dispute starts + // )); + }), + ); + // Passthrough the finalization signal as usual (using it as hook only) Some(FromOrchestra::Signal(OverseerSignal::BlockFinalized(h, n))) }, From 0eee9251d52ff1c8672d486993f7a3a9f2a37fa6 Mon Sep 17 00:00:00 2001 From: Maciej Date: Tue, 7 Nov 2023 12:45:25 +0000 Subject: [PATCH 05/26] remove chain spec command Co-authored-by: Javier Viola --- polkadot/zombienet_tests/functional/0006-dispute-finalized.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/polkadot/zombienet_tests/functional/0006-dispute-finalized.toml b/polkadot/zombienet_tests/functional/0006-dispute-finalized.toml index b04e3011cd1e..b4ad097f1ccc 100644 --- a/polkadot/zombienet_tests/functional/0006-dispute-finalized.toml +++ b/polkadot/zombienet_tests/functional/0006-dispute-finalized.toml @@ -8,7 +8,6 @@ timeout = 1000 [relaychain] default_image = "{{ZOMBIENET_INTEGRATION_TEST_IMAGE}}" chain = "rococo-local" -chain_spec_command = "polkadot build-spec --chain rococo-local --disable-default-bootnode" default_command = "polkadot" [relaychain.default_resources] From 9d51a37730f0d5b91eec0d2b3c48c41e9f22ae4a Mon Sep 17 00:00:00 2001 From: Overkillus Date: Tue, 7 Nov 2023 17:38:33 +0000 Subject: [PATCH 06/26] fetch session, token candidate and start a dispute --- .../variants/dispute_finalized_candidates.rs | 92 ++++++++++++++++--- 1 file changed, 78 insertions(+), 14 deletions(-) diff --git a/polkadot/node/malus/src/variants/dispute_finalized_candidates.rs b/polkadot/node/malus/src/variants/dispute_finalized_candidates.rs index f49ec45f499c..2dc7bdf53753 100644 --- a/polkadot/node/malus/src/variants/dispute_finalized_candidates.rs +++ b/polkadot/node/malus/src/variants/dispute_finalized_candidates.rs @@ -31,6 +31,8 @@ use polkadot_cli::{ }; use polkadot_node_subsystem::{messages::ApprovalVotingMessage, SpawnGlue}; use polkadot_node_subsystem_types::{DefaultSubsystemClient, OverseerSignal}; +use polkadot_node_subsystem_util::request_candidate_events; +use polkadot_primitives::CandidateEvent; use sp_core::traits::SpawnNamed; use futures::channel::oneshot; @@ -69,10 +71,10 @@ where gum::info!( target: MALUS, - "😈 Block Finalized Interception!" + "😈 Block Finalization Interception! Block: {:?}", h, ); - //Ensure that the block is actually deep enough to be disputed + //Ensure that the chain is long enough for the target ancestor to exist if n <= self.dispute_offset { return Some(FromOrchestra::Signal(OverseerSignal::BlockFinalized(h, n))); } @@ -83,34 +85,96 @@ where "malus-dispute-finalized-block", Some("malus"), Box::pin(async move { - // Query chain for the block header at the disputed depth + // Query chain for the block hash at the target depth let (tx, rx) = oneshot::channel(); sender.send_message(ChainApiMessage::FinalizedBlockHash(n - dispute_offset, tx)).await; - - // Fetch hash of the block to be disputed let disputable_hash = match rx.await { - Ok(Ok(Some(hash))) => hash, + Ok(Ok(Some(hash))) => { + gum::info!( + target: MALUS, + "😈 Time to search {:?}`th ancestor! Block: {:?}", dispute_offset, hash, + ); + hash + }, _ => { gum::info!( target: MALUS, - "😈 Target ancestor already out of scope!" + "😈 Seems the target is not yet finalized! Nothing to dispute." + ); + return; // Early return from the async block + }, + }; + + // Fetch all candidate events for the target ancestor + let events = request_candidate_events(disputable_hash, &mut sender).await.await; + let events = match events { + Ok(Ok(events)) => events, + Ok(Err(e)) => { + gum::error!( + target: MALUS, + "😈 Failed to fetch candidate events: {:?}", e + ); + return; // Early return from the async block + }, + Err(e) => { + gum::error!( + target: MALUS, + "😈 Failed to fetch candidate events: {:?}", e ); return; // Early return from the async block }, + }; + // log all events for debugging + for event in events.iter() { + gum::info!( + target: MALUS, + "😈 Event: {:?}", event + ); + } + + // Extract a token candidate from the events to use for disputing + let event = events.iter().find(|event| matches!(event, CandidateEvent::CandidateIncluded(_,_,_,_))); + let candidate = match event { + Some(CandidateEvent::CandidateIncluded(candidate,_,_,_)) => candidate, + _ => { + gum::error!( + target: MALUS, + "😈 No candidate included event found! Nothing to dispute." + ); + return; // Early return from the async block + }, + }; + + // Extract the candidate hash from the candidate + let candidate_hash = candidate.hash(); + + // Fetch the session index for the candidate + let (tx, rx) = oneshot::channel(); + sender.send_message(RuntimeApiMessage::Request(disputable_hash, RuntimeApiRequest::SessionIndexForChild(tx))).await; + let session_index = match rx.await { + Ok(Ok(session_index)) => session_index, + _ => { + gum::error!( + target: MALUS, + "😈 Failed to fetch session index for candidate." + ); + return; // Early return from the async block + }, + }; gum::info!( target: MALUS, - "😈 Time to dispute: {:?}", disputable_hash + "😈 Disputing candidate with hash: {:?} in session {:?}", candidate_hash, session_index, ); // Start dispute - // subsystem_sender.send_unbounded_message(DisputeCoordinatorMessage::IssueLocalStatement( - // session_index, - // candidate_hash, - // candidate.clone(), - // false, // indicates candidate is invalid -> dispute starts - // )); + sender.send_unbounded_message(DisputeCoordinatorMessage::IssueLocalStatement( + session_index, + candidate_hash, + candidate.clone(), + false, // indicates candidate is invalid -> dispute starts + )); }), ); From 51f58190e56f5975244cc04944e6b0418b28baca Mon Sep 17 00:00:00 2001 From: Overkillus Date: Wed, 15 Nov 2023 12:03:29 +0000 Subject: [PATCH 07/26] dispute fresh finalizations --- .../variants/dispute_finalized_candidates.rs | 24 +++++------ .../functional/0006-dispute-finalized.toml | 41 ++++--------------- .../functional/0006-dispute-finalized.zndsl | 35 ++++++++++++++++ 3 files changed, 55 insertions(+), 45 deletions(-) create mode 100644 polkadot/zombienet_tests/functional/0006-dispute-finalized.zndsl diff --git a/polkadot/node/malus/src/variants/dispute_finalized_candidates.rs b/polkadot/node/malus/src/variants/dispute_finalized_candidates.rs index 2dc7bdf53753..9639d6e337a2 100644 --- a/polkadot/node/malus/src/variants/dispute_finalized_candidates.rs +++ b/polkadot/node/malus/src/variants/dispute_finalized_candidates.rs @@ -16,6 +16,13 @@ //! A malicious node variant that attempts to dispute finalized candidates. //! +//! This malus variant behaves honestly in backing and approval voting. +//! The maliciosunes comes from emitting an extra dispute statement on top of the other ones. +//! +//! Some extra quirks which generally should be insignificant: +//! - The malus node will not dispute at session boundaries +//! - The malus node will not dispute blocks it backed itself +//! //! Attention: For usage with `zombienet` only! #![allow(missing_docs)] @@ -49,7 +56,7 @@ use std::sync::Arc; #[derive(Clone)] struct AncestorDisputer { spawner: Spawner, //stores the actual ApprovalVotingSubsystem spawner - dispute_offset: u32, //relative depth of the disputed block to the finalized block, 0=finalized, 1=parent of finalized + dispute_offset: u32, //relative depth of the disputed block to the finalized block, 0=finalized, 1=parent of finalized etc } impl MessageInterceptor for AncestorDisputer @@ -68,7 +75,6 @@ where match msg { FromOrchestra::Communication{msg} => Some(FromOrchestra::Communication{msg}), FromOrchestra::Signal(OverseerSignal::BlockFinalized(h, n)) => { - gum::info!( target: MALUS, "😈 Block Finalization Interception! Block: {:?}", h, @@ -126,14 +132,6 @@ where }; - // log all events for debugging - for event in events.iter() { - gum::info!( - target: MALUS, - "😈 Event: {:?}", event - ); - } - // Extract a token candidate from the events to use for disputing let event = events.iter().find(|event| matches!(event, CandidateEvent::CandidateIncluded(_,_,_,_))); let candidate = match event { @@ -192,8 +190,8 @@ where #[clap(rename_all = "kebab-case")] #[allow(missing_docs)] pub struct DisputeFinalizedCandidatesOptions { - /// relative depth of the disputed block to the finalized block, 0=finalized, 1=parent of finalized - #[clap(long, ignore_case = true, default_value_t = 2, value_parser = clap::value_parser!(u32).range(0..=10))] + /// relative depth of the disputed block to the finalized block, 0=finalized, 1=parent of finalized etc + #[clap(long, ignore_case = true, default_value_t = 2, value_parser = clap::value_parser!(u32).range(0..=50))] pub dispute_offset: u32, #[clap(flatten)] @@ -201,7 +199,7 @@ pub struct DisputeFinalizedCandidatesOptions { } /// DisputeFinalizedCandidates implementation wrapper which implements `OverseerGen` glue. pub(crate) struct DisputeFinalizedCandidates { - /// relative depth of the disputed block to the finalized block, 0=finalized, 1=parent of finalized + /// relative depth of the disputed block to the finalized block, 0=finalized, 1=parent of finalized etc pub dispute_offset: u32, } diff --git a/polkadot/zombienet_tests/functional/0006-dispute-finalized.toml b/polkadot/zombienet_tests/functional/0006-dispute-finalized.toml index b4ad097f1ccc..369c8658d94f 100644 --- a/polkadot/zombienet_tests/functional/0006-dispute-finalized.toml +++ b/polkadot/zombienet_tests/functional/0006-dispute-finalized.toml @@ -2,8 +2,8 @@ timeout = 1000 [relaychain.genesis.runtime.configuration.config] - max_validators_per_core = 5 - needed_approvals = 4 + max_validators_per_core = 2 + needed_approvals = 3 [relaychain] default_image = "{{ZOMBIENET_INTEGRATION_TEST_IMAGE}}" @@ -14,39 +14,16 @@ default_command = "polkadot" limits = { memory = "4G", cpu = "2" } requests = { memory = "2G", cpu = "1" } + [[relaychain.node_groups]] + name = "honest" + count = 12 + args = ["-lparachain=debug"] + [[relaychain.nodes]] image = "{{MALUS_IMAGE}}" - name = "alice" + name = "malus" command = "malus dispute-finalized-candidates" - args = [ "--alice", " -lparachain=debug,MALUS=trace" ] - - [[relaychain.nodes]] - name = "bob" - args = [ "--bob", "-lparachain=debug"] - - [[relaychain.nodes]] - name = "charlie" - args = [ "--charlie", "-lparachain=debug" ] - - [[relaychain.nodes]] - name = "dave" - args = [ "--dave", "-lparachain=debug"] - - [[relaychain.nodes]] - name = "ferdie" - args = [ "--ferdie", "-lparachain=debug" ] - - [[relaychain.nodes]] - name = "eve" - args = [ "--eve", "-lparachain=debug"] - - [[relaychain.nodes]] - name = "one" - args = [ "--one", "-lparachain=debug" ] - - [[relaychain.nodes]] - name = "two" - args = [ "--two", "-lparachain=debug"] + args = [ "--alice", "-lparachain=debug,MALUS=trace", "--dispute-offset=3" ] {% for id in range(2000,2004) %} [[parachains]] diff --git a/polkadot/zombienet_tests/functional/0006-dispute-finalized.zndsl b/polkadot/zombienet_tests/functional/0006-dispute-finalized.zndsl new file mode 100644 index 000000000000..06b104ad4a0f --- /dev/null +++ b/polkadot/zombienet_tests/functional/0006-dispute-finalized.zndsl @@ -0,0 +1,35 @@ +Description: Test if disputes triggered on finalized blocks within scope always end as valid. +Network: ./0006-dispute-finalized.toml +Creds: config + +# Check authority status and peers. +malus: reports node_roles is 4 +honest: reports node_roles is 4 + +# Ensure parachains are registered. +honest: parachain 2000 is registered within 30 seconds +honest: parachain 2001 is registered within 30 seconds +honest: parachain 2002 is registered within 30 seconds +honest: parachain 2003 is registered within 30 seconds + +# Ensure parachains made progress. +honest: parachain 2000 block height is at least 10 within 200 seconds +honest: parachain 2001 block height is at least 10 within 200 seconds +honest: parachain 2002 block height is at least 10 within 200 seconds +honest: parachain 2003 block height is at least 10 within 200 seconds + +# Ensure that malus is already attempting to dispute +malus: log line contains "😈 Disputing candidate with hash:" within 180 seconds + +# Check if disputes are initiated and concluded. +honest: reports polkadot_parachain_candidate_disputes_total is at least 2 within 30 seconds +honest: reports polkadot_parachain_candidate_dispute_concluded{validity="valid"} is at least 2 within 30 seconds +honest: reports polkadot_parachain_candidate_dispute_concluded{validity="invalid"} is 0 within 30 seconds + +# Check lag - approval +honest: reports polkadot_parachain_approval_checking_finality_lag is 0 + +# Check lag - dispute conclusion +honest: reports polkadot_parachain_disputes_finality_lag is 0 + + From 6276028b95f109ee2622b9add7fad207b0632d02 Mon Sep 17 00:00:00 2001 From: Overkillus Date: Wed, 15 Nov 2023 12:03:41 +0000 Subject: [PATCH 08/26] dispute stale finalizations --- .../functional/0007-dispute-finalized.toml | 45 +++++++++++++++++++ .../functional/0007-dispute-finalized.zndsl | 27 +++++++++++ 2 files changed, 72 insertions(+) create mode 100644 polkadot/zombienet_tests/functional/0007-dispute-finalized.toml create mode 100644 polkadot/zombienet_tests/functional/0007-dispute-finalized.zndsl diff --git a/polkadot/zombienet_tests/functional/0007-dispute-finalized.toml b/polkadot/zombienet_tests/functional/0007-dispute-finalized.toml new file mode 100644 index 000000000000..e685ed47ef24 --- /dev/null +++ b/polkadot/zombienet_tests/functional/0007-dispute-finalized.toml @@ -0,0 +1,45 @@ +[settings] +timeout = 1000 + +[relaychain.genesis.runtime.configuration.config] + max_validators_per_core = 2 + needed_approvals = 3 + +[relaychain] +default_image = "{{ZOMBIENET_INTEGRATION_TEST_IMAGE}}" +chain = "rococo-local" +default_command = "polkadot" + +[relaychain.default_resources] +limits = { memory = "4G", cpu = "2" } +requests = { memory = "2G", cpu = "1" } + + [[relaychain.node_groups]] + name = "honest" + count = 12 + args = ["-lparachain=debug"] + + [[relaychain.nodes]] + image = "{{MALUS_IMAGE}}" + name = "malus" + command = "malus dispute-finalized-candidates" + args = [ "--alice", "-lparachain=debug,MALUS=trace", "--dispute-offset=14" ] + +{% for id in range(2000,2004) %} +[[parachains]] +id = {{id}} +addToGenesis = true +genesis_state_generator = "undying-collator export-genesis-state --pov-size={{25000*(id-1999)}} --pvf-complexity={{id - 1999}}" + + [parachains.collator] + image = "{{COL_IMAGE}}" + name = "collator" + command = "undying-collator" + args = ["-lparachain=debug", "--pov-size={{25000*(id-1999)}}", "--parachain-id={{id}}", "--pvf-complexity={{id - 1999}}"] + +{% endfor %} + +[types.Header] +number = "u64" +parent_hash = "Hash" +post_state = "Hash" diff --git a/polkadot/zombienet_tests/functional/0007-dispute-finalized.zndsl b/polkadot/zombienet_tests/functional/0007-dispute-finalized.zndsl new file mode 100644 index 000000000000..bccf5bb8ab0d --- /dev/null +++ b/polkadot/zombienet_tests/functional/0007-dispute-finalized.zndsl @@ -0,0 +1,27 @@ +Description: Test if disputes triggered on finalized blocks out of scope never get to be confirmed and concluded. +Network: ./0007-dispute-finalized.toml +Creds: config + +# Check authority status and peers. +malus: reports node_roles is 4 +honest: reports node_roles is 4 + + +# Ensure parachains are registered. +honest: parachain 2000 is registered within 30 seconds +honest: parachain 2001 is registered within 30 seconds +honest: parachain 2002 is registered within 30 seconds +honest: parachain 2003 is registered within 30 seconds + +# Ensure parachains made progress. +honest: parachain 2000 block height is at least 20 within 300 seconds +honest: parachain 2001 block height is at least 20 within 300 seconds +honest: parachain 2002 block height is at least 20 within 300 seconds +honest: parachain 2003 block height is at least 20 within 300 seconds + +# Ensure that malus is already attempting to dispute +malus: log line contains "😈 Disputing candidate with hash:" within 180 seconds + +# Ensure that honest nodes don't participate and conclude any disputes +honest: count of log lines containing "Dispute on candidate concluded" is 0 within 30 seconds + From 10b0a633f836433fa822756e64ce0e938b13657d Mon Sep 17 00:00:00 2001 From: Overkillus Date: Wed, 15 Nov 2023 13:19:35 +0000 Subject: [PATCH 09/26] variant unit tests --- polkadot/node/malus/src/malus.rs | 34 ++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/polkadot/node/malus/src/malus.rs b/polkadot/node/malus/src/malus.rs index 994961a224ba..3afe78116d64 100644 --- a/polkadot/node/malus/src/malus.rs +++ b/polkadot/node/malus/src/malus.rs @@ -195,4 +195,38 @@ mod tests { assert!(run.cli.run.base.bob); }); } + + #[test] + fn dispute_finalized_candidates_works() { + let cli = MalusCli::try_parse_from(IntoIterator::into_iter([ + "malus", + "dispute-finalized-candidates", + "--bob", + ])) + .unwrap(); + assert_matches::assert_matches!(cli, MalusCli { + variant: NemesisVariant::DisputeFinalizedCandidates(run), + .. + } => { + assert!(run.cli.run.base.bob); + }); + } + + #[test] + fn dispute_finalized_offset_works() { + let cli = MalusCli::try_parse_from(IntoIterator::into_iter([ + "malus", + "dispute-finalized-candidates", + "--dispute-offset", + "13", + "--bob", + ])) + .unwrap(); + assert_matches::assert_matches!(cli, MalusCli { + variant: NemesisVariant::DisputeFinalizedCandidates(run), + .. + } => { + assert!(run.cli.run.base.bob); + }); + } } From 6668931c29d518e53fbe68bd0e748d3a3c049f82 Mon Sep 17 00:00:00 2001 From: Overkillus Date: Tue, 21 Nov 2023 15:58:54 +0000 Subject: [PATCH 10/26] better test naming --- ...spute-finalized.toml => 0006-dispute-freshly-finalized.toml} | 0 ...ute-finalized.zndsl => 0006-dispute-freshly-finalized.zndsl} | 2 +- ...7-dispute-finalized.toml => 0007-dispute-old-finalized.toml} | 0 ...dispute-finalized.zndsl => 0007-dispute-old-finalized.zndsl} | 2 +- 4 files changed, 2 insertions(+), 2 deletions(-) rename polkadot/zombienet_tests/functional/{0006-dispute-finalized.toml => 0006-dispute-freshly-finalized.toml} (100%) rename polkadot/zombienet_tests/functional/{0006-dispute-finalized.zndsl => 0006-dispute-freshly-finalized.zndsl} (96%) rename polkadot/zombienet_tests/functional/{0007-dispute-finalized.toml => 0007-dispute-old-finalized.toml} (100%) rename polkadot/zombienet_tests/functional/{0007-dispute-finalized.zndsl => 0007-dispute-old-finalized.zndsl} (96%) diff --git a/polkadot/zombienet_tests/functional/0006-dispute-finalized.toml b/polkadot/zombienet_tests/functional/0006-dispute-freshly-finalized.toml similarity index 100% rename from polkadot/zombienet_tests/functional/0006-dispute-finalized.toml rename to polkadot/zombienet_tests/functional/0006-dispute-freshly-finalized.toml diff --git a/polkadot/zombienet_tests/functional/0006-dispute-finalized.zndsl b/polkadot/zombienet_tests/functional/0006-dispute-freshly-finalized.zndsl similarity index 96% rename from polkadot/zombienet_tests/functional/0006-dispute-finalized.zndsl rename to polkadot/zombienet_tests/functional/0006-dispute-freshly-finalized.zndsl index 06b104ad4a0f..4f39e5615a5b 100644 --- a/polkadot/zombienet_tests/functional/0006-dispute-finalized.zndsl +++ b/polkadot/zombienet_tests/functional/0006-dispute-freshly-finalized.zndsl @@ -1,5 +1,5 @@ Description: Test if disputes triggered on finalized blocks within scope always end as valid. -Network: ./0006-dispute-finalized.toml +Network: ./0006-dispute-freshly-finalized.toml Creds: config # Check authority status and peers. diff --git a/polkadot/zombienet_tests/functional/0007-dispute-finalized.toml b/polkadot/zombienet_tests/functional/0007-dispute-old-finalized.toml similarity index 100% rename from polkadot/zombienet_tests/functional/0007-dispute-finalized.toml rename to polkadot/zombienet_tests/functional/0007-dispute-old-finalized.toml diff --git a/polkadot/zombienet_tests/functional/0007-dispute-finalized.zndsl b/polkadot/zombienet_tests/functional/0007-dispute-old-finalized.zndsl similarity index 96% rename from polkadot/zombienet_tests/functional/0007-dispute-finalized.zndsl rename to polkadot/zombienet_tests/functional/0007-dispute-old-finalized.zndsl index bccf5bb8ab0d..0778885c1075 100644 --- a/polkadot/zombienet_tests/functional/0007-dispute-finalized.zndsl +++ b/polkadot/zombienet_tests/functional/0007-dispute-old-finalized.zndsl @@ -1,5 +1,5 @@ Description: Test if disputes triggered on finalized blocks out of scope never get to be confirmed and concluded. -Network: ./0007-dispute-finalized.toml +Network: ./0007-dispute-old-finalized.toml Creds: config # Check authority status and peers. From 2613a60f9f6fb0029a8c6ff2d6e73f91baac8d28 Mon Sep 17 00:00:00 2001 From: Overkillus Date: Tue, 21 Nov 2023 16:15:09 +0000 Subject: [PATCH 11/26] spelling --- .../node/malus/src/variants/dispute_finalized_candidates.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/polkadot/node/malus/src/variants/dispute_finalized_candidates.rs b/polkadot/node/malus/src/variants/dispute_finalized_candidates.rs index 9639d6e337a2..9d9ae2dde801 100644 --- a/polkadot/node/malus/src/variants/dispute_finalized_candidates.rs +++ b/polkadot/node/malus/src/variants/dispute_finalized_candidates.rs @@ -17,7 +17,7 @@ //! A malicious node variant that attempts to dispute finalized candidates. //! //! This malus variant behaves honestly in backing and approval voting. -//! The maliciosunes comes from emitting an extra dispute statement on top of the other ones. +//! The maliciousness comes from emitting an extra dispute statement on top of the other ones. //! //! Some extra quirks which generally should be insignificant: //! - The malus node will not dispute at session boundaries From c42bfa1f4fbbe7b8bc109b9aead553b759011abc Mon Sep 17 00:00:00 2001 From: Overkillus Date: Tue, 21 Nov 2023 16:58:58 +0000 Subject: [PATCH 12/26] var rename --- .../src/variants/dispute_finalized_candidates.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/polkadot/node/malus/src/variants/dispute_finalized_candidates.rs b/polkadot/node/malus/src/variants/dispute_finalized_candidates.rs index 9d9ae2dde801..8c8d3227f365 100644 --- a/polkadot/node/malus/src/variants/dispute_finalized_candidates.rs +++ b/polkadot/node/malus/src/variants/dispute_finalized_candidates.rs @@ -74,15 +74,15 @@ where ) -> Option> { match msg { FromOrchestra::Communication{msg} => Some(FromOrchestra::Communication{msg}), - FromOrchestra::Signal(OverseerSignal::BlockFinalized(h, n)) => { + FromOrchestra::Signal(OverseerSignal::BlockFinalized(finalized_hash, finalized_height)) => { gum::info!( target: MALUS, - "😈 Block Finalization Interception! Block: {:?}", h, + "😈 Block Finalization Interception! Block: {:?}", finalized_hash, ); //Ensure that the chain is long enough for the target ancestor to exist - if n <= self.dispute_offset { - return Some(FromOrchestra::Signal(OverseerSignal::BlockFinalized(h, n))); + if finalized_height <= self.dispute_offset { + return Some(FromOrchestra::Signal(OverseerSignal::BlockFinalized(finalized_hash, finalized_height))); } let dispute_offset = self.dispute_offset; @@ -93,7 +93,7 @@ where Box::pin(async move { // Query chain for the block hash at the target depth let (tx, rx) = oneshot::channel(); - sender.send_message(ChainApiMessage::FinalizedBlockHash(n - dispute_offset, tx)).await; + sender.send_message(ChainApiMessage::FinalizedBlockHash(finalized_height - dispute_offset, tx)).await; let disputable_hash = match rx.await { Ok(Ok(Some(hash))) => { gum::info!( @@ -177,7 +177,7 @@ where ); // Passthrough the finalization signal as usual (using it as hook only) - Some(FromOrchestra::Signal(OverseerSignal::BlockFinalized(h, n))) + Some(FromOrchestra::Signal(OverseerSignal::BlockFinalized(finalized_hash, finalized_height))) }, FromOrchestra::Signal(signal) => Some(FromOrchestra::Signal(signal)), } From 8a4e6c69c591813e0177a0a760fd9e00e308a0f6 Mon Sep 17 00:00:00 2001 From: Overkillus Date: Tue, 21 Nov 2023 17:09:57 +0000 Subject: [PATCH 13/26] value assert in arg test --- polkadot/node/malus/src/malus.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/polkadot/node/malus/src/malus.rs b/polkadot/node/malus/src/malus.rs index 3afe78116d64..073d49f3c216 100644 --- a/polkadot/node/malus/src/malus.rs +++ b/polkadot/node/malus/src/malus.rs @@ -213,7 +213,7 @@ mod tests { } #[test] - fn dispute_finalized_offset_works() { + fn dispute_finalized_offset_value_works() { let cli = MalusCli::try_parse_from(IntoIterator::into_iter([ "malus", "dispute-finalized-candidates", @@ -223,10 +223,11 @@ mod tests { ])) .unwrap(); assert_matches::assert_matches!(cli, MalusCli { - variant: NemesisVariant::DisputeFinalizedCandidates(run), + variant: NemesisVariant::DisputeFinalizedCandidates(opts), .. } => { - assert!(run.cli.run.base.bob); + assert_eq!(opts.dispute_offset, 13); // This line checks that dispute_offset is correctly set to 13 + assert!(opts.cli.run.base.bob); }); } -} +} \ No newline at end of file From 49b4601c0c25dd9b0e0c51e4210231a5ef1c5be4 Mon Sep 17 00:00:00 2001 From: Overkillus Date: Tue, 21 Nov 2023 17:32:06 +0000 Subject: [PATCH 14/26] fmt --- polkadot/node/malus/src/malus.rs | 2 +- .../variants/dispute_finalized_candidates.rs | 90 ++++++++++++------- polkadot/node/malus/src/variants/mod.rs | 4 +- 3 files changed, 60 insertions(+), 36 deletions(-) diff --git a/polkadot/node/malus/src/malus.rs b/polkadot/node/malus/src/malus.rs index 073d49f3c216..b8a83e54d4f5 100644 --- a/polkadot/node/malus/src/malus.rs +++ b/polkadot/node/malus/src/malus.rs @@ -230,4 +230,4 @@ mod tests { assert!(opts.cli.run.base.bob); }); } -} \ No newline at end of file +} diff --git a/polkadot/node/malus/src/variants/dispute_finalized_candidates.rs b/polkadot/node/malus/src/variants/dispute_finalized_candidates.rs index 8c8d3227f365..9f3f1c5e764e 100644 --- a/polkadot/node/malus/src/variants/dispute_finalized_candidates.rs +++ b/polkadot/node/malus/src/variants/dispute_finalized_candidates.rs @@ -15,18 +15,19 @@ // along with Polkadot. If not, see . //! A malicious node variant that attempts to dispute finalized candidates. -//! +//! //! This malus variant behaves honestly in backing and approval voting. //! The maliciousness comes from emitting an extra dispute statement on top of the other ones. -//! +//! //! Some extra quirks which generally should be insignificant: //! - The malus node will not dispute at session boundaries //! - The malus node will not dispute blocks it backed itself -//! +//! //! Attention: For usage with `zombienet` only! #![allow(missing_docs)] +use futures::channel::oneshot; use polkadot_cli::{ prepared_overseer_builder, service::{ @@ -41,13 +42,9 @@ use polkadot_node_subsystem_types::{DefaultSubsystemClient, OverseerSignal}; use polkadot_node_subsystem_util::request_candidate_events; use polkadot_primitives::CandidateEvent; use sp_core::traits::SpawnNamed; -use futures::channel::oneshot; // Filter wrapping related types. -use crate::{ - interceptor::*, - shared::MALUS, -}; +use crate::{interceptor::*, shared::MALUS}; use std::sync::Arc; @@ -55,8 +52,9 @@ use std::sync::Arc; /// Listens to finalization messages and if possible triggers disputes for their ancestors. #[derive(Clone)] struct AncestorDisputer { - spawner: Spawner, //stores the actual ApprovalVotingSubsystem spawner - dispute_offset: u32, //relative depth of the disputed block to the finalized block, 0=finalized, 1=parent of finalized etc + spawner: Spawner, //stores the actual ApprovalVotingSubsystem spawner + dispute_offset: u32, /* relative depth of the disputed block to the finalized block, + * 0=finalized, 1=parent of finalized etc */ } impl MessageInterceptor for AncestorDisputer @@ -73,8 +71,11 @@ where msg: FromOrchestra, ) -> Option> { match msg { - FromOrchestra::Communication{msg} => Some(FromOrchestra::Communication{msg}), - FromOrchestra::Signal(OverseerSignal::BlockFinalized(finalized_hash, finalized_height)) => { + FromOrchestra::Communication { msg } => Some(FromOrchestra::Communication { msg }), + FromOrchestra::Signal(OverseerSignal::BlockFinalized( + finalized_hash, + finalized_height, + )) => { gum::info!( target: MALUS, "😈 Block Finalization Interception! Block: {:?}", finalized_hash, @@ -82,7 +83,10 @@ where //Ensure that the chain is long enough for the target ancestor to exist if finalized_height <= self.dispute_offset { - return Some(FromOrchestra::Signal(OverseerSignal::BlockFinalized(finalized_hash, finalized_height))); + return Some(FromOrchestra::Signal(OverseerSignal::BlockFinalized( + finalized_hash, + finalized_height, + ))) } let dispute_offset = self.dispute_offset; @@ -93,7 +97,12 @@ where Box::pin(async move { // Query chain for the block hash at the target depth let (tx, rx) = oneshot::channel(); - sender.send_message(ChainApiMessage::FinalizedBlockHash(finalized_height - dispute_offset, tx)).await; + sender + .send_message(ChainApiMessage::FinalizedBlockHash( + finalized_height - dispute_offset, + tx, + )) + .await; let disputable_hash = match rx.await { Ok(Ok(Some(hash))) => { gum::info!( @@ -107,12 +116,13 @@ where target: MALUS, "😈 Seems the target is not yet finalized! Nothing to dispute." ); - return; // Early return from the async block + return // Early return from the async block }, }; // Fetch all candidate events for the target ancestor - let events = request_candidate_events(disputable_hash, &mut sender).await.await; + let events = + request_candidate_events(disputable_hash, &mut sender).await.await; let events = match events { Ok(Ok(events)) => events, Ok(Err(e)) => { @@ -120,28 +130,30 @@ where target: MALUS, "😈 Failed to fetch candidate events: {:?}", e ); - return; // Early return from the async block + return // Early return from the async block }, Err(e) => { gum::error!( target: MALUS, "😈 Failed to fetch candidate events: {:?}", e ); - return; // Early return from the async block + return // Early return from the async block }, - }; // Extract a token candidate from the events to use for disputing - let event = events.iter().find(|event| matches!(event, CandidateEvent::CandidateIncluded(_,_,_,_))); + let event = events.iter().find(|event| { + matches!(event, CandidateEvent::CandidateIncluded(_, _, _, _)) + }); let candidate = match event { - Some(CandidateEvent::CandidateIncluded(candidate,_,_,_)) => candidate, + Some(CandidateEvent::CandidateIncluded(candidate, _, _, _)) => + candidate, _ => { gum::error!( target: MALUS, "😈 No candidate included event found! Nothing to dispute." ); - return; // Early return from the async block + return // Early return from the async block }, }; @@ -150,7 +162,12 @@ where // Fetch the session index for the candidate let (tx, rx) = oneshot::channel(); - sender.send_message(RuntimeApiMessage::Request(disputable_hash, RuntimeApiRequest::SessionIndexForChild(tx))).await; + sender + .send_message(RuntimeApiMessage::Request( + disputable_hash, + RuntimeApiRequest::SessionIndexForChild(tx), + )) + .await; let session_index = match rx.await { Ok(Ok(session_index)) => session_index, _ => { @@ -158,7 +175,7 @@ where target: MALUS, "😈 Failed to fetch session index for candidate." ); - return; // Early return from the async block + return // Early return from the async block }, }; gum::info!( @@ -167,17 +184,22 @@ where ); // Start dispute - sender.send_unbounded_message(DisputeCoordinatorMessage::IssueLocalStatement( - session_index, - candidate_hash, - candidate.clone(), - false, // indicates candidate is invalid -> dispute starts - )); + sender.send_unbounded_message( + DisputeCoordinatorMessage::IssueLocalStatement( + session_index, + candidate_hash, + candidate.clone(), + false, // indicates candidate is invalid -> dispute starts + ), + ); }), ); // Passthrough the finalization signal as usual (using it as hook only) - Some(FromOrchestra::Signal(OverseerSignal::BlockFinalized(finalized_hash, finalized_height))) + Some(FromOrchestra::Signal(OverseerSignal::BlockFinalized( + finalized_hash, + finalized_height, + ))) }, FromOrchestra::Signal(signal) => Some(FromOrchestra::Signal(signal)), } @@ -190,7 +212,8 @@ where #[clap(rename_all = "kebab-case")] #[allow(missing_docs)] pub struct DisputeFinalizedCandidatesOptions { - /// relative depth of the disputed block to the finalized block, 0=finalized, 1=parent of finalized etc + /// relative depth of the disputed block to the finalized block, 0=finalized, 1=parent of + /// finalized etc #[clap(long, ignore_case = true, default_value_t = 2, value_parser = clap::value_parser!(u32).range(0..=50))] pub dispute_offset: u32, @@ -199,7 +222,8 @@ pub struct DisputeFinalizedCandidatesOptions { } /// DisputeFinalizedCandidates implementation wrapper which implements `OverseerGen` glue. pub(crate) struct DisputeFinalizedCandidates { - /// relative depth of the disputed block to the finalized block, 0=finalized, 1=parent of finalized etc + /// relative depth of the disputed block to the finalized block, 0=finalized, 1=parent of + /// finalized etc pub dispute_offset: u32, } diff --git a/polkadot/node/malus/src/variants/mod.rs b/polkadot/node/malus/src/variants/mod.rs index d39e68f2caec..bb4971c145ce 100644 --- a/polkadot/node/malus/src/variants/mod.rs +++ b/polkadot/node/malus/src/variants/mod.rs @@ -18,14 +18,14 @@ mod back_garbage_candidate; mod common; +mod dispute_finalized_candidates; mod dispute_valid_candidates; mod suggest_garbage_candidate; -mod dispute_finalized_candidates; pub(crate) use self::{ back_garbage_candidate::{BackGarbageCandidateOptions, BackGarbageCandidates}, + dispute_finalized_candidates::{DisputeFinalizedCandidates, DisputeFinalizedCandidatesOptions}, dispute_valid_candidates::{DisputeAncestorOptions, DisputeValidCandidates}, suggest_garbage_candidate::{SuggestGarbageCandidateOptions, SuggestGarbageCandidates}, - dispute_finalized_candidates::{DisputeFinalizedCandidatesOptions, DisputeFinalizedCandidates}, }; pub(crate) use common::*; From 667debad26339c674764bcdb763c8880d3f768ca Mon Sep 17 00:00:00 2001 From: Overkillus Date: Tue, 21 Nov 2023 17:35:42 +0000 Subject: [PATCH 15/26] fmt2 --- .../node/malus/src/variants/dispute_finalized_candidates.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/polkadot/node/malus/src/variants/dispute_finalized_candidates.rs b/polkadot/node/malus/src/variants/dispute_finalized_candidates.rs index 9f3f1c5e764e..3d6e6c4ef637 100644 --- a/polkadot/node/malus/src/variants/dispute_finalized_candidates.rs +++ b/polkadot/node/malus/src/variants/dispute_finalized_candidates.rs @@ -52,9 +52,9 @@ use std::sync::Arc; /// Listens to finalization messages and if possible triggers disputes for their ancestors. #[derive(Clone)] struct AncestorDisputer { - spawner: Spawner, //stores the actual ApprovalVotingSubsystem spawner + spawner: Spawner, //stores the actual ApprovalVotingSubsystem spawner dispute_offset: u32, /* relative depth of the disputed block to the finalized block, - * 0=finalized, 1=parent of finalized etc */ + * 0=finalized, 1=parent of finalized etc */ } impl MessageInterceptor for AncestorDisputer From ad7042119367f6e72854f7d43b0f169b90b78d1e Mon Sep 17 00:00:00 2001 From: Overkillus Date: Tue, 21 Nov 2023 21:44:06 +0000 Subject: [PATCH 16/26] add tests to CI --- .gitlab/pipeline/zombienet/polkadot.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/.gitlab/pipeline/zombienet/polkadot.yml b/.gitlab/pipeline/zombienet/polkadot.yml index 995dd9825320..3029ae62a751 100644 --- a/.gitlab/pipeline/zombienet/polkadot.yml +++ b/.gitlab/pipeline/zombienet/polkadot.yml @@ -115,6 +115,22 @@ zombienet-polkadot-functional-0006-parachains-max-tranche0: --local-dir="${LOCAL_DIR}/functional" --test="0006-parachains-max-tranche0.zndsl" +zombienet-polkadot-functional-0007-dispute-freshly-finalized: + extends: + - .zombienet-polkadot-common + script: + - /home/nonroot/zombie-net/scripts/ci/run-test-local-env-manager.sh + --local-dir="${LOCAL_DIR}/functional" + --test="0007-dispute-freshly-finalized.zndsl" + +zombienet-polkadot-functional-0008-dispute-old-finalized: + extends: + - .zombienet-polkadot-common + script: + - /home/nonroot/zombie-net/scripts/ci/run-test-local-env-manager.sh + --local-dir="${LOCAL_DIR}/functional" + --test="0007-dispute-old-finalized.zndsl" + zombienet-polkadot-smoke-0001-parachains-smoke-test: extends: - .zombienet-polkadot-common From e1529f9ebacc52d919e8f320bbb48c3b43958707 Mon Sep 17 00:00:00 2001 From: Maciej Date: Wed, 22 Nov 2023 14:23:15 +0000 Subject: [PATCH 17/26] fix CI test name Co-authored-by: Marcin S. --- .gitlab/pipeline/zombienet/polkadot.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab/pipeline/zombienet/polkadot.yml b/.gitlab/pipeline/zombienet/polkadot.yml index 3029ae62a751..d1f3a201c80a 100644 --- a/.gitlab/pipeline/zombienet/polkadot.yml +++ b/.gitlab/pipeline/zombienet/polkadot.yml @@ -129,7 +129,7 @@ zombienet-polkadot-functional-0008-dispute-old-finalized: script: - /home/nonroot/zombie-net/scripts/ci/run-test-local-env-manager.sh --local-dir="${LOCAL_DIR}/functional" - --test="0007-dispute-old-finalized.zndsl" + --test="0008-dispute-old-finalized.zndsl" zombienet-polkadot-smoke-0001-parachains-smoke-test: extends: From b0065353e7c3bfed90a0cb7997e3c064255d8d51 Mon Sep 17 00:00:00 2001 From: Overkillus Date: Thu, 23 Nov 2023 15:40:43 +0000 Subject: [PATCH 18/26] log changes --- .../node/malus/src/variants/dispute_finalized_candidates.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/polkadot/node/malus/src/variants/dispute_finalized_candidates.rs b/polkadot/node/malus/src/variants/dispute_finalized_candidates.rs index 3d6e6c4ef637..676b31cee9b6 100644 --- a/polkadot/node/malus/src/variants/dispute_finalized_candidates.rs +++ b/polkadot/node/malus/src/variants/dispute_finalized_candidates.rs @@ -76,7 +76,7 @@ where finalized_hash, finalized_height, )) => { - gum::info!( + gum::debug!( target: MALUS, "😈 Block Finalization Interception! Block: {:?}", finalized_hash, ); @@ -105,14 +105,14 @@ where .await; let disputable_hash = match rx.await { Ok(Ok(Some(hash))) => { - gum::info!( + gum::debug!( target: MALUS, "😈 Time to search {:?}`th ancestor! Block: {:?}", dispute_offset, hash, ); hash }, _ => { - gum::info!( + gum::debug!( target: MALUS, "😈 Seems the target is not yet finalized! Nothing to dispute." ); From b2196ab2ba4c05784d52a99f87977e865f315c0f Mon Sep 17 00:00:00 2001 From: Maciej Date: Thu, 23 Nov 2023 15:41:04 +0000 Subject: [PATCH 19/26] spacing Co-authored-by: Tsvetomir Dimitrov --- polkadot/node/malus/src/variants/dispute_finalized_candidates.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/polkadot/node/malus/src/variants/dispute_finalized_candidates.rs b/polkadot/node/malus/src/variants/dispute_finalized_candidates.rs index 676b31cee9b6..346f7bbc685a 100644 --- a/polkadot/node/malus/src/variants/dispute_finalized_candidates.rs +++ b/polkadot/node/malus/src/variants/dispute_finalized_candidates.rs @@ -220,6 +220,7 @@ pub struct DisputeFinalizedCandidatesOptions { #[clap(flatten)] pub cli: Cli, } + /// DisputeFinalizedCandidates implementation wrapper which implements `OverseerGen` glue. pub(crate) struct DisputeFinalizedCandidates { /// relative depth of the disputed block to the finalized block, 0=finalized, 1=parent of From c1ba06cfd74217945c0d03dce06f7f034f2a8876 Mon Sep 17 00:00:00 2001 From: Overkillus Date: Thu, 23 Nov 2023 16:11:20 +0000 Subject: [PATCH 20/26] test name conflict resolved --- ...eshly-finalized.toml => 0007-dispute-freshly-finalized.toml} | 0 ...hly-finalized.zndsl => 0007-dispute-freshly-finalized.zndsl} | 2 +- ...spute-old-finalized.toml => 0008-dispute-old-finalized.toml} | 0 ...ute-old-finalized.zndsl => 0008-dispute-old-finalized.zndsl} | 2 +- 4 files changed, 2 insertions(+), 2 deletions(-) rename polkadot/zombienet_tests/functional/{0006-dispute-freshly-finalized.toml => 0007-dispute-freshly-finalized.toml} (100%) rename polkadot/zombienet_tests/functional/{0006-dispute-freshly-finalized.zndsl => 0007-dispute-freshly-finalized.zndsl} (96%) rename polkadot/zombienet_tests/functional/{0007-dispute-old-finalized.toml => 0008-dispute-old-finalized.toml} (100%) rename polkadot/zombienet_tests/functional/{0007-dispute-old-finalized.zndsl => 0008-dispute-old-finalized.zndsl} (96%) diff --git a/polkadot/zombienet_tests/functional/0006-dispute-freshly-finalized.toml b/polkadot/zombienet_tests/functional/0007-dispute-freshly-finalized.toml similarity index 100% rename from polkadot/zombienet_tests/functional/0006-dispute-freshly-finalized.toml rename to polkadot/zombienet_tests/functional/0007-dispute-freshly-finalized.toml diff --git a/polkadot/zombienet_tests/functional/0006-dispute-freshly-finalized.zndsl b/polkadot/zombienet_tests/functional/0007-dispute-freshly-finalized.zndsl similarity index 96% rename from polkadot/zombienet_tests/functional/0006-dispute-freshly-finalized.zndsl rename to polkadot/zombienet_tests/functional/0007-dispute-freshly-finalized.zndsl index 4f39e5615a5b..d44e209d567e 100644 --- a/polkadot/zombienet_tests/functional/0006-dispute-freshly-finalized.zndsl +++ b/polkadot/zombienet_tests/functional/0007-dispute-freshly-finalized.zndsl @@ -1,5 +1,5 @@ Description: Test if disputes triggered on finalized blocks within scope always end as valid. -Network: ./0006-dispute-freshly-finalized.toml +Network: ./0007-dispute-freshly-finalized.toml Creds: config # Check authority status and peers. diff --git a/polkadot/zombienet_tests/functional/0007-dispute-old-finalized.toml b/polkadot/zombienet_tests/functional/0008-dispute-old-finalized.toml similarity index 100% rename from polkadot/zombienet_tests/functional/0007-dispute-old-finalized.toml rename to polkadot/zombienet_tests/functional/0008-dispute-old-finalized.toml diff --git a/polkadot/zombienet_tests/functional/0007-dispute-old-finalized.zndsl b/polkadot/zombienet_tests/functional/0008-dispute-old-finalized.zndsl similarity index 96% rename from polkadot/zombienet_tests/functional/0007-dispute-old-finalized.zndsl rename to polkadot/zombienet_tests/functional/0008-dispute-old-finalized.zndsl index 0778885c1075..1c24073d2b48 100644 --- a/polkadot/zombienet_tests/functional/0007-dispute-old-finalized.zndsl +++ b/polkadot/zombienet_tests/functional/0008-dispute-old-finalized.zndsl @@ -1,5 +1,5 @@ Description: Test if disputes triggered on finalized blocks out of scope never get to be confirmed and concluded. -Network: ./0007-dispute-old-finalized.toml +Network: ./0008-dispute-old-finalized.toml Creds: config # Check authority status and peers. From 9e054df7672d8eb320522a29747f19ade8178164 Mon Sep 17 00:00:00 2001 From: Overkillus Date: Fri, 24 Nov 2023 02:36:56 +0000 Subject: [PATCH 21/26] lowering para number and network size --- .../functional/0007-dispute-freshly-finalized.toml | 10 +++++----- .../functional/0007-dispute-freshly-finalized.zndsl | 4 ---- .../functional/0008-dispute-old-finalized.toml | 10 +++++----- .../functional/0008-dispute-old-finalized.zndsl | 4 ---- 4 files changed, 10 insertions(+), 18 deletions(-) diff --git a/polkadot/zombienet_tests/functional/0007-dispute-freshly-finalized.toml b/polkadot/zombienet_tests/functional/0007-dispute-freshly-finalized.toml index 369c8658d94f..79f44450adf2 100644 --- a/polkadot/zombienet_tests/functional/0007-dispute-freshly-finalized.toml +++ b/polkadot/zombienet_tests/functional/0007-dispute-freshly-finalized.toml @@ -1,9 +1,9 @@ [settings] timeout = 1000 -[relaychain.genesis.runtime.configuration.config] - max_validators_per_core = 2 - needed_approvals = 3 +[relaychain.genesis.runtimeGenesis.patch.configuration.config] + max_validators_per_core = 1 + needed_approvals = 1 [relaychain] default_image = "{{ZOMBIENET_INTEGRATION_TEST_IMAGE}}" @@ -16,7 +16,7 @@ requests = { memory = "2G", cpu = "1" } [[relaychain.node_groups]] name = "honest" - count = 12 + count = 6 args = ["-lparachain=debug"] [[relaychain.nodes]] @@ -25,7 +25,7 @@ requests = { memory = "2G", cpu = "1" } command = "malus dispute-finalized-candidates" args = [ "--alice", "-lparachain=debug,MALUS=trace", "--dispute-offset=3" ] -{% for id in range(2000,2004) %} +{% for id in range(2000,2002) %} [[parachains]] id = {{id}} addToGenesis = true diff --git a/polkadot/zombienet_tests/functional/0007-dispute-freshly-finalized.zndsl b/polkadot/zombienet_tests/functional/0007-dispute-freshly-finalized.zndsl index d44e209d567e..c728d3c1dc85 100644 --- a/polkadot/zombienet_tests/functional/0007-dispute-freshly-finalized.zndsl +++ b/polkadot/zombienet_tests/functional/0007-dispute-freshly-finalized.zndsl @@ -9,14 +9,10 @@ honest: reports node_roles is 4 # Ensure parachains are registered. honest: parachain 2000 is registered within 30 seconds honest: parachain 2001 is registered within 30 seconds -honest: parachain 2002 is registered within 30 seconds -honest: parachain 2003 is registered within 30 seconds # Ensure parachains made progress. honest: parachain 2000 block height is at least 10 within 200 seconds honest: parachain 2001 block height is at least 10 within 200 seconds -honest: parachain 2002 block height is at least 10 within 200 seconds -honest: parachain 2003 block height is at least 10 within 200 seconds # Ensure that malus is already attempting to dispute malus: log line contains "😈 Disputing candidate with hash:" within 180 seconds diff --git a/polkadot/zombienet_tests/functional/0008-dispute-old-finalized.toml b/polkadot/zombienet_tests/functional/0008-dispute-old-finalized.toml index e685ed47ef24..f26bd6fdd916 100644 --- a/polkadot/zombienet_tests/functional/0008-dispute-old-finalized.toml +++ b/polkadot/zombienet_tests/functional/0008-dispute-old-finalized.toml @@ -1,9 +1,9 @@ [settings] timeout = 1000 -[relaychain.genesis.runtime.configuration.config] - max_validators_per_core = 2 - needed_approvals = 3 +[relaychain.genesis.runtimeGenesis.patch.configuration.config] + max_validators_per_core = 1 + needed_approvals = 1 [relaychain] default_image = "{{ZOMBIENET_INTEGRATION_TEST_IMAGE}}" @@ -16,7 +16,7 @@ requests = { memory = "2G", cpu = "1" } [[relaychain.node_groups]] name = "honest" - count = 12 + count = 5 args = ["-lparachain=debug"] [[relaychain.nodes]] @@ -25,7 +25,7 @@ requests = { memory = "2G", cpu = "1" } command = "malus dispute-finalized-candidates" args = [ "--alice", "-lparachain=debug,MALUS=trace", "--dispute-offset=14" ] -{% for id in range(2000,2004) %} +{% for id in range(2000,2002) %} [[parachains]] id = {{id}} addToGenesis = true diff --git a/polkadot/zombienet_tests/functional/0008-dispute-old-finalized.zndsl b/polkadot/zombienet_tests/functional/0008-dispute-old-finalized.zndsl index 1c24073d2b48..b35e95b8004c 100644 --- a/polkadot/zombienet_tests/functional/0008-dispute-old-finalized.zndsl +++ b/polkadot/zombienet_tests/functional/0008-dispute-old-finalized.zndsl @@ -10,14 +10,10 @@ honest: reports node_roles is 4 # Ensure parachains are registered. honest: parachain 2000 is registered within 30 seconds honest: parachain 2001 is registered within 30 seconds -honest: parachain 2002 is registered within 30 seconds -honest: parachain 2003 is registered within 30 seconds # Ensure parachains made progress. honest: parachain 2000 block height is at least 20 within 300 seconds honest: parachain 2001 block height is at least 20 within 300 seconds -honest: parachain 2002 block height is at least 20 within 300 seconds -honest: parachain 2003 block height is at least 20 within 300 seconds # Ensure that malus is already attempting to dispute malus: log line contains "😈 Disputing candidate with hash:" within 180 seconds From 2a8b712d694e7cc4378b4e2733369388577c43de Mon Sep 17 00:00:00 2001 From: Overkillus Date: Fri, 24 Nov 2023 02:37:14 +0000 Subject: [PATCH 22/26] size fix --- .../zombienet_tests/functional/0008-dispute-old-finalized.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/polkadot/zombienet_tests/functional/0008-dispute-old-finalized.toml b/polkadot/zombienet_tests/functional/0008-dispute-old-finalized.toml index f26bd6fdd916..e131ec640d33 100644 --- a/polkadot/zombienet_tests/functional/0008-dispute-old-finalized.toml +++ b/polkadot/zombienet_tests/functional/0008-dispute-old-finalized.toml @@ -16,7 +16,7 @@ requests = { memory = "2G", cpu = "1" } [[relaychain.node_groups]] name = "honest" - count = 5 + count = 6 args = ["-lparachain=debug"] [[relaychain.nodes]] From 7c950ebd13b451dd3a5f8673100d544ea50a02f3 Mon Sep 17 00:00:00 2001 From: Overkillus Date: Fri, 24 Nov 2023 12:44:48 +0000 Subject: [PATCH 23/26] network size clarification --- .../node/malus/src/variants/dispute_finalized_candidates.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/polkadot/node/malus/src/variants/dispute_finalized_candidates.rs b/polkadot/node/malus/src/variants/dispute_finalized_candidates.rs index 346f7bbc685a..7f83c386090e 100644 --- a/polkadot/node/malus/src/variants/dispute_finalized_candidates.rs +++ b/polkadot/node/malus/src/variants/dispute_finalized_candidates.rs @@ -22,6 +22,10 @@ //! Some extra quirks which generally should be insignificant: //! - The malus node will not dispute at session boundaries //! - The malus node will not dispute blocks it backed itself +//! - Be cautious about the size of the network to make sure disputes are not auto-confirmed +//! (7 validators is the smallest network size as it needs [(7-1)//3]+1 = 3 votes to get +//! confirmed but it only gets 1 from backing and 1 from malus so 2 in total) +//! //! //! Attention: For usage with `zombienet` only! From 205c48d15b5fdf54362702f888eea189e158c9e6 Mon Sep 17 00:00:00 2001 From: Overkillus Date: Fri, 24 Nov 2023 12:47:16 +0000 Subject: [PATCH 24/26] higher timeout in tests --- .../functional/0007-dispute-freshly-finalized.zndsl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/polkadot/zombienet_tests/functional/0007-dispute-freshly-finalized.zndsl b/polkadot/zombienet_tests/functional/0007-dispute-freshly-finalized.zndsl index c728d3c1dc85..58334f20cdff 100644 --- a/polkadot/zombienet_tests/functional/0007-dispute-freshly-finalized.zndsl +++ b/polkadot/zombienet_tests/functional/0007-dispute-freshly-finalized.zndsl @@ -18,9 +18,9 @@ honest: parachain 2001 block height is at least 10 within 200 seconds malus: log line contains "😈 Disputing candidate with hash:" within 180 seconds # Check if disputes are initiated and concluded. -honest: reports polkadot_parachain_candidate_disputes_total is at least 2 within 30 seconds -honest: reports polkadot_parachain_candidate_dispute_concluded{validity="valid"} is at least 2 within 30 seconds -honest: reports polkadot_parachain_candidate_dispute_concluded{validity="invalid"} is 0 within 30 seconds +honest: reports polkadot_parachain_candidate_disputes_total is at least 2 within 100 seconds +honest: reports polkadot_parachain_candidate_dispute_concluded{validity="valid"} is at least 2 within 100 seconds +honest: reports polkadot_parachain_candidate_dispute_concluded{validity="invalid"} is 0 within 100 seconds # Check lag - approval honest: reports polkadot_parachain_approval_checking_finality_lag is 0 From 7cca5412dfff35c9293834a279b3596c652f6bd5 Mon Sep 17 00:00:00 2001 From: Overkillus Date: Fri, 24 Nov 2023 14:09:15 +0000 Subject: [PATCH 25/26] switching to 1 para network --- .../functional/0007-dispute-freshly-finalized.toml | 9 ++------- .../functional/0007-dispute-freshly-finalized.zndsl | 2 -- .../functional/0008-dispute-old-finalized.toml | 9 ++------- .../functional/0008-dispute-old-finalized.zndsl | 4 +--- 4 files changed, 5 insertions(+), 19 deletions(-) diff --git a/polkadot/zombienet_tests/functional/0007-dispute-freshly-finalized.toml b/polkadot/zombienet_tests/functional/0007-dispute-freshly-finalized.toml index 79f44450adf2..69eb0804d8cb 100644 --- a/polkadot/zombienet_tests/functional/0007-dispute-freshly-finalized.toml +++ b/polkadot/zombienet_tests/functional/0007-dispute-freshly-finalized.toml @@ -25,19 +25,14 @@ requests = { memory = "2G", cpu = "1" } command = "malus dispute-finalized-candidates" args = [ "--alice", "-lparachain=debug,MALUS=trace", "--dispute-offset=3" ] -{% for id in range(2000,2002) %} [[parachains]] -id = {{id}} -addToGenesis = true -genesis_state_generator = "undying-collator export-genesis-state --pov-size={{25000*(id-1999)}} --pvf-complexity={{id - 1999}}" +id = 2000 [parachains.collator] image = "{{COL_IMAGE}}" name = "collator" command = "undying-collator" - args = ["-lparachain=debug", "--pov-size={{25000*(id-1999)}}", "--parachain-id={{id}}", "--pvf-complexity={{id - 1999}}"] - -{% endfor %} + args = ["-lparachain=debug"] [types.Header] number = "u64" diff --git a/polkadot/zombienet_tests/functional/0007-dispute-freshly-finalized.zndsl b/polkadot/zombienet_tests/functional/0007-dispute-freshly-finalized.zndsl index 58334f20cdff..62d5a9768f9e 100644 --- a/polkadot/zombienet_tests/functional/0007-dispute-freshly-finalized.zndsl +++ b/polkadot/zombienet_tests/functional/0007-dispute-freshly-finalized.zndsl @@ -8,11 +8,9 @@ honest: reports node_roles is 4 # Ensure parachains are registered. honest: parachain 2000 is registered within 30 seconds -honest: parachain 2001 is registered within 30 seconds # Ensure parachains made progress. honest: parachain 2000 block height is at least 10 within 200 seconds -honest: parachain 2001 block height is at least 10 within 200 seconds # Ensure that malus is already attempting to dispute malus: log line contains "😈 Disputing candidate with hash:" within 180 seconds diff --git a/polkadot/zombienet_tests/functional/0008-dispute-old-finalized.toml b/polkadot/zombienet_tests/functional/0008-dispute-old-finalized.toml index e131ec640d33..1ea385c3a42e 100644 --- a/polkadot/zombienet_tests/functional/0008-dispute-old-finalized.toml +++ b/polkadot/zombienet_tests/functional/0008-dispute-old-finalized.toml @@ -25,19 +25,14 @@ requests = { memory = "2G", cpu = "1" } command = "malus dispute-finalized-candidates" args = [ "--alice", "-lparachain=debug,MALUS=trace", "--dispute-offset=14" ] -{% for id in range(2000,2002) %} [[parachains]] -id = {{id}} -addToGenesis = true -genesis_state_generator = "undying-collator export-genesis-state --pov-size={{25000*(id-1999)}} --pvf-complexity={{id - 1999}}" +id = 2000 [parachains.collator] image = "{{COL_IMAGE}}" name = "collator" command = "undying-collator" - args = ["-lparachain=debug", "--pov-size={{25000*(id-1999)}}", "--parachain-id={{id}}", "--pvf-complexity={{id - 1999}}"] - -{% endfor %} + args = ["-lparachain=debug"] [types.Header] number = "u64" diff --git a/polkadot/zombienet_tests/functional/0008-dispute-old-finalized.zndsl b/polkadot/zombienet_tests/functional/0008-dispute-old-finalized.zndsl index b35e95b8004c..b30c5801a1da 100644 --- a/polkadot/zombienet_tests/functional/0008-dispute-old-finalized.zndsl +++ b/polkadot/zombienet_tests/functional/0008-dispute-old-finalized.zndsl @@ -9,15 +9,13 @@ honest: reports node_roles is 4 # Ensure parachains are registered. honest: parachain 2000 is registered within 30 seconds -honest: parachain 2001 is registered within 30 seconds # Ensure parachains made progress. honest: parachain 2000 block height is at least 20 within 300 seconds -honest: parachain 2001 block height is at least 20 within 300 seconds # Ensure that malus is already attempting to dispute malus: log line contains "😈 Disputing candidate with hash:" within 180 seconds # Ensure that honest nodes don't participate and conclude any disputes -honest: count of log lines containing "Dispute on candidate concluded" is 0 within 30 seconds +honest: count of log lines containing "Dispute on candidate concluded" is 0 within 100 seconds From 7eda451b0c190ab1366a04d834d5e9a8d2778bba Mon Sep 17 00:00:00 2001 From: Overkillus Date: Fri, 24 Nov 2023 14:09:48 +0000 Subject: [PATCH 26/26] spawn_blocking -> spawn --- polkadot/node/malus/src/variants/common.rs | 2 +- .../node/malus/src/variants/dispute_finalized_candidates.rs | 2 +- polkadot/node/malus/src/variants/suggest_garbage_candidate.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/polkadot/node/malus/src/variants/common.rs b/polkadot/node/malus/src/variants/common.rs index 011fcc80e373..92264cd653d0 100644 --- a/polkadot/node/malus/src/variants/common.rs +++ b/polkadot/node/malus/src/variants/common.rs @@ -188,7 +188,7 @@ where let _candidate_descriptor = candidate_descriptor.clone(); let mut subsystem_sender = subsystem_sender.clone(); let (sender, receiver) = std::sync::mpsc::channel(); - self.spawner.spawn_blocking( + self.spawner.spawn( "malus-get-validation-data", Some("malus"), Box::pin(async move { diff --git a/polkadot/node/malus/src/variants/dispute_finalized_candidates.rs b/polkadot/node/malus/src/variants/dispute_finalized_candidates.rs index 7f83c386090e..113ab026879d 100644 --- a/polkadot/node/malus/src/variants/dispute_finalized_candidates.rs +++ b/polkadot/node/malus/src/variants/dispute_finalized_candidates.rs @@ -95,7 +95,7 @@ where let dispute_offset = self.dispute_offset; let mut sender = subsystem_sender.clone(); - self.spawner.spawn_blocking( + self.spawner.spawn( "malus-dispute-finalized-block", Some("malus"), Box::pin(async move { diff --git a/polkadot/node/malus/src/variants/suggest_garbage_candidate.rs b/polkadot/node/malus/src/variants/suggest_garbage_candidate.rs index cf0ff5f809d8..817afb58437e 100644 --- a/polkadot/node/malus/src/variants/suggest_garbage_candidate.rs +++ b/polkadot/node/malus/src/variants/suggest_garbage_candidate.rs @@ -113,7 +113,7 @@ where let (sender, receiver) = std::sync::mpsc::channel(); let mut new_sender = subsystem_sender.clone(); let _candidate = candidate.clone(); - self.spawner.spawn_blocking( + self.spawner.spawn( "malus-get-validation-data", Some("malus"), Box::pin(async move {