From 1398b624b24d64e5e87ee8d517e23c30d357dfc9 Mon Sep 17 00:00:00 2001 From: Branislav Kontur Date: Thu, 18 Jul 2024 11:36:03 +0200 Subject: [PATCH] Fix collectives-polkadot benchmarks --- .../collectives-polkadot/src/impls.rs | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/system-parachains/collectives/collectives-polkadot/src/impls.rs b/system-parachains/collectives/collectives-polkadot/src/impls.rs index a897e6b112..61d1f768f8 100644 --- a/system-parachains/collectives/collectives-polkadot/src/impls.rs +++ b/system-parachains/collectives/collectives-polkadot/src/impls.rs @@ -241,8 +241,25 @@ pub mod benchmarks { pub struct OpenHrmpChannel(PhantomData); impl> EnsureSuccessful for OpenHrmpChannel { fn ensure_successful() { - if let ChannelStatus::Closed = ParachainSystem::get_channel_status(I::get().into()) { - ParachainSystem::open_outbound_hrmp_channel_for_benchmarks_or_tests(I::get().into()) + let para_id = I::get(); + + // open HRMP channel + if let ChannelStatus::Closed = ParachainSystem::get_channel_status(para_id.into()) { + ParachainSystem::open_outbound_hrmp_channel_for_benchmarks_or_tests(para_id.into()) + } + + // set XCM version for sibling parachain + let sibling_parachain = Location::new(1, [Parachain(para_id)]); + if let None = PolkadotXcm::get_version_for(&sibling_parachain) { + if let Err(e) = PolkadotXcm::force_xcm_version( + RuntimeOrigin::root(), + sibling_parachain.into(), + system_parachains_constants::genesis_presets::SAFE_XCM_VERSION, + ) { + log::error!( + "Failed to `force_xcm_version` for para_id: {para_id:?}, error: {e:?}" + ); + } } } }