Skip to content
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions .github/actions/zombienet-sdk/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,6 @@ inputs:
runs:
using: "composite"
steps:
- name: k8s_auth
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pepoviola would be good to extract unrelated zombienet/CI changes to a separate PR so we can backport this cleanly

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @ordian, Yes. We are planning to make a new pr to stabilize ci today.

shell: bash
run: |
. /home/nonroot/zombie-net/scripts/ci/run-test-local-env-manager.sh
k8s_auth

- name: common_vars
shell: bash
env:
Expand Down Expand Up @@ -61,6 +55,7 @@ runs:
TEST_NAME: ${{ inputs.test }}
PREFIX: ${{ inputs.prefix }}
run: |
export ZOMBIE_K8S_CI_NAMESPACE=$(cat /data/namespace)
ls -ltr ./artifacts
cargo nextest run --archive-file ./artifacts/${PREFIX}-zombienet-tests.tar.zst --no-capture -- ${TEST_NAME}

Expand Down
8 changes: 2 additions & 6 deletions .github/actions/zombienet/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,6 @@ inputs:
runs:
using: "composite"
steps:
- name: k8s_auth
shell: bash
run: |
. /home/nonroot/zombie-net/scripts/ci/run-test-local-env-manager.sh
k8s_auth

- name: common_vars
shell: bash
env:
Expand All @@ -42,6 +36,8 @@ runs:
LOCAL_PATH: ${{ inputs.local-dir }}
CONCURRENCY: ${{ inputs.concurrency }}
run: |
export ZOMBIE_NAMESPACE=$(cat /data/namespace)

/home/nonroot/zombie-net/scripts/ci/run-test-local-env-manager.sh \
--local-dir="$(pwd)/$LOCAL_PATH" \
--concurrency=$CONCURRENCY \
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/zombienet_polkadot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ env:
X_INFRA_INSTANCE: "spot"
# don't retry sdk tests
NEXTEST_RETRIES: 0
KUBECONFIG: "/data/config"
ZOMBIE_CLEANER_DISABLED: 1


# only run if we have changes in [subtrate, polkadot] directories or this workflow.
jobs:
Expand Down
4 changes: 2 additions & 2 deletions .github/zombienet-env
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ZOMBIENET_IMAGE=docker.io/paritytech/zombienet:v1.3.126
ZOMBIENET_RUNNER=zombienet-arc-runner
ZOMBIENET_IMAGE=docker.io/paritytech/zombienet:v1.3.128
ZOMBIENET_RUNNER=parity-zombienet
PUSHGATEWAY_URL=http://prometheus-pushgateway.monitoring.svc.cluster.local:9091/metrics/job/zombie-metrics
DEBUG=zombie,zombie::network-node,zombie::kube::client::logs
ZOMBIE_PROVIDER=k8s
Expand Down
32 changes: 16 additions & 16 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -1460,8 +1460,8 @@ xcm-runtime-apis = { path = "polkadot/xcm/xcm-runtime-apis", default-features =
xcm-simulator = { path = "polkadot/xcm/xcm-simulator", default-features = false }
yet-another-parachain-runtime = { path = "cumulus/parachains/runtimes/testing/yet-another-parachain" }
zeroize = { version = "1.7.0", default-features = false }
zombienet-orchestrator = { version = "0.3.0" }
zombienet-sdk = { version = "0.3.0" }
zombienet-orchestrator = { version = "0.3.6" }
zombienet-sdk = { version = "0.3.6" }
zstd = { version = "0.12.4", default-features = false }

[profile.release]
Expand Down
2 changes: 1 addition & 1 deletion polkadot/node/core/approval-voting-parallel/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ async fn run_main_loop<Context>(
// The message the approval voting subsystem would've handled.
ApprovalVotingParallelMessage::ApprovedAncestor(_, _,_) |
ApprovalVotingParallelMessage::GetApprovalSignaturesForCandidate(_, _) => {
to_approval_voting_worker.send_message(
to_approval_voting_worker.send_message_with_priority::<overseer::HighPriority>(
msg.try_into().expect(
"Message is one of ApprovedAncestor, GetApprovalSignaturesForCandidate
and that can be safely converted to ApprovalVotingMessage; qed"
Expand Down
28 changes: 24 additions & 4 deletions polkadot/node/overseer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,20 @@ impl Handle {
self.send_and_log_error(Event::BlockImported(block)).await
}

/// Send some message to one of the `Subsystem`s.
/// Send some message with normal priority to one of the `Subsystem`s.
pub async fn send_msg(&mut self, msg: impl Into<AllMessages>, origin: &'static str) {
self.send_and_log_error(Event::MsgToSubsystem { msg: msg.into(), origin }).await
self.send_msg_with_priority(msg, origin, PriorityLevel::Normal).await
}

/// Send some message with the specified priority to one of the `Subsystem`s.
pub async fn send_msg_with_priority(
&mut self,
msg: impl Into<AllMessages>,
origin: &'static str,
priority: PriorityLevel,
) {
self.send_and_log_error(Event::MsgToSubsystem { msg: msg.into(), origin, priority })
.await
}

/// Send a message not providing an origin.
Expand Down Expand Up @@ -296,6 +307,8 @@ pub enum Event {
msg: AllMessages,
/// The originating subsystem name.
origin: &'static str,
/// The priority of the message.
priority: PriorityLevel,
},
/// A request from the outer world.
ExternalRequest(ExternalRequest),
Expand Down Expand Up @@ -764,8 +777,15 @@ where
select! {
msg = self.events_rx.select_next_some() => {
match msg {
Event::MsgToSubsystem { msg, origin } => {
self.route_message(msg.into(), origin).await?;
Event::MsgToSubsystem { msg, origin, priority } => {
match priority {
PriorityLevel::Normal => {
self.route_message(msg.into(), origin).await?;
},
PriorityLevel::High => {
self.route_message_with_priority::<HighPriority>(msg.into(), origin).await?;
},
}
self.metrics.on_message_relayed();
}
Event::Stop => {
Expand Down
43 changes: 35 additions & 8 deletions polkadot/node/service/src/relay_chain_selection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ use polkadot_node_subsystem::messages::{
ChainSelectionMessage, DisputeCoordinatorMessage, HighestApprovedAncestorBlock,
};
use polkadot_node_subsystem_util::metrics::{self, prometheus};
use polkadot_overseer::{AllMessages, Handle};
use polkadot_overseer::{AllMessages, Handle, PriorityLevel};
use polkadot_primitives::{Block as PolkadotBlock, BlockNumber, Hash, Header as PolkadotHeader};
use sp_consensus::{Error as ConsensusError, SelectChain};
use std::sync::Arc;
Expand Down Expand Up @@ -238,7 +238,7 @@ pub struct SelectRelayChainInner<B, OH> {
impl<B, OH> SelectRelayChainInner<B, OH>
where
B: HeaderProviderProvider<PolkadotBlock>,
OH: OverseerHandleT,
OH: OverseerHandleT + OverseerHandleWithPriorityT,
{
/// Create a new [`SelectRelayChainInner`] wrapping the given chain backend
/// and a handle to the overseer.
Expand Down Expand Up @@ -286,7 +286,7 @@ where
impl<B, OH> Clone for SelectRelayChainInner<B, OH>
where
B: HeaderProviderProvider<PolkadotBlock> + Send + Sync,
OH: OverseerHandleT,
OH: OverseerHandleT + OverseerHandleWithPriorityT,
{
fn clone(&self) -> Self {
SelectRelayChainInner {
Expand Down Expand Up @@ -325,17 +325,40 @@ pub trait OverseerHandleT: Clone + Send + Sync {
async fn send_msg<M: Send + Into<AllMessages>>(&mut self, msg: M, origin: &'static str);
}

/// Trait for the overseer handle that allows sending messages with the specified priority level.
#[async_trait::async_trait]
pub trait OverseerHandleWithPriorityT: Clone + Send + Sync {
async fn send_msg_with_priority<M: Send + Into<AllMessages>>(
&mut self,
msg: M,
origin: &'static str,
priority: PriorityLevel,
);
}

#[async_trait::async_trait]
impl OverseerHandleT for Handle {
async fn send_msg<M: Send + Into<AllMessages>>(&mut self, msg: M, origin: &'static str) {
Handle::send_msg(self, msg, origin).await
}
}

#[async_trait::async_trait]
impl OverseerHandleWithPriorityT for Handle {
async fn send_msg_with_priority<M: Send + Into<AllMessages>>(
&mut self,
msg: M,
origin: &'static str,
priority: PriorityLevel,
) {
Handle::send_msg_with_priority(self, msg, origin, priority).await
}
}

impl<B, OH> SelectRelayChainInner<B, OH>
where
B: HeaderProviderProvider<PolkadotBlock>,
OH: OverseerHandleT + 'static,
OH: OverseerHandleT + OverseerHandleWithPriorityT + 'static,
{
/// Get all leaves of the chain, i.e. block hashes that are suitable to
/// build upon and have no suitable children.
Expand Down Expand Up @@ -472,9 +495,10 @@ where
.await;
} else {
overseer
.send_msg(
.send_msg_with_priority(
ApprovalVotingMessage::ApprovedAncestor(subchain_head, target_number, tx),
std::any::type_name::<Self>(),
PriorityLevel::High,
)
.await;
}
Expand Down Expand Up @@ -503,16 +527,18 @@ where
let lag_update_task = async move {
if approval_voting_parallel_enabled {
overseer_handle
.send_msg(
.send_msg_with_priority(
ApprovalVotingParallelMessage::ApprovalCheckingLagUpdate(lag),
std::any::type_name::<Self>(),
PriorityLevel::High,
)
.await;
} else {
overseer_handle
.send_msg(
.send_msg_with_priority(
ApprovalDistributionMessage::ApprovalCheckingLagUpdate(lag),
std::any::type_name::<Self>(),
PriorityLevel::High,
)
.await;
}
Expand Down Expand Up @@ -542,13 +568,14 @@ where
// 3. Constrain according to disputes:
let (tx, rx) = oneshot::channel();
overseer
.send_msg(
.send_msg_with_priority(
DisputeCoordinatorMessage::DetermineUndisputedChain {
base: (target_number, target_hash),
block_descriptions: subchain_block_descriptions,
tx,
},
std::any::type_name::<Self>(),
PriorityLevel::High,
)
.await;

Expand Down
21 changes: 21 additions & 0 deletions polkadot/node/service/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ use futures::channel::oneshot::Receiver;
use polkadot_node_primitives::approval::v2::VrfSignature;
use polkadot_node_subsystem::messages::{AllMessages, BlockDescription};
use polkadot_node_subsystem_util::TimeoutExt;
use polkadot_overseer::{HighPriority, PriorityLevel};
use polkadot_test_client::Sr25519Keyring;
use sp_consensus_babe::{
digests::{CompatibleDigestItem, PreDigest, SecondaryVRFPreDigest},
Expand Down Expand Up @@ -55,6 +56,26 @@ impl OverseerHandleT for TestSubsystemSender {
}
}

#[async_trait::async_trait]
impl OverseerHandleWithPriorityT for TestSubsystemSender {
async fn send_msg_with_priority<M: Send + Into<AllMessages>>(
&mut self,
msg: M,
_origin: &'static str,
priority: PriorityLevel,
) {
match priority {
PriorityLevel::High => {
TestSubsystemSender::send_message_with_priority::<HighPriority>(self, msg.into())
.await;
},
PriorityLevel::Normal => {
TestSubsystemSender::send_message(self, msg.into()).await;
},
}
}
}

struct TestHarness {
virtual_overseer: VirtualOverseer,
case_vars: CaseVars,
Expand Down
15 changes: 15 additions & 0 deletions prdoc/pr_8834.prdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
title: extend overseer to send priority messages
doc:
- audience: Node Dev
description: |-
Extend overseer to send priority messages, the new functionality is used for sending messages
on the grandpa call path when we call dispute-coordinator and approval-voting in
finality_target_with_longest_chain to make sure we don't block unnecessarily.

crates:
- name: polkadot-node-core-approval-voting-parallel
bump: patch
- name: polkadot-overseer
bump: patch
- name: polkadot-service
bump: patch
Loading