Skip to content

Commit

Permalink
Fix collectives-polkadot benchmarks
Browse files Browse the repository at this point in the history
  • Loading branch information
bkontur committed Jul 18, 2024
1 parent 18adcbc commit 1398b62
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions system-parachains/collectives/collectives-polkadot/src/impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,25 @@ pub mod benchmarks {
pub struct OpenHrmpChannel<I>(PhantomData<I>);
impl<I: Get<u32>> EnsureSuccessful for OpenHrmpChannel<I> {
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:?}"
);
}
}
}
}
Expand Down

0 comments on commit 1398b62

Please sign in to comment.