From d19b1de5f06cd6ba8dfc6723d63284758ba51ee2 Mon Sep 17 00:00:00 2001 From: Andronik Ordian Date: Wed, 29 Sep 2021 13:19:00 +0200 Subject: [PATCH] CI: run disputes tests (#3962) * CI: run disputes tests * Revert "minor chore changes (#3944)" This reverts commit d64394ef591673474b1dad24a869b944084ee19c. * fix em * Revert "Revert "minor chore changes (#3944)"" This reverts commit 02a1ecf3cacb52d6dd467e8f226a69bae651d319. * Update handle_import_statement function * fmt Co-authored-by: Lldenaurois --- .../core/dispute-coordinator/src/real/mod.rs | 5 ++--- .../dispute-coordinator/src/real/tests.rs | 22 ++++--------------- polkadot/scripts/gitlab/test_linux_stable.sh | 1 + 3 files changed, 7 insertions(+), 21 deletions(-) diff --git a/polkadot/node/core/dispute-coordinator/src/real/mod.rs b/polkadot/node/core/dispute-coordinator/src/real/mod.rs index f0d0f5b859..b4a1437d7d 100644 --- a/polkadot/node/core/dispute-coordinator/src/real/mod.rs +++ b/polkadot/node/core/dispute-coordinator/src/real/mod.rs @@ -38,7 +38,7 @@ use polkadot_node_primitives::{ use polkadot_node_subsystem::{ errors::{ChainApiError, RuntimeApiError}, messages::{ - BlockDescription, ChainApiMessage, DisputeCoordinatorMessage, DisputeDistributionMessage, + BlockDescription, DisputeCoordinatorMessage, DisputeDistributionMessage, DisputeParticipationMessage, ImportStatementsResult, }, overseer, FromOverseer, OverseerSignal, SpawnedSubsystem, SubsystemContext, SubsystemError, @@ -631,7 +631,6 @@ async fn handle_import_statements( session: SessionIndex, statements: Vec<(SignedDisputeStatement, ValidatorIndex)>, now: Timestamp, - pending_confirmation: oneshot::Sender, metrics: &Metrics, ) -> Result { if state.highest_session.map_or(true, |h| session + DISPUTE_WINDOW < h) { @@ -913,7 +912,7 @@ async fn issue_local_statement( now, metrics, ) - .await? + .await { Err(_) => { tracing::error!( diff --git a/polkadot/node/core/dispute-coordinator/src/real/tests.rs b/polkadot/node/core/dispute-coordinator/src/real/tests.rs index 2f78a5c487..c8709da929 100644 --- a/polkadot/node/core/dispute-coordinator/src/real/tests.rs +++ b/polkadot/node/core/dispute-coordinator/src/real/tests.rs @@ -26,9 +26,7 @@ use overseer::TimeoutExt; use parity_scale_codec::Encode; use polkadot_node_subsystem::{ jaeger, - messages::{ - AllMessages, BlockDescription, ChainApiMessage, RuntimeApiMessage, RuntimeApiRequest, - }, + messages::{AllMessages, BlockDescription, RuntimeApiMessage, RuntimeApiRequest}, ActivatedLeaf, ActiveLeavesUpdate, LeafStatus, }; use polkadot_node_subsystem_test_helpers::{make_subsystem_context, TestSubsystemContextHandle}; @@ -170,33 +168,22 @@ impl TestState { ))) .await; - self.handle_sync_queries(virtual_overseer, block_hash, block_header, session) - .await; + self.handle_sync_queries(virtual_overseer, block_hash, session).await; } async fn handle_sync_queries( &self, virtual_overseer: &mut VirtualOverseer, block_hash: Hash, - block_header: Header, session: SessionIndex, ) { - assert_matches!( - virtual_overseer.recv().await, - AllMessages::ChainApi(ChainApiMessage::BlockHeader(h, tx)) => { - assert_eq!(h, block_hash); - let _ = tx.send(Ok(Some(block_header))); - } - ); - assert_matches!( virtual_overseer.recv().await, AllMessages::RuntimeApi(RuntimeApiMessage::Request( h, RuntimeApiRequest::SessionIndexForChild(tx), )) => { - let parent_hash = session_to_hash(session, b"parent"); - assert_eq!(h, parent_hash); + assert_eq!(h, block_hash); let _ = tx.send(Ok(session)); } ); @@ -236,8 +223,7 @@ impl TestState { ))) .await; - let header = self.headers.get(leaf).unwrap().clone(); - self.handle_sync_queries(virtual_overseer, *leaf, header, session).await; + self.handle_sync_queries(virtual_overseer, *leaf, session).await; } } diff --git a/polkadot/scripts/gitlab/test_linux_stable.sh b/polkadot/scripts/gitlab/test_linux_stable.sh index 8ba62ecbbb..f7b36141af 100755 --- a/polkadot/scripts/gitlab/test_linux_stable.sh +++ b/polkadot/scripts/gitlab/test_linux_stable.sh @@ -4,4 +4,5 @@ set -e #shellcheck source=../common/lib.sh source "$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )/../common/lib.sh" +time cargo test --release --locked -p polkadot-node-core-dispute-coordinator --features disputes time cargo test --workspace --release --verbose --locked --features=runtime-benchmarks