Coretime Zombienet test (#2867)

This adds a Zombienet test for Coretime.

Requires: https://github.com/paritytech/polkadot-sdk/pull/2862

---------

Co-authored-by: Javier Viola <javier@parity.io>
Co-authored-by: Javier Viola <363911+pepoviola@users.noreply.github.com>
This commit is contained in:
Bastian Köcher
2024-01-08 18:41:02 +00:00
committed by GitHub
parent 1914775bd4
commit 4fdab499c4
11 changed files with 118 additions and 71 deletions
@@ -27,7 +27,8 @@ use pallet_broker::{CoreAssignment, CoreIndex as BrokerCoreIndex};
use primitives::{CoreIndex, Id as ParaId};
use sp_arithmetic::traits::SaturatedConversion;
use xcm::v3::{
send_xcm, Instruction, Junction, Junctions, MultiLocation, OriginKind, SendXcm, Xcm,
send_xcm, Instruction, Junction, Junctions, MultiLocation, OriginKind, SendXcm, WeightLimit,
Xcm,
};
use crate::{
@@ -220,9 +221,13 @@ impl<T: Config> Pallet<T> {
let new_core_count = notification.new_config.coretime_cores;
if new_core_count != old_core_count {
let core_count: u16 = new_core_count.saturated_into();
let message = Xcm(vec![mk_coretime_call(
crate::coretime::CoretimeCalls::NotifyCoreCount(core_count),
)]);
let message = Xcm(vec![
Instruction::UnpaidExecution {
weight_limit: WeightLimit::Unlimited,
check_origin: None,
},
mk_coretime_call(crate::coretime::CoretimeCalls::NotifyCoreCount(core_count)),
]);
if let Err(err) = send_xcm::<T::SendXcm>(
MultiLocation {
parents: 0,
@@ -247,7 +252,7 @@ fn mk_coretime_call(call: crate::coretime::CoretimeCalls) -> Instruction<()> {
origin_kind: OriginKind::Superuser,
// Largest call is set_lease with 1526 byte:
// Longest call is reserve() with 31_000_000
require_weight_at_most: Weight::from_parts(100_000_000, 20_000),
require_weight_at_most: Weight::from_parts(110_000_000, 20_000),
call: BrokerRuntimePallets::Broker(call).encode().into(),
}
}