From 5eaae3206d9a43752d6c5b0d8a2949ad7de7bfbf Mon Sep 17 00:00:00 2001 From: Branislav Kontur Date: Thu, 25 Apr 2024 11:10:46 +0200 Subject: [PATCH 01/17] Add support for versioned notification for HRMP pallet --- polkadot/runtime/parachains/src/hrmp.rs | 170 +++++++++++------- polkadot/runtime/parachains/src/hrmp/tests.rs | 3 + polkadot/runtime/parachains/src/mock.rs | 2 + 3 files changed, 114 insertions(+), 61 deletions(-) diff --git a/polkadot/runtime/parachains/src/hrmp.rs b/polkadot/runtime/parachains/src/hrmp.rs index 65652b38577b..f8c7002c08a5 100644 --- a/polkadot/runtime/parachains/src/hrmp.rs +++ b/polkadot/runtime/parachains/src/hrmp.rs @@ -245,6 +245,23 @@ impl fmt::Debug for OutboundHrmpAcceptanceErr { } } +/// Trait for determining which version (e.g. XCM version) should be used for a notification to be +/// sent to the parachain. +pub trait GetNotificationVersion { + // TODO:(remove-todo) - use `xcm::Version = u32` instead of `u32`? + fn for_para(para_id: ParaId) -> Option; +} + +/// `()` implementation returns `None`. +impl GetNotificationVersion for () { + fn for_para(_: ParaId) -> Option { + None + } +} + +// TODO: implement adapter for `GetNotificationVersion` + `pallet_xcm::GetVersion(for or +// safeXcmVersion)` + #[frame_support::pallet] pub mod pallet { use super::*; @@ -278,6 +295,11 @@ pub mod pallet { /// parachain. type DefaultChannelSizeAndCapacityWithSystem: Get<(u32, u32)>; + /// Get the notification version for the destination parachain. + /// If a version is not provided, then the default/latest version will be used (as best + /// effort). + type NotificationVersion: GetNotificationVersion; + /// Something that provides the weight of this pallet. type WeightInfo: WeightInfo; } @@ -1499,28 +1521,19 @@ impl Pallet { ); HrmpOpenChannelRequestsList::::append(channel_id); - let notification_bytes = { - use parity_scale_codec::Encode as _; - use xcm::opaque::{latest::prelude::*, VersionedXcm}; - - VersionedXcm::from(Xcm(vec![HrmpNewChannelOpenRequest { - sender: u32::from(origin), - max_capacity: proposed_max_capacity, - max_message_size: proposed_max_message_size, - }])) - .encode() - }; - if let Err(dmp::QueueDownwardMessageError::ExceedsMaxMessageSize) = - dmp::Pallet::::queue_downward_message(&config, recipient, notification_bytes) - { - // this should never happen unless the max downward message size is configured to a - // jokingly small number. - log::error!( - target: "runtime::hrmp", - "sending 'init_open_channel::notification_bytes' failed." - ); - debug_assert!(false); - } + Self::send_notification_to_para( + "init_open_channel", + &config, + recipient, + Self::versioned_xcm_notification(|| { + use xcm::opaque::latest::{prelude::*, Xcm}; + Xcm(vec![HrmpNewChannelOpenRequest { + sender: u32::from(origin), + max_capacity: proposed_max_capacity, + max_message_size: proposed_max_message_size, + }]) + }), + ); Ok(()) } @@ -1562,23 +1575,15 @@ impl Pallet { HrmpOpenChannelRequests::::insert(&channel_id, channel_req); HrmpAcceptedChannelRequestCount::::insert(&origin, accepted_cnt + 1); - let notification_bytes = { - use parity_scale_codec::Encode as _; - use xcm::opaque::{latest::prelude::*, VersionedXcm}; - let xcm = Xcm(vec![HrmpChannelAccepted { recipient: u32::from(origin) }]); - VersionedXcm::from(xcm).encode() - }; - if let Err(dmp::QueueDownwardMessageError::ExceedsMaxMessageSize) = - dmp::Pallet::::queue_downward_message(&config, sender, notification_bytes) - { - // this should never happen unless the max downward message size is configured to an - // jokingly small number. - log::error!( - target: "runtime::hrmp", - "sending 'accept_open_channel::notification_bytes' failed." - ); - debug_assert!(false); - } + Self::send_notification_to_para( + "accept_open_channel", + &config, + sender, + Self::versioned_xcm_notification(|| { + use xcm::opaque::latest::{prelude::*, Xcm}; + Xcm(vec![HrmpChannelAccepted { recipient: u32::from(origin) }]) + }), + ); Ok(()) } @@ -1633,30 +1638,22 @@ impl Pallet { HrmpCloseChannelRequestsList::::append(channel_id.clone()); let config = configuration::ActiveConfig::::get(); - let notification_bytes = { - use parity_scale_codec::Encode as _; - use xcm::opaque::{latest::prelude::*, VersionedXcm}; - - VersionedXcm::from(Xcm(vec![HrmpChannelClosing { - initiator: u32::from(origin), - sender: u32::from(channel_id.sender), - recipient: u32::from(channel_id.recipient), - }])) - .encode() - }; let opposite_party = if origin == channel_id.sender { channel_id.recipient } else { channel_id.sender }; - if let Err(dmp::QueueDownwardMessageError::ExceedsMaxMessageSize) = - dmp::Pallet::::queue_downward_message(&config, opposite_party, notification_bytes) - { - // this should never happen unless the max downward message size is configured to an - // jokingly small number. - log::error!( - target: "runtime::hrmp", - "sending 'close_channel::notification_bytes' failed." - ); - debug_assert!(false); - } + + Self::send_notification_to_para( + "close_channel", + &config, + opposite_party, + Self::versioned_xcm_notification(|| { + use xcm::opaque::latest::{prelude::*, Xcm}; + Xcm(vec![HrmpChannelClosing { + initiator: u32::from(origin), + sender: u32::from(channel_id.sender), + recipient: u32::from(channel_id.recipient), + }]) + }), + ); Ok(()) } @@ -1875,3 +1872,54 @@ impl Pallet { } } } + +impl Pallet { + // TODO: externalize XCM stuff from this module, so that runtime can decide what kind of + // notification will be provided + fn versioned_xcm_notification( + mut notification: impl FnMut() -> xcm::opaque::latest::opaque::Xcm, + ) -> impl FnOnce(&str, ParaId) -> primitives::DownwardMessage { + // return closure which can prepare notification + move |log_label, dest| { + use xcm::{opaque::VersionedXcm, IntoVersion}; + + // First check, if we know version for destination parachain. + if let Some(version) = T::NotificationVersion::for_para(dest) { + match VersionedXcm::from(notification()).into_version(version) { + Ok(versioned_xcm) => return versioned_xcm.encode(), + Err(_) => log::error!( + target: "runtime::hrmp", + "versioned_xcm_notification '{log_label}::notification_bytes' unsupported version: {version} for `VersionedXcm`" + ), + } + } + + // As a best effort, if we cannot resolve the version, fallback to using the latest + // version. + VersionedXcm::from(notification()).encode() + } + } + + fn send_notification_to_para( + log_label: &str, + config: &HostConfiguration>, + dest: ParaId, + notification_bytes: impl FnOnce(&str, ParaId) -> primitives::DownwardMessage, + ) { + // prepare notification + let notification_bytes = notification_bytes(log_label, dest); + + // try to enqueue + if let Err(dmp::QueueDownwardMessageError::ExceedsMaxMessageSize) = + dmp::Pallet::::queue_downward_message(&config, dest, notification_bytes) + { + // this should never happen unless the max downward message size is configured to a + // jokingly small number. + log::error!( + target: "runtime::hrmp", + "sending '{log_label}::notification_bytes' failed." + ); + debug_assert!(false); + } + } +} diff --git a/polkadot/runtime/parachains/src/hrmp/tests.rs b/polkadot/runtime/parachains/src/hrmp/tests.rs index 2f767ab7e1b1..2a64e64472fd 100644 --- a/polkadot/runtime/parachains/src/hrmp/tests.rs +++ b/polkadot/runtime/parachains/src/hrmp/tests.rs @@ -160,8 +160,11 @@ fn open_channel_works() { proposed_max_capacity: 2, proposed_max_message_size: 8 }))); + // TODO: check dmp notication Hrmp::hrmp_accept_open_channel(para_b_origin.into(), para_a).unwrap(); + // TODO: check dmp notication + Hrmp::assert_storage_consistency_exhaustive(); assert!(System::events().iter().any(|record| record.event == MockEvent::Hrmp(Event::OpenChannelAccepted { sender: para_a, recipient: para_b }))); diff --git a/polkadot/runtime/parachains/src/mock.rs b/polkadot/runtime/parachains/src/mock.rs index 97a75d47ff77..3ea1073dc73c 100644 --- a/polkadot/runtime/parachains/src/mock.rs +++ b/polkadot/runtime/parachains/src/mock.rs @@ -257,6 +257,8 @@ impl crate::hrmp::Config for Test { type ChannelManager = frame_system::EnsureRoot; type Currency = pallet_balances::Pallet; type DefaultChannelSizeAndCapacityWithSystem = DefaultChannelSizeAndCapacityWithSystem; + // TODO: better testing stuff for more cases + type NotificationVersion = (); type WeightInfo = crate::hrmp::TestWeightInfo; } From 6e0fc993c92fb4cd659eaa74180a9004636e3009 Mon Sep 17 00:00:00 2001 From: Branislav Kontur Date: Thu, 25 Apr 2024 16:09:16 +0200 Subject: [PATCH 02/17] Add `WrapVersion` support --- polkadot/runtime/parachains/src/hrmp.rs | 85 ++++++++++--------------- polkadot/runtime/parachains/src/mock.rs | 2 +- 2 files changed, 35 insertions(+), 52 deletions(-) diff --git a/polkadot/runtime/parachains/src/hrmp.rs b/polkadot/runtime/parachains/src/hrmp.rs index f8c7002c08a5..eaaef2de76bd 100644 --- a/polkadot/runtime/parachains/src/hrmp.rs +++ b/polkadot/runtime/parachains/src/hrmp.rs @@ -245,23 +245,6 @@ impl fmt::Debug for OutboundHrmpAcceptanceErr { } } -/// Trait for determining which version (e.g. XCM version) should be used for a notification to be -/// sent to the parachain. -pub trait GetNotificationVersion { - // TODO:(remove-todo) - use `xcm::Version = u32` instead of `u32`? - fn for_para(para_id: ParaId) -> Option; -} - -/// `()` implementation returns `None`. -impl GetNotificationVersion for () { - fn for_para(_: ParaId) -> Option { - None - } -} - -// TODO: implement adapter for `GetNotificationVersion` + `pallet_xcm::GetVersion(for or -// safeXcmVersion)` - #[frame_support::pallet] pub mod pallet { use super::*; @@ -295,10 +278,8 @@ pub mod pallet { /// parachain. type DefaultChannelSizeAndCapacityWithSystem: Get<(u32, u32)>; - /// Get the notification version for the destination parachain. - /// If a version is not provided, then the default/latest version will be used (as best - /// effort). - type NotificationVersion: GetNotificationVersion; + /// Means of converting an `Xcm` into a `VersionedXcm`. + type VersionWrapper: xcm::WrapVersion; /// Something that provides the weight of this pallet. type WeightInfo: WeightInfo; @@ -1521,11 +1502,11 @@ impl Pallet { ); HrmpOpenChannelRequestsList::::append(channel_id); - Self::send_notification_to_para( + Self::send_to_para( "init_open_channel", &config, recipient, - Self::versioned_xcm_notification(|| { + Self::wrap_notification(|| { use xcm::opaque::latest::{prelude::*, Xcm}; Xcm(vec![HrmpNewChannelOpenRequest { sender: u32::from(origin), @@ -1575,11 +1556,11 @@ impl Pallet { HrmpOpenChannelRequests::::insert(&channel_id, channel_req); HrmpAcceptedChannelRequestCount::::insert(&origin, accepted_cnt + 1); - Self::send_notification_to_para( + Self::send_to_para( "accept_open_channel", &config, sender, - Self::versioned_xcm_notification(|| { + Self::wrap_notification(|| { use xcm::opaque::latest::{prelude::*, Xcm}; Xcm(vec![HrmpChannelAccepted { recipient: u32::from(origin) }]) }), @@ -1641,11 +1622,11 @@ impl Pallet { let opposite_party = if origin == channel_id.sender { channel_id.recipient } else { channel_id.sender }; - Self::send_notification_to_para( + Self::send_to_para( "close_channel", &config, opposite_party, - Self::versioned_xcm_notification(|| { + Self::wrap_notification(|| { use xcm::opaque::latest::{prelude::*, Xcm}; Xcm(vec![HrmpChannelClosing { initiator: u32::from(origin), @@ -1874,40 +1855,42 @@ impl Pallet { } impl Pallet { - // TODO: externalize XCM stuff from this module, so that runtime can decide what kind of - // notification will be provided - fn versioned_xcm_notification( + /// Wraps HRMP XCM notifications to the most suitable XCM version for the destination para. + /// If the XCM version is unknown, the latest XCM version is used as a best effort. + fn wrap_notification( mut notification: impl FnMut() -> xcm::opaque::latest::opaque::Xcm, - ) -> impl FnOnce(&str, ParaId) -> primitives::DownwardMessage { - // return closure which can prepare notification - move |log_label, dest| { - use xcm::{opaque::VersionedXcm, IntoVersion}; - - // First check, if we know version for destination parachain. - if let Some(version) = T::NotificationVersion::for_para(dest) { - match VersionedXcm::from(notification()).into_version(version) { - Ok(versioned_xcm) => return versioned_xcm.encode(), - Err(_) => log::error!( - target: "runtime::hrmp", - "versioned_xcm_notification '{log_label}::notification_bytes' unsupported version: {version} for `VersionedXcm`" - ), - } - } + ) -> impl FnOnce(ParaId) -> primitives::DownwardMessage { + use xcm::{ + opaque::VersionedXcm, + prelude::{Junction, Location}, + WrapVersion, + }; - // As a best effort, if we cannot resolve the version, fallback to using the latest - // version. - VersionedXcm::from(notification()).encode() + // return closure which can prepare notification + move |dest| { + // try to wrap notification for destination para + T::VersionWrapper::wrap_version( + &Location::new(0, [Junction::Parachain(dest.into())]), + notification(), + ) + .unwrap_or_else(|_| { + // As a best effort, if we cannot resolve the version, fallback to using the latest + // version. + VersionedXcm::from(notification()) + }) + .encode() } } - fn send_notification_to_para( + /// Sends/enqueues notification to the destination parachain. + fn send_to_para( log_label: &str, config: &HostConfiguration>, dest: ParaId, - notification_bytes: impl FnOnce(&str, ParaId) -> primitives::DownwardMessage, + notification_bytes_for: impl FnOnce(ParaId) -> primitives::DownwardMessage, ) { // prepare notification - let notification_bytes = notification_bytes(log_label, dest); + let notification_bytes = notification_bytes_for(dest); // try to enqueue if let Err(dmp::QueueDownwardMessageError::ExceedsMaxMessageSize) = diff --git a/polkadot/runtime/parachains/src/mock.rs b/polkadot/runtime/parachains/src/mock.rs index 3ea1073dc73c..be45f63b409d 100644 --- a/polkadot/runtime/parachains/src/mock.rs +++ b/polkadot/runtime/parachains/src/mock.rs @@ -258,7 +258,7 @@ impl crate::hrmp::Config for Test { type Currency = pallet_balances::Pallet; type DefaultChannelSizeAndCapacityWithSystem = DefaultChannelSizeAndCapacityWithSystem; // TODO: better testing stuff for more cases - type NotificationVersion = (); + type VersionWrapper = (); type WeightInfo = crate::hrmp::TestWeightInfo; } From d20d2d0c36bdaf33af6a47deeedcd44a432dee79 Mon Sep 17 00:00:00 2001 From: Branislav Kontur Date: Thu, 25 Apr 2024 16:35:34 +0200 Subject: [PATCH 03/17] Set `VersionWrapper` for testnet relaychains --- polkadot/runtime/rococo/src/lib.rs | 1 + polkadot/runtime/test-runtime/src/lib.rs | 1 + polkadot/runtime/westend/src/lib.rs | 1 + 3 files changed, 3 insertions(+) diff --git a/polkadot/runtime/rococo/src/lib.rs b/polkadot/runtime/rococo/src/lib.rs index 1cfe9adfe13d..816480de66ab 100644 --- a/polkadot/runtime/rococo/src/lib.rs +++ b/polkadot/runtime/rococo/src/lib.rs @@ -1042,6 +1042,7 @@ impl parachains_hrmp::Config for Runtime { type ChannelManager = EnsureRoot; type Currency = Balances; type DefaultChannelSizeAndCapacityWithSystem = DefaultChannelSizeAndCapacityWithSystem; + type VersionWrapper = crate::XcmPallet; type WeightInfo = weights::runtime_parachains_hrmp::WeightInfo; } diff --git a/polkadot/runtime/test-runtime/src/lib.rs b/polkadot/runtime/test-runtime/src/lib.rs index 514643c0a201..9d8fec6ccaec 100644 --- a/polkadot/runtime/test-runtime/src/lib.rs +++ b/polkadot/runtime/test-runtime/src/lib.rs @@ -567,6 +567,7 @@ impl parachains_hrmp::Config for Runtime { type ChannelManager = frame_system::EnsureRoot; type Currency = Balances; type DefaultChannelSizeAndCapacityWithSystem = DefaultChannelSizeAndCapacityWithSystem; + type VersionWrapper = crate::Xcm; type WeightInfo = parachains_hrmp::TestWeightInfo; } diff --git a/polkadot/runtime/westend/src/lib.rs b/polkadot/runtime/westend/src/lib.rs index 7924939c79bd..5d3f31456f7f 100644 --- a/polkadot/runtime/westend/src/lib.rs +++ b/polkadot/runtime/westend/src/lib.rs @@ -1173,6 +1173,7 @@ impl parachains_hrmp::Config for Runtime { type ChannelManager = EnsureRoot; type Currency = Balances; type DefaultChannelSizeAndCapacityWithSystem = DefaultChannelSizeAndCapacityWithSystem; + type VersionWrapper = crate::XcmPallet; type WeightInfo = weights::runtime_parachains_hrmp::WeightInfo; } From 2487e3da055f6a2cb70e721e5773ea938804d8bb Mon Sep 17 00:00:00 2001 From: Branislav Kontur Date: Thu, 25 Apr 2024 16:38:00 +0200 Subject: [PATCH 04/17] doc --- polkadot/runtime/parachains/src/hrmp.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/polkadot/runtime/parachains/src/hrmp.rs b/polkadot/runtime/parachains/src/hrmp.rs index eaaef2de76bd..ccbb7ca80c72 100644 --- a/polkadot/runtime/parachains/src/hrmp.rs +++ b/polkadot/runtime/parachains/src/hrmp.rs @@ -1866,9 +1866,9 @@ impl Pallet { WrapVersion, }; - // return closure which can prepare notification + // Return a closure that can prepare notifications. move |dest| { - // try to wrap notification for destination para + // Attempt to wrap the notification for the destination parachain. T::VersionWrapper::wrap_version( &Location::new(0, [Junction::Parachain(dest.into())]), notification(), From 7446dbec6119615443e992f3a5c5c304a1d3379c Mon Sep 17 00:00:00 2001 From: Branislav Kontur Date: Fri, 26 Apr 2024 21:05:48 +0200 Subject: [PATCH 05/17] Removed unused `FirstMessageFactorPercent` --- polkadot/runtime/parachains/src/mock.rs | 1 - polkadot/runtime/test-runtime/src/lib.rs | 1 - polkadot/xcm/xcm-simulator/example/src/relay_chain.rs | 4 ---- polkadot/xcm/xcm-simulator/fuzzer/src/relay_chain.rs | 4 ---- 4 files changed, 10 deletions(-) diff --git a/polkadot/runtime/parachains/src/mock.rs b/polkadot/runtime/parachains/src/mock.rs index be45f63b409d..5bdab59230f4 100644 --- a/polkadot/runtime/parachains/src/mock.rs +++ b/polkadot/runtime/parachains/src/mock.rs @@ -247,7 +247,6 @@ impl crate::paras::Config for Test { impl crate::dmp::Config for Test {} parameter_types! { - pub const FirstMessageFactorPercent: u64 = 100; pub const DefaultChannelSizeAndCapacityWithSystem: (u32, u32) = (4, 1); } diff --git a/polkadot/runtime/test-runtime/src/lib.rs b/polkadot/runtime/test-runtime/src/lib.rs index 9d8fec6ccaec..ed784b1acd59 100644 --- a/polkadot/runtime/test-runtime/src/lib.rs +++ b/polkadot/runtime/test-runtime/src/lib.rs @@ -557,7 +557,6 @@ parameter_types! { impl parachains_dmp::Config for Runtime {} parameter_types! { - pub const FirstMessageFactorPercent: u64 = 100; pub const DefaultChannelSizeAndCapacityWithSystem: (u32, u32) = (51200, 500); } diff --git a/polkadot/xcm/xcm-simulator/example/src/relay_chain.rs b/polkadot/xcm/xcm-simulator/example/src/relay_chain.rs index b41df3cfa2b0..84a1162f025c 100644 --- a/polkadot/xcm/xcm-simulator/example/src/relay_chain.rs +++ b/polkadot/xcm/xcm-simulator/example/src/relay_chain.rs @@ -232,10 +232,6 @@ impl pallet_xcm::Config for Runtime { type AdminOrigin = EnsureRoot; } -parameter_types! { - pub const FirstMessageFactorPercent: u64 = 100; -} - impl origin::Config for Runtime {} type Block = frame_system::mocking::MockBlock; diff --git a/polkadot/xcm/xcm-simulator/fuzzer/src/relay_chain.rs b/polkadot/xcm/xcm-simulator/fuzzer/src/relay_chain.rs index 47209b765d15..cf3ca0de2bb4 100644 --- a/polkadot/xcm/xcm-simulator/fuzzer/src/relay_chain.rs +++ b/polkadot/xcm/xcm-simulator/fuzzer/src/relay_chain.rs @@ -191,10 +191,6 @@ impl pallet_xcm::Config for Runtime { type AdminOrigin = EnsureRoot; } -parameter_types! { - pub const FirstMessageFactorPercent: u64 = 100; -} - impl origin::Config for Runtime {} parameter_types! { From 3e9ce22018e9c0679f0104c3dd646c14218ad114 Mon Sep 17 00:00:00 2001 From: Branislav Kontur Date: Fri, 26 Apr 2024 23:30:18 +0200 Subject: [PATCH 06/17] Added `hrmp_notifications_works` --- polkadot/runtime/parachains/src/hrmp/tests.rs | 121 +++++++++++++++++- 1 file changed, 116 insertions(+), 5 deletions(-) diff --git a/polkadot/runtime/parachains/src/hrmp/tests.rs b/polkadot/runtime/parachains/src/hrmp/tests.rs index 2a64e64472fd..9f2245d629ff 100644 --- a/polkadot/runtime/parachains/src/hrmp/tests.rs +++ b/polkadot/runtime/parachains/src/hrmp/tests.rs @@ -22,13 +22,13 @@ use super::*; use crate::{ mock::{ deregister_parachain, new_test_ext, register_parachain, register_parachain_with_balance, - Hrmp, MockGenesisConfig, Paras, ParasShared, RuntimeEvent as MockEvent, RuntimeOrigin, + Dmp, Hrmp, MockGenesisConfig, Paras, ParasShared, RuntimeEvent as MockEvent, RuntimeOrigin, System, Test, }, shared, }; use frame_support::{assert_noop, assert_ok, error::BadOrigin}; -use primitives::BlockNumber; +use primitives::{BlockNumber, InboundDownwardMessage}; use std::collections::BTreeMap; pub(crate) fn run_to_block(to: BlockNumber, new_session: Option>) { @@ -160,11 +160,8 @@ fn open_channel_works() { proposed_max_capacity: 2, proposed_max_message_size: 8 }))); - // TODO: check dmp notication Hrmp::hrmp_accept_open_channel(para_b_origin.into(), para_a).unwrap(); - // TODO: check dmp notication - Hrmp::assert_storage_consistency_exhaustive(); assert!(System::events().iter().any(|record| record.event == MockEvent::Hrmp(Event::OpenChannelAccepted { sender: para_a, recipient: para_b }))); @@ -1007,3 +1004,117 @@ fn establish_channel_with_system_with_invalid_args() { Hrmp::assert_storage_consistency_exhaustive(); }); } + +#[test] +fn hrmp_notifications_works() { + use xcm::opaque::{ + latest::{prelude::*, Xcm}, + VersionedXcm, + }; + + let para_a = 2001.into(); + let para_a_origin: crate::Origin = 2001.into(); + let para_b = 2003.into(); + let para_b_origin: crate::Origin = 2003.into(); + + new_test_ext(GenesisConfigBuilder::default().build()).execute_with(|| { + // We need both A & B to be registered and alive parachains. + register_parachain(para_a); + register_parachain(para_b); + run_to_block(5, Some(vec![4, 5])); + + let assert_notification_for = |sent_at, para_id, expected| { + assert_eq!( + Dmp::dmq_contents(para_id), + vec![InboundDownwardMessage { sent_at, msg: expected }] + ); + }; + + // init open channel requests + assert_ok!(Hrmp::hrmp_init_open_channel(para_a_origin.clone().into(), para_b, 2, 8)); + assert_ok!(Hrmp::hrmp_init_open_channel(para_b_origin.clone().into(), para_a, 2, 8)); + Hrmp::assert_storage_consistency_exhaustive(); + + // check dmp notications + assert_notification_for( + 5, + para_b, + VersionedXcm::from(Xcm(vec![HrmpNewChannelOpenRequest { + sender: u32::from(para_a), + max_capacity: 2, + max_message_size: 8, + }])) + .encode(), + ); + assert_notification_for( + 5, + para_a, + VersionedXcm::from(Xcm(vec![HrmpNewChannelOpenRequest { + sender: u32::from(para_b), + max_capacity: 2, + max_message_size: 8, + }])) + .encode(), + ); + let _ = Dmp::prune_dmq(para_a, 1000); + let _ = Dmp::prune_dmq(para_b, 1000); + + // accept open channel requests + assert_ok!(Hrmp::hrmp_accept_open_channel(para_a_origin.clone().into(), para_b)); + assert_ok!(Hrmp::hrmp_accept_open_channel(para_b_origin.clone().into(), para_a)); + Hrmp::assert_storage_consistency_exhaustive(); + + // check dmp notications + assert_notification_for( + 5, + para_b, + VersionedXcm::from(Xcm(vec![HrmpChannelAccepted { recipient: u32::from(para_a) }])) + .encode(), + ); + assert_notification_for( + 5, + para_a, + VersionedXcm::from(Xcm(vec![HrmpChannelAccepted { recipient: u32::from(para_b) }])) + .encode(), + ); + let _ = Dmp::prune_dmq(para_a, 1000); + let _ = Dmp::prune_dmq(para_b, 1000); + + // On Block 6: session change - creates channel. + run_to_block(6, Some(vec![6])); + assert!(channel_exists(para_a, para_b)); + + // close channel requests + assert_ok!(Hrmp::hrmp_close_channel( + para_a_origin.into(), + HrmpChannelId { sender: para_a, recipient: para_b } + )); + assert_ok!(Hrmp::hrmp_close_channel( + para_b_origin.into(), + HrmpChannelId { sender: para_b, recipient: para_a } + )); + Hrmp::assert_storage_consistency_exhaustive(); + + // check dmp notications + assert_notification_for( + 6, + para_b, + VersionedXcm::from(Xcm(vec![HrmpChannelClosing { + initiator: u32::from(para_a), + sender: u32::from(para_a), + recipient: u32::from(para_b), + }])) + .encode(), + ); + assert_notification_for( + 6, + para_a, + VersionedXcm::from(Xcm(vec![HrmpChannelClosing { + initiator: u32::from(para_b), + sender: u32::from(para_b), + recipient: u32::from(para_a), + }])) + .encode(), + ); + }); +} From 28d4f70ce754b2c191f9b9e748e24c9013033c66 Mon Sep 17 00:00:00 2001 From: Branislav Kontur Date: Mon, 29 Apr 2024 09:57:47 +0200 Subject: [PATCH 07/17] Adding `TestUsesOnlyStoredVersionWrapper` for `hrmp_notifications_works` covering non-lastest XCM version scenario --- polkadot/runtime/parachains/src/hrmp/tests.rs | 31 +++++++++++-- polkadot/runtime/parachains/src/mock.rs | 45 ++++++++++++++++--- 2 files changed, 67 insertions(+), 9 deletions(-) diff --git a/polkadot/runtime/parachains/src/hrmp/tests.rs b/polkadot/runtime/parachains/src/hrmp/tests.rs index 9f2245d629ff..116b4badd8e5 100644 --- a/polkadot/runtime/parachains/src/hrmp/tests.rs +++ b/polkadot/runtime/parachains/src/hrmp/tests.rs @@ -23,7 +23,7 @@ use crate::{ mock::{ deregister_parachain, new_test_ext, register_parachain, register_parachain_with_balance, Dmp, Hrmp, MockGenesisConfig, Paras, ParasShared, RuntimeEvent as MockEvent, RuntimeOrigin, - System, Test, + System, Test, TestUsesOnlyStoredVersionWrapper, }, shared, }; @@ -1007,9 +1007,12 @@ fn establish_channel_with_system_with_invalid_args() { #[test] fn hrmp_notifications_works() { - use xcm::opaque::{ - latest::{prelude::*, Xcm}, - VersionedXcm, + use xcm::{ + opaque::{ + latest::{prelude::*, Xcm}, + VersionedXcm, + }, + IntoVersion, }; let para_a = 2001.into(); @@ -1023,6 +1026,20 @@ fn hrmp_notifications_works() { register_parachain(para_b); run_to_block(5, Some(vec![4, 5])); + // set XCM versions for wrapper + + // for para_a -> `None`, means we will use latest. + TestUsesOnlyStoredVersionWrapper::set_version( + Location::new(0, [Junction::Parachain(para_a.clone().into())]), + None, + ); + // for para_b -> `Some(latest - 1)`, means we will use latest-1 XCM version. + let previous_version = XCM_VERSION - 1; + TestUsesOnlyStoredVersionWrapper::set_version( + Location::new(0, [Junction::Parachain(para_b.clone().into())]), + Some(previous_version), + ); + let assert_notification_for = |sent_at, para_id, expected| { assert_eq!( Dmp::dmq_contents(para_id), @@ -1044,6 +1061,8 @@ fn hrmp_notifications_works() { max_capacity: 2, max_message_size: 8, }])) + .into_version(previous_version) + .expect("compatible") .encode(), ); assert_notification_for( @@ -1069,6 +1088,8 @@ fn hrmp_notifications_works() { 5, para_b, VersionedXcm::from(Xcm(vec![HrmpChannelAccepted { recipient: u32::from(para_a) }])) + .into_version(previous_version) + .expect("compatible") .encode(), ); assert_notification_for( @@ -1104,6 +1125,8 @@ fn hrmp_notifications_works() { sender: u32::from(para_a), recipient: u32::from(para_b), }])) + .into_version(previous_version) + .expect("compatible") .encode(), ); assert_notification_for( diff --git a/polkadot/runtime/parachains/src/mock.rs b/polkadot/runtime/parachains/src/mock.rs index 5bdab59230f4..2b1d583ec078 100644 --- a/polkadot/runtime/parachains/src/mock.rs +++ b/polkadot/runtime/parachains/src/mock.rs @@ -50,9 +50,16 @@ use sp_runtime::{ transaction_validity::TransactionPriority, BuildStorage, FixedU128, Perbill, Permill, }; -use sp_std::collections::vec_deque::VecDeque; -use std::{cell::RefCell, collections::HashMap}; -use xcm::v4::{Assets, Location, SendError, SendResult, SendXcm, Xcm, XcmHash}; +use sp_std::{ + cell::RefCell, + collections::{btree_map::BTreeMap, vec_deque::VecDeque}, +}; +use std::collections::HashMap; +use xcm::{ + prelude::XcmVersion, + v4::{Assets, Location, SendError, SendResult, SendXcm, Xcm, XcmHash}, + IntoVersion, VersionedXcm, WrapVersion, +}; type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic; type Block = frame_system::mocking::MockBlockU32; @@ -250,14 +257,42 @@ parameter_types! { pub const DefaultChannelSizeAndCapacityWithSystem: (u32, u32) = (4, 1); } +thread_local! { + pub static VERSION_WRAPPER: RefCell>> = RefCell::new(BTreeMap::new()); +} +/// Mock implementation of the [`WrapVersion`] trait which wraps XCM only for known/stored XCM +/// versions in the `VERSION_WRAPPER`. +pub struct TestUsesOnlyStoredVersionWrapper; +impl WrapVersion for TestUsesOnlyStoredVersionWrapper { + fn wrap_version( + dest: &Location, + xcm: impl Into>, + ) -> Result, ()> { + match VERSION_WRAPPER.with(|r| r.borrow().get(dest).map_or(None, |v| v.clone())) { + Some(v) => xcm.into().into_version(v), + None => return Err(()), + } + } +} +impl TestUsesOnlyStoredVersionWrapper { + pub fn set_version(location: Location, version: Option) { + VERSION_WRAPPER.with(|r| { + let _ = r + .borrow_mut() + .entry(location) + .and_modify(|v| *v = version.clone()) + .or_insert(version); + }); + } +} + impl crate::hrmp::Config for Test { type RuntimeOrigin = RuntimeOrigin; type RuntimeEvent = RuntimeEvent; type ChannelManager = frame_system::EnsureRoot; type Currency = pallet_balances::Pallet; type DefaultChannelSizeAndCapacityWithSystem = DefaultChannelSizeAndCapacityWithSystem; - // TODO: better testing stuff for more cases - type VersionWrapper = (); + type VersionWrapper = TestUsesOnlyStoredVersionWrapper; type WeightInfo = crate::hrmp::TestWeightInfo; } From 1e1f1a09e35275e785a704c56fd54ef72bebe6e3 Mon Sep 17 00:00:00 2001 From: Branislav Kontur Date: Mon, 29 Apr 2024 10:13:51 +0200 Subject: [PATCH 08/17] prdoc --- prdoc/pr_4281.prdoc | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 prdoc/pr_4281.prdoc diff --git a/prdoc/pr_4281.prdoc b/prdoc/pr_4281.prdoc new file mode 100644 index 000000000000..bb3143a74ca7 --- /dev/null +++ b/prdoc/pr_4281.prdoc @@ -0,0 +1,16 @@ +title: "Add support for versioned notification for HRMP pallet" + +doc: + - audience: Runtime Dev + description: | + The configuration of the HRMP pallet has been expanded to include the `VersionWrapper` type, + which controls the encoding of XCM notifications related to the opening/closing of HRMP channels. + If your runtime does not concern itself with the XCM version used for notifications, + you can set it as `type VersionWrapper = ()` to always use the latest XCM. + If your runtime does care about the XCM version when sending to child parachains, + you can provide an instance of the `pallet_xcm` with `type VersionWrapper = XcmPallet`, + which can manage XCM versions for destinations. + +crates: +- name: polkadot-runtime-parachains + bump: minor From fa966744360b1358646996394b1579a6db4b37bd Mon Sep 17 00:00:00 2001 From: Branislav Kontur Date: Mon, 29 Apr 2024 10:20:28 +0200 Subject: [PATCH 09/17] clippy --- polkadot/runtime/parachains/src/hrmp/tests.rs | 4 ++-- polkadot/runtime/parachains/src/mock.rs | 8 ++------ 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/polkadot/runtime/parachains/src/hrmp/tests.rs b/polkadot/runtime/parachains/src/hrmp/tests.rs index 116b4badd8e5..acfaa8f2d290 100644 --- a/polkadot/runtime/parachains/src/hrmp/tests.rs +++ b/polkadot/runtime/parachains/src/hrmp/tests.rs @@ -1030,13 +1030,13 @@ fn hrmp_notifications_works() { // for para_a -> `None`, means we will use latest. TestUsesOnlyStoredVersionWrapper::set_version( - Location::new(0, [Junction::Parachain(para_a.clone().into())]), + Location::new(0, [Junction::Parachain(para_a.into())]), None, ); // for para_b -> `Some(latest - 1)`, means we will use latest-1 XCM version. let previous_version = XCM_VERSION - 1; TestUsesOnlyStoredVersionWrapper::set_version( - Location::new(0, [Junction::Parachain(para_b.clone().into())]), + Location::new(0, [Junction::Parachain(para_b.into())]), Some(previous_version), ); diff --git a/polkadot/runtime/parachains/src/mock.rs b/polkadot/runtime/parachains/src/mock.rs index 2b1d583ec078..a32c9d11b36e 100644 --- a/polkadot/runtime/parachains/src/mock.rs +++ b/polkadot/runtime/parachains/src/mock.rs @@ -268,7 +268,7 @@ impl WrapVersion for TestUsesOnlyStoredVersionWrapper { dest: &Location, xcm: impl Into>, ) -> Result, ()> { - match VERSION_WRAPPER.with(|r| r.borrow().get(dest).map_or(None, |v| v.clone())) { + match VERSION_WRAPPER.with(|r| r.borrow().get(dest).map_or(None, |v| *v)) { Some(v) => xcm.into().into_version(v), None => return Err(()), } @@ -277,11 +277,7 @@ impl WrapVersion for TestUsesOnlyStoredVersionWrapper { impl TestUsesOnlyStoredVersionWrapper { pub fn set_version(location: Location, version: Option) { VERSION_WRAPPER.with(|r| { - let _ = r - .borrow_mut() - .entry(location) - .and_modify(|v| *v = version.clone()) - .or_insert(version); + let _ = r.borrow_mut().entry(location).and_modify(|v| *v = version).or_insert(version); }); } } From 7ee3af4b774b40fe2a276314096c035731390b4b Mon Sep 17 00:00:00 2001 From: command-bot <> Date: Mon, 29 Apr 2024 08:45:54 +0000 Subject: [PATCH 10/17] ".git/.scripts/commands/bench/bench.sh" --subcommand=pallet --runtime=westend --target_dir=polkadot --pallet=runtime_parachains::hrmp --- .../src/weights/runtime_parachains_hrmp.rs | 424 ++++++++++-------- 1 file changed, 228 insertions(+), 196 deletions(-) diff --git a/polkadot/runtime/westend/src/weights/runtime_parachains_hrmp.rs b/polkadot/runtime/westend/src/weights/runtime_parachains_hrmp.rs index 3d2ab827b8fd..c2cb56f6e3f8 100644 --- a/polkadot/runtime/westend/src/weights/runtime_parachains_hrmp.rs +++ b/polkadot/runtime/westend/src/weights/runtime_parachains_hrmp.rs @@ -16,28 +16,26 @@ //! Autogenerated weights for `runtime_parachains::hrmp` //! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-06-14, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-04-29, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `runner--ss9ysm1-project-163-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("westend-dev"), DB CACHE: 1024 +//! HOSTNAME: `runner-dcu62vjg-project-674-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` +//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("westend-dev")`, DB CACHE: 1024 // Executed Command: -// ./target/production/polkadot +// target/production/polkadot // benchmark // pallet -// --chain=westend-dev // --steps=50 // --repeat=20 -// --no-storage-info -// --no-median-slopes -// --no-min-squares -// --pallet=runtime_parachains::hrmp // --extrinsic=* -// --execution=wasm // --wasm-execution=compiled -// --header=./file_header.txt -// --output=./runtime/westend/src/weights/runtime_parachains_hrmp.rs +// --heap-pages=4096 +// --json-file=/builds/parity/mirrors/polkadot-sdk/.git/.artifacts/bench.json +// --pallet=runtime_parachains::hrmp +// --chain=westend-dev +// --header=./polkadot/file_header.txt +// --output=./polkadot/runtime/westend/src/weights/ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] @@ -50,99 +48,103 @@ use core::marker::PhantomData; /// Weight functions for `runtime_parachains::hrmp`. pub struct WeightInfo(PhantomData); impl runtime_parachains::hrmp::WeightInfo for WeightInfo { - /// Storage: Paras ParaLifecycles (r:2 w:0) - /// Proof Skipped: Paras ParaLifecycles (max_values: None, max_size: None, mode: Measured) - /// Storage: Hrmp HrmpOpenChannelRequests (r:1 w:1) - /// Proof Skipped: Hrmp HrmpOpenChannelRequests (max_values: None, max_size: None, mode: Measured) - /// Storage: Hrmp HrmpChannels (r:1 w:0) - /// Proof Skipped: Hrmp HrmpChannels (max_values: None, max_size: None, mode: Measured) - /// Storage: Hrmp HrmpEgressChannelsIndex (r:1 w:0) - /// Proof Skipped: Hrmp HrmpEgressChannelsIndex (max_values: None, max_size: None, mode: Measured) - /// Storage: Hrmp HrmpOpenChannelRequestCount (r:1 w:1) - /// Proof Skipped: Hrmp HrmpOpenChannelRequestCount (max_values: None, max_size: None, mode: Measured) - /// Storage: Hrmp HrmpOpenChannelRequestsList (r:1 w:1) - /// Proof Skipped: Hrmp HrmpOpenChannelRequestsList (max_values: Some(1), max_size: None, mode: Measured) - /// Storage: Dmp DownwardMessageQueues (r:1 w:1) - /// Proof Skipped: Dmp DownwardMessageQueues (max_values: None, max_size: None, mode: Measured) - /// Storage: Dmp DownwardMessageQueueHeads (r:1 w:1) - /// Proof Skipped: Dmp DownwardMessageQueueHeads (max_values: None, max_size: None, mode: Measured) + /// Storage: `Paras::ParaLifecycles` (r:1 w:0) + /// Proof: `Paras::ParaLifecycles` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Hrmp::HrmpOpenChannelRequests` (r:1 w:1) + /// Proof: `Hrmp::HrmpOpenChannelRequests` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Hrmp::HrmpChannels` (r:1 w:0) + /// Proof: `Hrmp::HrmpChannels` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Hrmp::HrmpEgressChannelsIndex` (r:1 w:0) + /// Proof: `Hrmp::HrmpEgressChannelsIndex` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Hrmp::HrmpOpenChannelRequestCount` (r:1 w:1) + /// Proof: `Hrmp::HrmpOpenChannelRequestCount` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Hrmp::HrmpOpenChannelRequestsList` (r:1 w:1) + /// Proof: `Hrmp::HrmpOpenChannelRequestsList` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `XcmPallet::SupportedVersion` (r:1 w:0) + /// Proof: `XcmPallet::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Dmp::DownwardMessageQueues` (r:1 w:1) + /// Proof: `Dmp::DownwardMessageQueues` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Dmp::DownwardMessageQueueHeads` (r:1 w:1) + /// Proof: `Dmp::DownwardMessageQueueHeads` (`max_values`: None, `max_size`: None, mode: `Measured`) fn hrmp_init_open_channel() -> Weight { // Proof Size summary in bytes: - // Measured: `307` - // Estimated: `6247` - // Minimum execution time: 35_676_000 picoseconds. - Weight::from_parts(36_608_000, 0) - .saturating_add(Weight::from_parts(0, 6247)) + // Measured: `455` + // Estimated: `3920` + // Minimum execution time: 35_750_000 picoseconds. + Weight::from_parts(37_300_000, 0) + .saturating_add(Weight::from_parts(0, 3920)) .saturating_add(T::DbWeight::get().reads(9)) .saturating_add(T::DbWeight::get().writes(5)) } - /// Storage: Hrmp HrmpOpenChannelRequests (r:1 w:1) - /// Proof Skipped: Hrmp HrmpOpenChannelRequests (max_values: None, max_size: None, mode: Measured) - /// Storage: Paras ParaLifecycles (r:1 w:0) - /// Proof Skipped: Paras ParaLifecycles (max_values: None, max_size: None, mode: Measured) - /// Storage: Hrmp HrmpIngressChannelsIndex (r:1 w:0) - /// Proof Skipped: Hrmp HrmpIngressChannelsIndex (max_values: None, max_size: None, mode: Measured) - /// Storage: Hrmp HrmpAcceptedChannelRequestCount (r:1 w:1) - /// Proof Skipped: Hrmp HrmpAcceptedChannelRequestCount (max_values: None, max_size: None, mode: Measured) - /// Storage: Dmp DownwardMessageQueues (r:1 w:1) - /// Proof Skipped: Dmp DownwardMessageQueues (max_values: None, max_size: None, mode: Measured) - /// Storage: Dmp DownwardMessageQueueHeads (r:1 w:1) - /// Proof Skipped: Dmp DownwardMessageQueueHeads (max_values: None, max_size: None, mode: Measured) + /// Storage: `Hrmp::HrmpOpenChannelRequests` (r:1 w:1) + /// Proof: `Hrmp::HrmpOpenChannelRequests` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Hrmp::HrmpIngressChannelsIndex` (r:1 w:0) + /// Proof: `Hrmp::HrmpIngressChannelsIndex` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Hrmp::HrmpAcceptedChannelRequestCount` (r:1 w:1) + /// Proof: `Hrmp::HrmpAcceptedChannelRequestCount` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `XcmPallet::SupportedVersion` (r:1 w:0) + /// Proof: `XcmPallet::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Dmp::DownwardMessageQueues` (r:1 w:1) + /// Proof: `Dmp::DownwardMessageQueues` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Dmp::DownwardMessageQueueHeads` (r:1 w:1) + /// Proof: `Dmp::DownwardMessageQueueHeads` (`max_values`: None, `max_size`: None, mode: `Measured`) fn hrmp_accept_open_channel() -> Weight { // Proof Size summary in bytes: - // Measured: `421` - // Estimated: `3886` - // Minimum execution time: 32_773_000 picoseconds. - Weight::from_parts(33_563_000, 0) - .saturating_add(Weight::from_parts(0, 3886)) + // Measured: `445` + // Estimated: `3910` + // Minimum execution time: 35_622_000 picoseconds. + Weight::from_parts(36_951_000, 0) + .saturating_add(Weight::from_parts(0, 3910)) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(4)) } - /// Storage: Hrmp HrmpChannels (r:1 w:0) - /// Proof Skipped: Hrmp HrmpChannels (max_values: None, max_size: None, mode: Measured) - /// Storage: Hrmp HrmpCloseChannelRequests (r:1 w:1) - /// Proof Skipped: Hrmp HrmpCloseChannelRequests (max_values: None, max_size: None, mode: Measured) - /// Storage: Hrmp HrmpCloseChannelRequestsList (r:1 w:1) - /// Proof Skipped: Hrmp HrmpCloseChannelRequestsList (max_values: Some(1), max_size: None, mode: Measured) - /// Storage: Dmp DownwardMessageQueues (r:1 w:1) - /// Proof Skipped: Dmp DownwardMessageQueues (max_values: None, max_size: None, mode: Measured) - /// Storage: Dmp DownwardMessageQueueHeads (r:1 w:1) - /// Proof Skipped: Dmp DownwardMessageQueueHeads (max_values: None, max_size: None, mode: Measured) + /// Storage: `Hrmp::HrmpChannels` (r:1 w:0) + /// Proof: `Hrmp::HrmpChannels` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Hrmp::HrmpCloseChannelRequests` (r:1 w:1) + /// Proof: `Hrmp::HrmpCloseChannelRequests` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Hrmp::HrmpCloseChannelRequestsList` (r:1 w:1) + /// Proof: `Hrmp::HrmpCloseChannelRequestsList` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `XcmPallet::SupportedVersion` (r:1 w:0) + /// Proof: `XcmPallet::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Dmp::DownwardMessageQueues` (r:1 w:1) + /// Proof: `Dmp::DownwardMessageQueues` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Dmp::DownwardMessageQueueHeads` (r:1 w:1) + /// Proof: `Dmp::DownwardMessageQueueHeads` (`max_values`: None, `max_size`: None, mode: `Measured`) fn hrmp_close_channel() -> Weight { // Proof Size summary in bytes: - // Measured: `238` - // Estimated: `3703` - // Minimum execution time: 28_134_000 picoseconds. - Weight::from_parts(29_236_000, 0) - .saturating_add(Weight::from_parts(0, 3703)) - .saturating_add(T::DbWeight::get().reads(5)) + // Measured: `558` + // Estimated: `4023` + // Minimum execution time: 37_089_000 picoseconds. + Weight::from_parts(38_701_000, 0) + .saturating_add(Weight::from_parts(0, 4023)) + .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(4)) } - /// Storage: Hrmp HrmpIngressChannelsIndex (r:128 w:128) - /// Proof Skipped: Hrmp HrmpIngressChannelsIndex (max_values: None, max_size: None, mode: Measured) - /// Storage: Hrmp HrmpEgressChannelsIndex (r:128 w:128) - /// Proof Skipped: Hrmp HrmpEgressChannelsIndex (max_values: None, max_size: None, mode: Measured) - /// Storage: Hrmp HrmpChannels (r:254 w:254) - /// Proof Skipped: Hrmp HrmpChannels (max_values: None, max_size: None, mode: Measured) - /// Storage: Hrmp HrmpAcceptedChannelRequestCount (r:0 w:1) - /// Proof Skipped: Hrmp HrmpAcceptedChannelRequestCount (max_values: None, max_size: None, mode: Measured) - /// Storage: Hrmp HrmpChannelContents (r:0 w:254) - /// Proof Skipped: Hrmp HrmpChannelContents (max_values: None, max_size: None, mode: Measured) - /// Storage: Hrmp HrmpOpenChannelRequestCount (r:0 w:1) - /// Proof Skipped: Hrmp HrmpOpenChannelRequestCount (max_values: None, max_size: None, mode: Measured) + /// Storage: `Hrmp::HrmpIngressChannelsIndex` (r:128 w:128) + /// Proof: `Hrmp::HrmpIngressChannelsIndex` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Hrmp::HrmpEgressChannelsIndex` (r:128 w:128) + /// Proof: `Hrmp::HrmpEgressChannelsIndex` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Hrmp::HrmpChannels` (r:254 w:254) + /// Proof: `Hrmp::HrmpChannels` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Hrmp::HrmpAcceptedChannelRequestCount` (r:0 w:1) + /// Proof: `Hrmp::HrmpAcceptedChannelRequestCount` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Hrmp::HrmpChannelContents` (r:0 w:254) + /// Proof: `Hrmp::HrmpChannelContents` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Hrmp::HrmpOpenChannelRequestCount` (r:0 w:1) + /// Proof: `Hrmp::HrmpOpenChannelRequestCount` (`max_values`: None, `max_size`: None, mode: `Measured`) /// The range of component `i` is `[0, 127]`. /// The range of component `e` is `[0, 127]`. fn force_clean_hrmp(i: u32, e: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `158 + e * (100 ±0) + i * (100 ±0)` - // Estimated: `3620 + e * (2575 ±0) + i * (2575 ±0)` - // Minimum execution time: 1_217_145_000 picoseconds. - Weight::from_parts(1_251_187_000, 0) - .saturating_add(Weight::from_parts(0, 3620)) - // Standard Error: 118_884 - .saturating_add(Weight::from_parts(4_002_678, 0).saturating_mul(i.into())) - // Standard Error: 118_884 - .saturating_add(Weight::from_parts(3_641_596, 0).saturating_mul(e.into())) + // Measured: `264 + e * (100 ±0) + i * (100 ±0)` + // Estimated: `3726 + e * (2575 ±0) + i * (2575 ±0)` + // Minimum execution time: 1_176_257_000 picoseconds. + Weight::from_parts(883_298, 0) + .saturating_add(Weight::from_parts(0, 3726)) + // Standard Error: 8_118 + .saturating_add(Weight::from_parts(9_377_429, 0).saturating_mul(i.into())) + // Standard Error: 8_118 + .saturating_add(Weight::from_parts(9_433_185, 0).saturating_mul(e.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().reads((2_u64).saturating_mul(i.into()))) .saturating_add(T::DbWeight::get().reads((2_u64).saturating_mul(e.into()))) @@ -152,135 +154,141 @@ impl runtime_parachains::hrmp::WeightInfo for WeightInf .saturating_add(Weight::from_parts(0, 2575).saturating_mul(e.into())) .saturating_add(Weight::from_parts(0, 2575).saturating_mul(i.into())) } - /// Storage: Hrmp HrmpOpenChannelRequestsList (r:1 w:1) - /// Proof Skipped: Hrmp HrmpOpenChannelRequestsList (max_values: Some(1), max_size: None, mode: Measured) - /// Storage: Hrmp HrmpOpenChannelRequests (r:128 w:128) - /// Proof Skipped: Hrmp HrmpOpenChannelRequests (max_values: None, max_size: None, mode: Measured) - /// Storage: Paras ParaLifecycles (r:256 w:0) - /// Proof Skipped: Paras ParaLifecycles (max_values: None, max_size: None, mode: Measured) - /// Storage: Hrmp HrmpIngressChannelsIndex (r:128 w:128) - /// Proof Skipped: Hrmp HrmpIngressChannelsIndex (max_values: None, max_size: None, mode: Measured) - /// Storage: Hrmp HrmpEgressChannelsIndex (r:128 w:128) - /// Proof Skipped: Hrmp HrmpEgressChannelsIndex (max_values: None, max_size: None, mode: Measured) - /// Storage: Hrmp HrmpOpenChannelRequestCount (r:128 w:128) - /// Proof Skipped: Hrmp HrmpOpenChannelRequestCount (max_values: None, max_size: None, mode: Measured) - /// Storage: Hrmp HrmpAcceptedChannelRequestCount (r:128 w:128) - /// Proof Skipped: Hrmp HrmpAcceptedChannelRequestCount (max_values: None, max_size: None, mode: Measured) - /// Storage: Hrmp HrmpChannels (r:0 w:128) - /// Proof Skipped: Hrmp HrmpChannels (max_values: None, max_size: None, mode: Measured) + /// Storage: `Hrmp::HrmpOpenChannelRequestsList` (r:1 w:1) + /// Proof: `Hrmp::HrmpOpenChannelRequestsList` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `Hrmp::HrmpOpenChannelRequests` (r:128 w:128) + /// Proof: `Hrmp::HrmpOpenChannelRequests` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Paras::ParaLifecycles` (r:256 w:0) + /// Proof: `Paras::ParaLifecycles` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Hrmp::HrmpIngressChannelsIndex` (r:128 w:128) + /// Proof: `Hrmp::HrmpIngressChannelsIndex` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Hrmp::HrmpEgressChannelsIndex` (r:128 w:128) + /// Proof: `Hrmp::HrmpEgressChannelsIndex` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Hrmp::HrmpOpenChannelRequestCount` (r:128 w:128) + /// Proof: `Hrmp::HrmpOpenChannelRequestCount` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Hrmp::HrmpAcceptedChannelRequestCount` (r:128 w:128) + /// Proof: `Hrmp::HrmpAcceptedChannelRequestCount` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Hrmp::HrmpChannels` (r:0 w:128) + /// Proof: `Hrmp::HrmpChannels` (`max_values`: None, `max_size`: None, mode: `Measured`) /// The range of component `c` is `[0, 128]`. fn force_process_hrmp_open(c: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `386 + c * (136 ±0)` - // Estimated: `1841 + c * (5086 ±0)` - // Minimum execution time: 6_277_000 picoseconds. - Weight::from_parts(6_357_000, 0) - .saturating_add(Weight::from_parts(0, 1841)) - // Standard Error: 41_189 - .saturating_add(Weight::from_parts(22_159_709, 0).saturating_mul(c.into())) + // Measured: `492 + c * (136 ±0)` + // Estimated: `1947 + c * (5086 ±0)` + // Minimum execution time: 5_903_000 picoseconds. + Weight::from_parts(4_604_899, 0) + .saturating_add(Weight::from_parts(0, 1947)) + // Standard Error: 12_206 + .saturating_add(Weight::from_parts(20_385_859, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().reads((7_u64).saturating_mul(c.into()))) .saturating_add(T::DbWeight::get().writes(1)) .saturating_add(T::DbWeight::get().writes((6_u64).saturating_mul(c.into()))) .saturating_add(Weight::from_parts(0, 5086).saturating_mul(c.into())) } - /// Storage: Hrmp HrmpCloseChannelRequestsList (r:1 w:1) - /// Proof Skipped: Hrmp HrmpCloseChannelRequestsList (max_values: Some(1), max_size: None, mode: Measured) - /// Storage: Hrmp HrmpChannels (r:128 w:128) - /// Proof Skipped: Hrmp HrmpChannels (max_values: None, max_size: None, mode: Measured) - /// Storage: Hrmp HrmpEgressChannelsIndex (r:128 w:128) - /// Proof Skipped: Hrmp HrmpEgressChannelsIndex (max_values: None, max_size: None, mode: Measured) - /// Storage: Hrmp HrmpIngressChannelsIndex (r:128 w:128) - /// Proof Skipped: Hrmp HrmpIngressChannelsIndex (max_values: None, max_size: None, mode: Measured) - /// Storage: Hrmp HrmpCloseChannelRequests (r:0 w:128) - /// Proof Skipped: Hrmp HrmpCloseChannelRequests (max_values: None, max_size: None, mode: Measured) - /// Storage: Hrmp HrmpChannelContents (r:0 w:128) - /// Proof Skipped: Hrmp HrmpChannelContents (max_values: None, max_size: None, mode: Measured) + /// Storage: `Hrmp::HrmpCloseChannelRequestsList` (r:1 w:1) + /// Proof: `Hrmp::HrmpCloseChannelRequestsList` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `Hrmp::HrmpChannels` (r:128 w:128) + /// Proof: `Hrmp::HrmpChannels` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Hrmp::HrmpEgressChannelsIndex` (r:128 w:128) + /// Proof: `Hrmp::HrmpEgressChannelsIndex` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Hrmp::HrmpIngressChannelsIndex` (r:128 w:128) + /// Proof: `Hrmp::HrmpIngressChannelsIndex` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Hrmp::HrmpCloseChannelRequests` (r:0 w:128) + /// Proof: `Hrmp::HrmpCloseChannelRequests` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Hrmp::HrmpChannelContents` (r:0 w:128) + /// Proof: `Hrmp::HrmpChannelContents` (`max_values`: None, `max_size`: None, mode: `Measured`) /// The range of component `c` is `[0, 128]`. fn force_process_hrmp_close(c: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `229 + c * (124 ±0)` - // Estimated: `1689 + c * (2600 ±0)` - // Minimum execution time: 5_070_000 picoseconds. - Weight::from_parts(5_225_000, 0) - .saturating_add(Weight::from_parts(0, 1689)) - // Standard Error: 24_173 - .saturating_add(Weight::from_parts(13_645_307, 0).saturating_mul(c.into())) + // Measured: `335 + c * (124 ±0)` + // Estimated: `1795 + c * (2600 ±0)` + // Minimum execution time: 5_147_000 picoseconds. + Weight::from_parts(7_658_136, 0) + .saturating_add(Weight::from_parts(0, 1795)) + // Standard Error: 9_172 + .saturating_add(Weight::from_parts(12_405_648, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().reads((3_u64).saturating_mul(c.into()))) .saturating_add(T::DbWeight::get().writes(1)) .saturating_add(T::DbWeight::get().writes((5_u64).saturating_mul(c.into()))) .saturating_add(Weight::from_parts(0, 2600).saturating_mul(c.into())) } - /// Storage: Hrmp HrmpOpenChannelRequestsList (r:1 w:1) - /// Proof Skipped: Hrmp HrmpOpenChannelRequestsList (max_values: Some(1), max_size: None, mode: Measured) - /// Storage: Hrmp HrmpOpenChannelRequests (r:1 w:1) - /// Proof Skipped: Hrmp HrmpOpenChannelRequests (max_values: None, max_size: None, mode: Measured) - /// Storage: Hrmp HrmpOpenChannelRequestCount (r:1 w:1) - /// Proof Skipped: Hrmp HrmpOpenChannelRequestCount (max_values: None, max_size: None, mode: Measured) + /// Storage: `Hrmp::HrmpOpenChannelRequestsList` (r:1 w:1) + /// Proof: `Hrmp::HrmpOpenChannelRequestsList` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `Hrmp::HrmpOpenChannelRequests` (r:1 w:1) + /// Proof: `Hrmp::HrmpOpenChannelRequests` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Hrmp::HrmpOpenChannelRequestCount` (r:1 w:1) + /// Proof: `Hrmp::HrmpOpenChannelRequestCount` (`max_values`: None, `max_size`: None, mode: `Measured`) /// The range of component `c` is `[0, 128]`. fn hrmp_cancel_open_request(c: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `920 + c * (13 ±0)` - // Estimated: `4189 + c * (15 ±0)` - // Minimum execution time: 20_449_000 picoseconds. - Weight::from_parts(30_861_799, 0) - .saturating_add(Weight::from_parts(0, 4189)) - // Standard Error: 6_642 - .saturating_add(Weight::from_parts(236_293, 0).saturating_mul(c.into())) + // Measured: `1026 + c * (13 ±0)` + // Estimated: `4295 + c * (15 ±0)` + // Minimum execution time: 16_976_000 picoseconds. + Weight::from_parts(27_999_087, 0) + .saturating_add(Weight::from_parts(0, 4295)) + // Standard Error: 2_321 + .saturating_add(Weight::from_parts(88_472, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(3)) .saturating_add(Weight::from_parts(0, 15).saturating_mul(c.into())) } - /// Storage: Hrmp HrmpOpenChannelRequestsList (r:1 w:1) - /// Proof Skipped: Hrmp HrmpOpenChannelRequestsList (max_values: Some(1), max_size: None, mode: Measured) - /// Storage: Hrmp HrmpOpenChannelRequests (r:128 w:128) - /// Proof Skipped: Hrmp HrmpOpenChannelRequests (max_values: None, max_size: None, mode: Measured) + /// Storage: `Hrmp::HrmpOpenChannelRequestsList` (r:1 w:1) + /// Proof: `Hrmp::HrmpOpenChannelRequestsList` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `Hrmp::HrmpOpenChannelRequests` (r:128 w:128) + /// Proof: `Hrmp::HrmpOpenChannelRequests` (`max_values`: None, `max_size`: None, mode: `Measured`) /// The range of component `c` is `[0, 128]`. fn clean_open_channel_requests(c: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `137 + c * (63 ±0)` - // Estimated: `1616 + c * (2538 ±0)` - // Minimum execution time: 3_911_000 picoseconds. - Weight::from_parts(5_219_837, 0) - .saturating_add(Weight::from_parts(0, 1616)) - // Standard Error: 10_219 - .saturating_add(Weight::from_parts(3_647_782, 0).saturating_mul(c.into())) + // Measured: `243 + c * (63 ±0)` + // Estimated: `1722 + c * (2538 ±0)` + // Minimum execution time: 3_905_000 picoseconds. + Weight::from_parts(5_562_600, 0) + .saturating_add(Weight::from_parts(0, 1722)) + // Standard Error: 3_814 + .saturating_add(Weight::from_parts(3_283_919, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(c.into()))) .saturating_add(T::DbWeight::get().writes(1)) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(c.into()))) .saturating_add(Weight::from_parts(0, 2538).saturating_mul(c.into())) } - /// Storage: Paras ParaLifecycles (r:2 w:0) - /// Proof Skipped: Paras ParaLifecycles (max_values: None, max_size: None, mode: Measured) - /// Storage: Hrmp HrmpOpenChannelRequests (r:1 w:1) - /// Proof Skipped: Hrmp HrmpOpenChannelRequests (max_values: None, max_size: None, mode: Measured) - /// Storage: Hrmp HrmpChannels (r:1 w:0) - /// Proof Skipped: Hrmp HrmpChannels (max_values: None, max_size: None, mode: Measured) - /// Storage: Hrmp HrmpEgressChannelsIndex (r:1 w:0) - /// Proof Skipped: Hrmp HrmpEgressChannelsIndex (max_values: None, max_size: None, mode: Measured) - /// Storage: Hrmp HrmpOpenChannelRequestCount (r:1 w:1) - /// Proof Skipped: Hrmp HrmpOpenChannelRequestCount (max_values: None, max_size: None, mode: Measured) - /// Storage: Hrmp HrmpOpenChannelRequestsList (r:1 w:1) - /// Proof Skipped: Hrmp HrmpOpenChannelRequestsList (max_values: Some(1), max_size: None, mode: Measured) - /// Storage: Dmp DownwardMessageQueues (r:2 w:2) - /// Proof Skipped: Dmp DownwardMessageQueues (max_values: None, max_size: None, mode: Measured) - /// Storage: Dmp DownwardMessageQueueHeads (r:2 w:2) - /// Proof Skipped: Dmp DownwardMessageQueueHeads (max_values: None, max_size: None, mode: Measured) - /// Storage: Hrmp HrmpIngressChannelsIndex (r:1 w:0) - /// Proof Skipped: Hrmp HrmpIngressChannelsIndex (max_values: None, max_size: None, mode: Measured) - /// Storage: Hrmp HrmpAcceptedChannelRequestCount (r:1 w:1) - /// Proof Skipped: Hrmp HrmpAcceptedChannelRequestCount (max_values: None, max_size: None, mode: Measured) - fn force_open_hrmp_channel(_c: u32, ) -> Weight { + /// Storage: `Hrmp::HrmpOpenChannelRequests` (r:1 w:1) + /// Proof: `Hrmp::HrmpOpenChannelRequests` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Hrmp::HrmpOpenChannelRequestsList` (r:1 w:1) + /// Proof: `Hrmp::HrmpOpenChannelRequestsList` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `Hrmp::HrmpOpenChannelRequestCount` (r:1 w:1) + /// Proof: `Hrmp::HrmpOpenChannelRequestCount` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Paras::ParaLifecycles` (r:1 w:0) + /// Proof: `Paras::ParaLifecycles` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Hrmp::HrmpChannels` (r:1 w:0) + /// Proof: `Hrmp::HrmpChannels` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Hrmp::HrmpEgressChannelsIndex` (r:1 w:0) + /// Proof: `Hrmp::HrmpEgressChannelsIndex` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `XcmPallet::SupportedVersion` (r:2 w:0) + /// Proof: `XcmPallet::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Dmp::DownwardMessageQueues` (r:2 w:2) + /// Proof: `Dmp::DownwardMessageQueues` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Dmp::DownwardMessageQueueHeads` (r:2 w:2) + /// Proof: `Dmp::DownwardMessageQueueHeads` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Hrmp::HrmpIngressChannelsIndex` (r:1 w:0) + /// Proof: `Hrmp::HrmpIngressChannelsIndex` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Hrmp::HrmpAcceptedChannelRequestCount` (r:1 w:1) + /// Proof: `Hrmp::HrmpAcceptedChannelRequestCount` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// The range of component `c` is `[0, 1]`. + fn force_open_hrmp_channel(c: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `307` - // Estimated: `6247` - // Minimum execution time: 50_870_000 picoseconds. - Weight::from_parts(53_335_000, 0) - .saturating_add(Weight::from_parts(0, 6247)) - .saturating_add(T::DbWeight::get().reads(13)) + // Measured: `455 + c * (235 ±0)` + // Estimated: `6395 + c * (235 ±0)` + // Minimum execution time: 53_649_000 picoseconds. + Weight::from_parts(56_102_785, 0) + .saturating_add(Weight::from_parts(0, 6395)) + // Standard Error: 156_583 + .saturating_add(Weight::from_parts(15_061_214, 0).saturating_mul(c.into())) + .saturating_add(T::DbWeight::get().reads(14)) .saturating_add(T::DbWeight::get().writes(8)) + .saturating_add(Weight::from_parts(0, 235).saturating_mul(c.into())) } /// Storage: `Paras::ParaLifecycles` (r:1 w:0) /// Proof: `Paras::ParaLifecycles` (`max_values`: None, `max_size`: None, mode: `Measured`) @@ -294,6 +302,8 @@ impl runtime_parachains::hrmp::WeightInfo for WeightInf /// Proof: `Hrmp::HrmpOpenChannelRequestCount` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `Hrmp::HrmpOpenChannelRequestsList` (r:1 w:1) /// Proof: `Hrmp::HrmpOpenChannelRequestsList` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `XcmPallet::SupportedVersion` (r:2 w:0) + /// Proof: `XcmPallet::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `Dmp::DownwardMessageQueues` (r:2 w:2) /// Proof: `Dmp::DownwardMessageQueues` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `Dmp::DownwardMessageQueueHeads` (r:2 w:2) @@ -304,12 +314,12 @@ impl runtime_parachains::hrmp::WeightInfo for WeightInf /// Proof: `Hrmp::HrmpAcceptedChannelRequestCount` (`max_values`: None, `max_size`: None, mode: `Measured`) fn establish_system_channel() -> Weight { // Proof Size summary in bytes: - // Measured: `417` - // Estimated: `6357` - // Minimum execution time: 629_674_000 picoseconds. - Weight::from_parts(640_174_000, 0) - .saturating_add(Weight::from_parts(0, 6357)) - .saturating_add(T::DbWeight::get().reads(12)) + // Measured: `455` + // Estimated: `6395` + // Minimum execution time: 53_871_000 picoseconds. + Weight::from_parts(55_398_000, 0) + .saturating_add(Weight::from_parts(0, 6395)) + .saturating_add(T::DbWeight::get().reads(14)) .saturating_add(T::DbWeight::get().writes(8)) } /// Storage: `Hrmp::HrmpChannels` (r:1 w:1) @@ -318,20 +328,42 @@ impl runtime_parachains::hrmp::WeightInfo for WeightInf // Proof Size summary in bytes: // Measured: `263` // Estimated: `3728` - // Minimum execution time: 173_371_000 picoseconds. - Weight::from_parts(175_860_000, 0) + // Minimum execution time: 11_873_000 picoseconds. + Weight::from_parts(12_237_000, 0) .saturating_add(Weight::from_parts(0, 3728)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } + /// Storage: `Paras::ParaLifecycles` (r:2 w:0) + /// Proof: `Paras::ParaLifecycles` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Hrmp::HrmpOpenChannelRequests` (r:2 w:2) + /// Proof: `Hrmp::HrmpOpenChannelRequests` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Hrmp::HrmpChannels` (r:2 w:0) + /// Proof: `Hrmp::HrmpChannels` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Hrmp::HrmpEgressChannelsIndex` (r:2 w:0) + /// Proof: `Hrmp::HrmpEgressChannelsIndex` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Hrmp::HrmpOpenChannelRequestCount` (r:2 w:2) + /// Proof: `Hrmp::HrmpOpenChannelRequestCount` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Hrmp::HrmpOpenChannelRequestsList` (r:1 w:1) + /// Proof: `Hrmp::HrmpOpenChannelRequestsList` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `XcmPallet::SupportedVersion` (r:2 w:0) + /// Proof: `XcmPallet::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Dmp::DownwardMessageQueues` (r:2 w:2) + /// Proof: `Dmp::DownwardMessageQueues` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Dmp::DownwardMessageQueueHeads` (r:2 w:2) + /// Proof: `Dmp::DownwardMessageQueueHeads` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Hrmp::HrmpIngressChannelsIndex` (r:2 w:0) + /// Proof: `Hrmp::HrmpIngressChannelsIndex` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Hrmp::HrmpAcceptedChannelRequestCount` (r:2 w:2) + /// Proof: `Hrmp::HrmpAcceptedChannelRequestCount` (`max_values`: None, `max_size`: None, mode: `Measured`) fn establish_channel_with_system() -> Weight { // Proof Size summary in bytes: - // Measured: `417` - // Estimated: `6357` - // Minimum execution time: 629_674_000 picoseconds. - Weight::from_parts(640_174_000, 0) - .saturating_add(Weight::from_parts(0, 6357)) - .saturating_add(T::DbWeight::get().reads(12)) - .saturating_add(T::DbWeight::get().writes(8)) + // Measured: `455` + // Estimated: `6395` + // Minimum execution time: 94_097_000 picoseconds. + Weight::from_parts(96_435_000, 0) + .saturating_add(Weight::from_parts(0, 6395)) + .saturating_add(T::DbWeight::get().reads(21)) + .saturating_add(T::DbWeight::get().writes(11)) } } From d0a55e7a493688bb8cae7aa907c082a0b5a248e1 Mon Sep 17 00:00:00 2001 From: command-bot <> Date: Wed, 1 May 2024 22:29:10 +0000 Subject: [PATCH 11/17] ".git/.scripts/commands/bench/bench.sh" --subcommand=pallet --runtime=rococo --target_dir=polkadot --pallet=runtime_parachains::hrmp --- .../src/weights/runtime_parachains_hrmp.rs | 102 ++++++++++-------- 1 file changed, 57 insertions(+), 45 deletions(-) diff --git a/polkadot/runtime/rococo/src/weights/runtime_parachains_hrmp.rs b/polkadot/runtime/rococo/src/weights/runtime_parachains_hrmp.rs index 1d83e97ef0e5..572ecc7d4110 100644 --- a/polkadot/runtime/rococo/src/weights/runtime_parachains_hrmp.rs +++ b/polkadot/runtime/rococo/src/weights/runtime_parachains_hrmp.rs @@ -17,7 +17,7 @@ //! Autogenerated weights for `runtime_parachains::hrmp` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-04-30, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-05-01, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `runner-unxyhko3-project-674-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("rococo-dev")`, DB CACHE: 1024 @@ -60,6 +60,8 @@ impl runtime_parachains::hrmp::WeightInfo for WeightInf /// Proof: `Hrmp::HrmpOpenChannelRequestCount` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `Hrmp::HrmpOpenChannelRequestsList` (r:1 w:1) /// Proof: `Hrmp::HrmpOpenChannelRequestsList` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `XcmPallet::SupportedVersion` (r:1 w:0) + /// Proof: `XcmPallet::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `Dmp::DownwardMessageQueues` (r:1 w:1) /// Proof: `Dmp::DownwardMessageQueues` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `Dmp::DownwardMessageQueueHeads` (r:1 w:1) @@ -68,10 +70,10 @@ impl runtime_parachains::hrmp::WeightInfo for WeightInf // Proof Size summary in bytes: // Measured: `488` // Estimated: `3953` - // Minimum execution time: 34_034_000 picoseconds. - Weight::from_parts(35_191_000, 0) + // Minimum execution time: 37_574_000 picoseconds. + Weight::from_parts(38_789_000, 0) .saturating_add(Weight::from_parts(0, 3953)) - .saturating_add(T::DbWeight::get().reads(8)) + .saturating_add(T::DbWeight::get().reads(9)) .saturating_add(T::DbWeight::get().writes(5)) } /// Storage: `Hrmp::HrmpOpenChannelRequests` (r:1 w:1) @@ -80,6 +82,8 @@ impl runtime_parachains::hrmp::WeightInfo for WeightInf /// Proof: `Hrmp::HrmpIngressChannelsIndex` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `Hrmp::HrmpAcceptedChannelRequestCount` (r:1 w:1) /// Proof: `Hrmp::HrmpAcceptedChannelRequestCount` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `XcmPallet::SupportedVersion` (r:1 w:0) + /// Proof: `XcmPallet::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `Dmp::DownwardMessageQueues` (r:1 w:1) /// Proof: `Dmp::DownwardMessageQueues` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `Dmp::DownwardMessageQueueHeads` (r:1 w:1) @@ -88,10 +92,10 @@ impl runtime_parachains::hrmp::WeightInfo for WeightInf // Proof Size summary in bytes: // Measured: `478` // Estimated: `3943` - // Minimum execution time: 30_115_000 picoseconds. - Weight::from_parts(31_060_000, 0) + // Minimum execution time: 34_560_000 picoseconds. + Weight::from_parts(35_760_000, 0) .saturating_add(Weight::from_parts(0, 3943)) - .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(4)) } /// Storage: `Hrmp::HrmpChannels` (r:1 w:0) @@ -100,6 +104,8 @@ impl runtime_parachains::hrmp::WeightInfo for WeightInf /// Proof: `Hrmp::HrmpCloseChannelRequests` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `Hrmp::HrmpCloseChannelRequestsList` (r:1 w:1) /// Proof: `Hrmp::HrmpCloseChannelRequestsList` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `XcmPallet::SupportedVersion` (r:1 w:0) + /// Proof: `XcmPallet::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `Dmp::DownwardMessageQueues` (r:1 w:1) /// Proof: `Dmp::DownwardMessageQueues` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `Dmp::DownwardMessageQueueHeads` (r:1 w:1) @@ -108,10 +114,10 @@ impl runtime_parachains::hrmp::WeightInfo for WeightInf // Proof Size summary in bytes: // Measured: `591` // Estimated: `4056` - // Minimum execution time: 30_982_000 picoseconds. - Weight::from_parts(32_034_000, 0) + // Minimum execution time: 35_367_000 picoseconds. + Weight::from_parts(37_000_000, 0) .saturating_add(Weight::from_parts(0, 4056)) - .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(4)) } /// Storage: `Hrmp::HrmpIngressChannelsIndex` (r:128 w:128) @@ -132,13 +138,13 @@ impl runtime_parachains::hrmp::WeightInfo for WeightInf // Proof Size summary in bytes: // Measured: `297 + e * (100 ±0) + i * (100 ±0)` // Estimated: `3759 + e * (2575 ±0) + i * (2575 ±0)` - // Minimum execution time: 1_158_665_000 picoseconds. - Weight::from_parts(1_164_378_000, 0) + // Minimum execution time: 1_134_420_000 picoseconds. + Weight::from_parts(1_144_822_000, 0) .saturating_add(Weight::from_parts(0, 3759)) - // Standard Error: 103_726 - .saturating_add(Weight::from_parts(3_444_855, 0).saturating_mul(i.into())) - // Standard Error: 103_726 - .saturating_add(Weight::from_parts(3_527_628, 0).saturating_mul(e.into())) + // Standard Error: 101_380 + .saturating_add(Weight::from_parts(3_325_898, 0).saturating_mul(i.into())) + // Standard Error: 101_380 + .saturating_add(Weight::from_parts(3_338_565, 0).saturating_mul(e.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().reads((2_u64).saturating_mul(i.into()))) .saturating_add(T::DbWeight::get().reads((2_u64).saturating_mul(e.into()))) @@ -169,11 +175,11 @@ impl runtime_parachains::hrmp::WeightInfo for WeightInf // Proof Size summary in bytes: // Measured: `525 + c * (136 ±0)` // Estimated: `1980 + c * (5086 ±0)` - // Minimum execution time: 5_870_000 picoseconds. - Weight::from_parts(2_363_864, 0) + // Minimum execution time: 5_652_000 picoseconds. + Weight::from_parts(2_857_824, 0) .saturating_add(Weight::from_parts(0, 1980)) - // Standard Error: 16_657 - .saturating_add(Weight::from_parts(20_507_232, 0).saturating_mul(c.into())) + // Standard Error: 26_044 + .saturating_add(Weight::from_parts(20_088_467, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().reads((7_u64).saturating_mul(c.into()))) .saturating_add(T::DbWeight::get().writes(1)) @@ -197,11 +203,11 @@ impl runtime_parachains::hrmp::WeightInfo for WeightInf // Proof Size summary in bytes: // Measured: `368 + c * (124 ±0)` // Estimated: `1828 + c * (2600 ±0)` - // Minimum execution time: 4_766_000 picoseconds. - Weight::from_parts(4_988_812, 0) + // Minimum execution time: 4_692_000 picoseconds. + Weight::from_parts(6_637_146, 0) .saturating_add(Weight::from_parts(0, 1828)) - // Standard Error: 10_606 - .saturating_add(Weight::from_parts(12_579_429, 0).saturating_mul(c.into())) + // Standard Error: 10_238 + .saturating_add(Weight::from_parts(12_201_629, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().reads((3_u64).saturating_mul(c.into()))) .saturating_add(T::DbWeight::get().writes(1)) @@ -219,11 +225,11 @@ impl runtime_parachains::hrmp::WeightInfo for WeightInf // Proof Size summary in bytes: // Measured: `1059 + c * (13 ±0)` // Estimated: `4328 + c * (15 ±0)` - // Minimum execution time: 17_228_000 picoseconds. - Weight::from_parts(27_236_563, 0) + // Minimum execution time: 18_920_000 picoseconds. + Weight::from_parts(27_314_843, 0) .saturating_add(Weight::from_parts(0, 4328)) - // Standard Error: 2_419 - .saturating_add(Weight::from_parts(102_107, 0).saturating_mul(c.into())) + // Standard Error: 2_127 + .saturating_add(Weight::from_parts(90_200, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(3)) .saturating_add(Weight::from_parts(0, 15).saturating_mul(c.into())) @@ -237,11 +243,11 @@ impl runtime_parachains::hrmp::WeightInfo for WeightInf // Proof Size summary in bytes: // Measured: `276 + c * (63 ±0)` // Estimated: `1755 + c * (2538 ±0)` - // Minimum execution time: 3_549_000 picoseconds. - Weight::from_parts(5_799_542, 0) + // Minimum execution time: 3_502_000 picoseconds. + Weight::from_parts(6_477_323, 0) .saturating_add(Weight::from_parts(0, 1755)) - // Standard Error: 3_025 - .saturating_add(Weight::from_parts(3_173_294, 0).saturating_mul(c.into())) + // Standard Error: 3_416 + .saturating_add(Weight::from_parts(3_149_674, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(c.into()))) .saturating_add(T::DbWeight::get().writes(1)) @@ -260,6 +266,8 @@ impl runtime_parachains::hrmp::WeightInfo for WeightInf /// Proof: `Hrmp::HrmpChannels` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `Hrmp::HrmpEgressChannelsIndex` (r:1 w:0) /// Proof: `Hrmp::HrmpEgressChannelsIndex` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `XcmPallet::SupportedVersion` (r:2 w:0) + /// Proof: `XcmPallet::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `Dmp::DownwardMessageQueues` (r:2 w:2) /// Proof: `Dmp::DownwardMessageQueues` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `Dmp::DownwardMessageQueueHeads` (r:2 w:2) @@ -273,12 +281,12 @@ impl runtime_parachains::hrmp::WeightInfo for WeightInf // Proof Size summary in bytes: // Measured: `488 + c * (235 ±0)` // Estimated: `6428 + c * (235 ±0)` - // Minimum execution time: 48_392_000 picoseconds. - Weight::from_parts(50_509_977, 0) + // Minimum execution time: 56_234_000 picoseconds. + Weight::from_parts(58_259_646, 0) .saturating_add(Weight::from_parts(0, 6428)) - // Standard Error: 133_658 - .saturating_add(Weight::from_parts(10_215_322, 0).saturating_mul(c.into())) - .saturating_add(T::DbWeight::get().reads(12)) + // Standard Error: 160_596 + .saturating_add(Weight::from_parts(11_178_353, 0).saturating_mul(c.into())) + .saturating_add(T::DbWeight::get().reads(14)) .saturating_add(T::DbWeight::get().writes(8)) .saturating_add(Weight::from_parts(0, 235).saturating_mul(c.into())) } @@ -294,6 +302,8 @@ impl runtime_parachains::hrmp::WeightInfo for WeightInf /// Proof: `Hrmp::HrmpOpenChannelRequestCount` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `Hrmp::HrmpOpenChannelRequestsList` (r:1 w:1) /// Proof: `Hrmp::HrmpOpenChannelRequestsList` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `XcmPallet::SupportedVersion` (r:2 w:0) + /// Proof: `XcmPallet::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `Dmp::DownwardMessageQueues` (r:2 w:2) /// Proof: `Dmp::DownwardMessageQueues` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `Dmp::DownwardMessageQueueHeads` (r:2 w:2) @@ -306,10 +316,10 @@ impl runtime_parachains::hrmp::WeightInfo for WeightInf // Proof Size summary in bytes: // Measured: `488` // Estimated: `6428` - // Minimum execution time: 48_465_000 picoseconds. - Weight::from_parts(50_433_000, 0) + // Minimum execution time: 56_035_000 picoseconds. + Weight::from_parts(58_217_000, 0) .saturating_add(Weight::from_parts(0, 6428)) - .saturating_add(T::DbWeight::get().reads(12)) + .saturating_add(T::DbWeight::get().reads(14)) .saturating_add(T::DbWeight::get().writes(8)) } /// Storage: `Hrmp::HrmpChannels` (r:1 w:1) @@ -318,8 +328,8 @@ impl runtime_parachains::hrmp::WeightInfo for WeightInf // Proof Size summary in bytes: // Measured: `296` // Estimated: `3761` - // Minimum execution time: 11_835_000 picoseconds. - Weight::from_parts(12_380_000, 0) + // Minimum execution time: 11_477_000 picoseconds. + Weight::from_parts(11_845_000, 0) .saturating_add(Weight::from_parts(0, 3761)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -336,6 +346,8 @@ impl runtime_parachains::hrmp::WeightInfo for WeightInf /// Proof: `Hrmp::HrmpOpenChannelRequestCount` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `Hrmp::HrmpOpenChannelRequestsList` (r:1 w:1) /// Proof: `Hrmp::HrmpOpenChannelRequestsList` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `XcmPallet::SupportedVersion` (r:2 w:0) + /// Proof: `XcmPallet::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `Dmp::DownwardMessageQueues` (r:2 w:2) /// Proof: `Dmp::DownwardMessageQueues` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `Dmp::DownwardMessageQueueHeads` (r:2 w:2) @@ -348,10 +360,10 @@ impl runtime_parachains::hrmp::WeightInfo for WeightInf // Proof Size summary in bytes: // Measured: `488` // Estimated: `6428` - // Minimum execution time: 79_633_000 picoseconds. - Weight::from_parts(80_846_000, 0) + // Minimum execution time: 95_305_000 picoseconds. + Weight::from_parts(97_323_000, 0) .saturating_add(Weight::from_parts(0, 6428)) - .saturating_add(T::DbWeight::get().reads(19)) + .saturating_add(T::DbWeight::get().reads(21)) .saturating_add(T::DbWeight::get().writes(11)) } } From c30d2b3a4a365c6066845ca8ffd1335492b5534b Mon Sep 17 00:00:00 2001 From: command-bot <> Date: Wed, 1 May 2024 22:31:11 +0000 Subject: [PATCH 12/17] ".git/.scripts/commands/bench/bench.sh" --subcommand=pallet --runtime=westend --target_dir=polkadot --pallet=runtime_parachains::hrmp --- .../src/weights/runtime_parachains_hrmp.rs | 102 ++++++++++-------- 1 file changed, 57 insertions(+), 45 deletions(-) diff --git a/polkadot/runtime/westend/src/weights/runtime_parachains_hrmp.rs b/polkadot/runtime/westend/src/weights/runtime_parachains_hrmp.rs index 529bdf761055..f1d7932fe8b7 100644 --- a/polkadot/runtime/westend/src/weights/runtime_parachains_hrmp.rs +++ b/polkadot/runtime/westend/src/weights/runtime_parachains_hrmp.rs @@ -17,7 +17,7 @@ //! Autogenerated weights for `runtime_parachains::hrmp` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-04-30, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-05-01, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `runner-unxyhko3-project-674-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("westend-dev")`, DB CACHE: 1024 @@ -60,6 +60,8 @@ impl runtime_parachains::hrmp::WeightInfo for WeightInf /// Proof: `Hrmp::HrmpOpenChannelRequestCount` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `Hrmp::HrmpOpenChannelRequestsList` (r:1 w:1) /// Proof: `Hrmp::HrmpOpenChannelRequestsList` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `XcmPallet::SupportedVersion` (r:1 w:0) + /// Proof: `XcmPallet::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `Dmp::DownwardMessageQueues` (r:1 w:1) /// Proof: `Dmp::DownwardMessageQueues` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `Dmp::DownwardMessageQueueHeads` (r:1 w:1) @@ -68,10 +70,10 @@ impl runtime_parachains::hrmp::WeightInfo for WeightInf // Proof Size summary in bytes: // Measured: `455` // Estimated: `3920` - // Minimum execution time: 32_195_000 picoseconds. - Weight::from_parts(33_340_000, 0) + // Minimum execution time: 35_900_000 picoseconds. + Weight::from_parts(37_587_000, 0) .saturating_add(Weight::from_parts(0, 3920)) - .saturating_add(T::DbWeight::get().reads(8)) + .saturating_add(T::DbWeight::get().reads(9)) .saturating_add(T::DbWeight::get().writes(5)) } /// Storage: `Hrmp::HrmpOpenChannelRequests` (r:1 w:1) @@ -80,6 +82,8 @@ impl runtime_parachains::hrmp::WeightInfo for WeightInf /// Proof: `Hrmp::HrmpIngressChannelsIndex` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `Hrmp::HrmpAcceptedChannelRequestCount` (r:1 w:1) /// Proof: `Hrmp::HrmpAcceptedChannelRequestCount` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `XcmPallet::SupportedVersion` (r:1 w:0) + /// Proof: `XcmPallet::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `Dmp::DownwardMessageQueues` (r:1 w:1) /// Proof: `Dmp::DownwardMessageQueues` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `Dmp::DownwardMessageQueueHeads` (r:1 w:1) @@ -88,10 +92,10 @@ impl runtime_parachains::hrmp::WeightInfo for WeightInf // Proof Size summary in bytes: // Measured: `445` // Estimated: `3910` - // Minimum execution time: 28_644_000 picoseconds. - Weight::from_parts(29_581_000, 0) + // Minimum execution time: 35_670_000 picoseconds. + Weight::from_parts(36_853_000, 0) .saturating_add(Weight::from_parts(0, 3910)) - .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(4)) } /// Storage: `Hrmp::HrmpChannels` (r:1 w:0) @@ -100,6 +104,8 @@ impl runtime_parachains::hrmp::WeightInfo for WeightInf /// Proof: `Hrmp::HrmpCloseChannelRequests` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `Hrmp::HrmpCloseChannelRequestsList` (r:1 w:1) /// Proof: `Hrmp::HrmpCloseChannelRequestsList` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `XcmPallet::SupportedVersion` (r:1 w:0) + /// Proof: `XcmPallet::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `Dmp::DownwardMessageQueues` (r:1 w:1) /// Proof: `Dmp::DownwardMessageQueues` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `Dmp::DownwardMessageQueueHeads` (r:1 w:1) @@ -108,10 +114,10 @@ impl runtime_parachains::hrmp::WeightInfo for WeightInf // Proof Size summary in bytes: // Measured: `558` // Estimated: `4023` - // Minimum execution time: 31_824_000 picoseconds. - Weight::from_parts(33_207_000, 0) + // Minimum execution time: 36_953_000 picoseconds. + Weight::from_parts(38_638_000, 0) .saturating_add(Weight::from_parts(0, 4023)) - .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(4)) } /// Storage: `Hrmp::HrmpIngressChannelsIndex` (r:128 w:128) @@ -132,13 +138,13 @@ impl runtime_parachains::hrmp::WeightInfo for WeightInf // Proof Size summary in bytes: // Measured: `264 + e * (100 ±0) + i * (100 ±0)` // Estimated: `3726 + e * (2575 ±0) + i * (2575 ±0)` - // Minimum execution time: 1_213_331_000 picoseconds. - Weight::from_parts(1_217_120_000, 0) + // Minimum execution time: 1_202_266_000 picoseconds. + Weight::from_parts(1_217_618_000, 0) .saturating_add(Weight::from_parts(0, 3726)) - // Standard Error: 108_190 - .saturating_add(Weight::from_parts(3_485_701, 0).saturating_mul(i.into())) - // Standard Error: 108_190 - .saturating_add(Weight::from_parts(3_564_287, 0).saturating_mul(e.into())) + // Standard Error: 113_091 + .saturating_add(Weight::from_parts(3_550_787, 0).saturating_mul(i.into())) + // Standard Error: 113_091 + .saturating_add(Weight::from_parts(3_615_215, 0).saturating_mul(e.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().reads((2_u64).saturating_mul(i.into()))) .saturating_add(T::DbWeight::get().reads((2_u64).saturating_mul(e.into()))) @@ -169,11 +175,11 @@ impl runtime_parachains::hrmp::WeightInfo for WeightInf // Proof Size summary in bytes: // Measured: `492 + c * (136 ±0)` // Estimated: `1947 + c * (5086 ±0)` - // Minimum execution time: 6_040_000 picoseconds. - Weight::from_parts(5_644_307, 0) + // Minimum execution time: 6_105_000 picoseconds. + Weight::from_parts(6_313_000, 0) .saturating_add(Weight::from_parts(0, 1947)) - // Standard Error: 12_852 - .saturating_add(Weight::from_parts(21_031_626, 0).saturating_mul(c.into())) + // Standard Error: 16_081 + .saturating_add(Weight::from_parts(21_097_410, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().reads((7_u64).saturating_mul(c.into()))) .saturating_add(T::DbWeight::get().writes(1)) @@ -197,11 +203,11 @@ impl runtime_parachains::hrmp::WeightInfo for WeightInf // Proof Size summary in bytes: // Measured: `335 + c * (124 ±0)` // Estimated: `1795 + c * (2600 ±0)` - // Minimum execution time: 4_950_000 picoseconds. - Weight::from_parts(5_215_558, 0) + // Minimum execution time: 5_073_000 picoseconds. + Weight::from_parts(5_398_000, 0) .saturating_add(Weight::from_parts(0, 1795)) - // Standard Error: 9_231 - .saturating_add(Weight::from_parts(12_770_147, 0).saturating_mul(c.into())) + // Standard Error: 12_934 + .saturating_add(Weight::from_parts(13_222_909, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().reads((3_u64).saturating_mul(c.into()))) .saturating_add(T::DbWeight::get().writes(1)) @@ -219,11 +225,11 @@ impl runtime_parachains::hrmp::WeightInfo for WeightInf // Proof Size summary in bytes: // Measured: `1026 + c * (13 ±0)` // Estimated: `4295 + c * (15 ±0)` - // Minimum execution time: 17_550_000 picoseconds. - Weight::from_parts(25_522_933, 0) + // Minimum execution time: 16_793_000 picoseconds. + Weight::from_parts(27_430_638, 0) .saturating_add(Weight::from_parts(0, 4295)) - // Standard Error: 2_332 - .saturating_add(Weight::from_parts(121_128, 0).saturating_mul(c.into())) + // Standard Error: 2_996 + .saturating_add(Weight::from_parts(191_905, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(3)) .saturating_add(Weight::from_parts(0, 15).saturating_mul(c.into())) @@ -237,11 +243,11 @@ impl runtime_parachains::hrmp::WeightInfo for WeightInf // Proof Size summary in bytes: // Measured: `243 + c * (63 ±0)` // Estimated: `1722 + c * (2538 ±0)` - // Minimum execution time: 3_782_000 picoseconds. - Weight::from_parts(5_263_610, 0) + // Minimum execution time: 3_805_000 picoseconds. + Weight::from_parts(445_643, 0) .saturating_add(Weight::from_parts(0, 1722)) - // Standard Error: 3_152 - .saturating_add(Weight::from_parts(3_309_777, 0).saturating_mul(c.into())) + // Standard Error: 4_991 + .saturating_add(Weight::from_parts(3_459_894, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(c.into()))) .saturating_add(T::DbWeight::get().writes(1)) @@ -260,6 +266,8 @@ impl runtime_parachains::hrmp::WeightInfo for WeightInf /// Proof: `Hrmp::HrmpChannels` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `Hrmp::HrmpEgressChannelsIndex` (r:1 w:0) /// Proof: `Hrmp::HrmpEgressChannelsIndex` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `XcmPallet::SupportedVersion` (r:2 w:0) + /// Proof: `XcmPallet::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `Dmp::DownwardMessageQueues` (r:2 w:2) /// Proof: `Dmp::DownwardMessageQueues` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `Dmp::DownwardMessageQueueHeads` (r:2 w:2) @@ -273,12 +281,12 @@ impl runtime_parachains::hrmp::WeightInfo for WeightInf // Proof Size summary in bytes: // Measured: `455 + c * (235 ±0)` // Estimated: `6395 + c * (235 ±0)` - // Minimum execution time: 46_445_000 picoseconds. - Weight::from_parts(48_376_448, 0) + // Minimum execution time: 53_580_000 picoseconds. + Weight::from_parts(55_701_720, 0) .saturating_add(Weight::from_parts(0, 6395)) - // Standard Error: 130_148 - .saturating_add(Weight::from_parts(13_606_551, 0).saturating_mul(c.into())) - .saturating_add(T::DbWeight::get().reads(12)) + // Standard Error: 159_757 + .saturating_add(Weight::from_parts(15_601_979, 0).saturating_mul(c.into())) + .saturating_add(T::DbWeight::get().reads(14)) .saturating_add(T::DbWeight::get().writes(8)) .saturating_add(Weight::from_parts(0, 235).saturating_mul(c.into())) } @@ -294,6 +302,8 @@ impl runtime_parachains::hrmp::WeightInfo for WeightInf /// Proof: `Hrmp::HrmpOpenChannelRequestCount` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `Hrmp::HrmpOpenChannelRequestsList` (r:1 w:1) /// Proof: `Hrmp::HrmpOpenChannelRequestsList` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `XcmPallet::SupportedVersion` (r:2 w:0) + /// Proof: `XcmPallet::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `Dmp::DownwardMessageQueues` (r:2 w:2) /// Proof: `Dmp::DownwardMessageQueues` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `Dmp::DownwardMessageQueueHeads` (r:2 w:2) @@ -306,10 +316,10 @@ impl runtime_parachains::hrmp::WeightInfo for WeightInf // Proof Size summary in bytes: // Measured: `455` // Estimated: `6395` - // Minimum execution time: 46_563_000 picoseconds. - Weight::from_parts(48_015_000, 0) + // Minimum execution time: 54_226_000 picoseconds. + Weight::from_parts(55_572_000, 0) .saturating_add(Weight::from_parts(0, 6395)) - .saturating_add(T::DbWeight::get().reads(12)) + .saturating_add(T::DbWeight::get().reads(14)) .saturating_add(T::DbWeight::get().writes(8)) } /// Storage: `Hrmp::HrmpChannels` (r:1 w:1) @@ -318,8 +328,8 @@ impl runtime_parachains::hrmp::WeightInfo for WeightInf // Proof Size summary in bytes: // Measured: `263` // Estimated: `3728` - // Minimum execution time: 12_252_000 picoseconds. - Weight::from_parts(12_550_000, 0) + // Minimum execution time: 11_850_000 picoseconds. + Weight::from_parts(12_428_000, 0) .saturating_add(Weight::from_parts(0, 3728)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -336,6 +346,8 @@ impl runtime_parachains::hrmp::WeightInfo for WeightInf /// Proof: `Hrmp::HrmpOpenChannelRequestCount` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `Hrmp::HrmpOpenChannelRequestsList` (r:1 w:1) /// Proof: `Hrmp::HrmpOpenChannelRequestsList` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `XcmPallet::SupportedVersion` (r:2 w:0) + /// Proof: `XcmPallet::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `Dmp::DownwardMessageQueues` (r:2 w:2) /// Proof: `Dmp::DownwardMessageQueues` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `Dmp::DownwardMessageQueueHeads` (r:2 w:2) @@ -348,10 +360,10 @@ impl runtime_parachains::hrmp::WeightInfo for WeightInf // Proof Size summary in bytes: // Measured: `455` // Estimated: `6395` - // Minimum execution time: 79_503_000 picoseconds. - Weight::from_parts(81_630_000, 0) + // Minimum execution time: 93_465_000 picoseconds. + Weight::from_parts(95_845_000, 0) .saturating_add(Weight::from_parts(0, 6395)) - .saturating_add(T::DbWeight::get().reads(19)) + .saturating_add(T::DbWeight::get().reads(21)) .saturating_add(T::DbWeight::get().writes(11)) } } From 26db8372320c702640f69336d60a7a979516b9ca Mon Sep 17 00:00:00 2001 From: Branislav Kontur Date: Mon, 6 May 2024 08:39:47 +0200 Subject: [PATCH 13/17] Update polkadot/runtime/parachains/src/hrmp.rs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Bastian Köcher --- polkadot/runtime/parachains/src/hrmp.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/polkadot/runtime/parachains/src/hrmp.rs b/polkadot/runtime/parachains/src/hrmp.rs index ccbb7ca80c72..ec3e7b1cf204 100644 --- a/polkadot/runtime/parachains/src/hrmp.rs +++ b/polkadot/runtime/parachains/src/hrmp.rs @@ -1509,7 +1509,7 @@ impl Pallet { Self::wrap_notification(|| { use xcm::opaque::latest::{prelude::*, Xcm}; Xcm(vec![HrmpNewChannelOpenRequest { - sender: u32::from(origin), + sender: origin.into(), max_capacity: proposed_max_capacity, max_message_size: proposed_max_message_size, }]) From d684ebec2e3fe7f0a88329734e0ca0557902f9b1 Mon Sep 17 00:00:00 2001 From: Branislav Kontur Date: Mon, 6 May 2024 08:39:56 +0200 Subject: [PATCH 14/17] Update polkadot/runtime/parachains/src/hrmp.rs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Bastian Köcher --- polkadot/runtime/parachains/src/hrmp.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/polkadot/runtime/parachains/src/hrmp.rs b/polkadot/runtime/parachains/src/hrmp.rs index ec3e7b1cf204..b407e782a4d7 100644 --- a/polkadot/runtime/parachains/src/hrmp.rs +++ b/polkadot/runtime/parachains/src/hrmp.rs @@ -1562,7 +1562,7 @@ impl Pallet { sender, Self::wrap_notification(|| { use xcm::opaque::latest::{prelude::*, Xcm}; - Xcm(vec![HrmpChannelAccepted { recipient: u32::from(origin) }]) + Xcm(vec![HrmpChannelAccepted { recipient: origin.into() }]) }), ); From 9cefcb9bfded20a048f31737271c6e06ecca7921 Mon Sep 17 00:00:00 2001 From: Branislav Kontur Date: Mon, 6 May 2024 08:40:10 +0200 Subject: [PATCH 15/17] Update polkadot/runtime/parachains/src/hrmp.rs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Bastian Köcher --- polkadot/runtime/parachains/src/hrmp.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/polkadot/runtime/parachains/src/hrmp.rs b/polkadot/runtime/parachains/src/hrmp.rs index b407e782a4d7..1a33ea93409e 100644 --- a/polkadot/runtime/parachains/src/hrmp.rs +++ b/polkadot/runtime/parachains/src/hrmp.rs @@ -1629,9 +1629,9 @@ impl Pallet { Self::wrap_notification(|| { use xcm::opaque::latest::{prelude::*, Xcm}; Xcm(vec![HrmpChannelClosing { - initiator: u32::from(origin), - sender: u32::from(channel_id.sender), - recipient: u32::from(channel_id.recipient), + initiator: origin.into(), + sender: channel_id.sender.into(), + recipient: channel_id.recipient.into(), }]) }), ); From f8e7130fa0a65deff748353c5981f715501f54a2 Mon Sep 17 00:00:00 2001 From: Branislav Kontur Date: Mon, 6 May 2024 08:40:23 +0200 Subject: [PATCH 16/17] Update prdoc/pr_4281.prdoc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Bastian Köcher --- prdoc/pr_4281.prdoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/prdoc/pr_4281.prdoc b/prdoc/pr_4281.prdoc index bb3143a74ca7..ab2156a9505a 100644 --- a/prdoc/pr_4281.prdoc +++ b/prdoc/pr_4281.prdoc @@ -13,4 +13,4 @@ doc: crates: - name: polkadot-runtime-parachains - bump: minor + bump: major From d8637569808eb3881cfa8aba9c919584acf98644 Mon Sep 17 00:00:00 2001 From: Branislav Kontur Date: Mon, 6 May 2024 09:13:36 +0200 Subject: [PATCH 17/17] updated docs --- polkadot/runtime/parachains/src/hrmp.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/polkadot/runtime/parachains/src/hrmp.rs b/polkadot/runtime/parachains/src/hrmp.rs index 1a33ea93409e..42a9c23e5aa1 100644 --- a/polkadot/runtime/parachains/src/hrmp.rs +++ b/polkadot/runtime/parachains/src/hrmp.rs @@ -278,7 +278,12 @@ pub mod pallet { /// parachain. type DefaultChannelSizeAndCapacityWithSystem: Get<(u32, u32)>; - /// Means of converting an `Xcm` into a `VersionedXcm`. + /// Means of converting an `Xcm` into a `VersionedXcm`. This pallet sends HRMP XCM + /// notifications to the channel-related parachains, while the `WrapVersion` implementation + /// attempts to wrap them into the most suitable XCM version for the destination parachain. + /// + /// NOTE: For example, `pallet_xcm` provides an accurate implementation (recommended), or + /// the default `()` implementation uses the latest XCM version for all parachains. type VersionWrapper: xcm::WrapVersion; /// Something that provides the weight of this pallet.