frequency_runtime/xcm/
queue.rs1use crate::{
2 weights, AccountId, MessageQueue, ParachainSystem, PolkadotXcm, Runtime, RuntimeBlockWeights,
3 RuntimeEvent, XcmpQueue,
4};
5
6#[cfg(not(feature = "runtime-benchmarks"))]
7use crate::RuntimeCall;
8
9use frame_support::{
10 parameter_types,
11 traits::{ConstU32, TransformOrigin},
12 weights::Weight,
13};
14
15use crate::xcm::{
16 location_converter::XcmOriginToTransactDispatchOrigin,
17 parameters::{BaseDeliveryFee, FeeAssetId, TransactionByteFee},
18};
19
20use frame_system::EnsureRoot;
21use staging_xcm_builder::WithUniqueTopic;
22
23use cumulus_primitives_core::{AggregateMessageOrigin, ParaId};
24
25use parachains_common::message_queue::{NarrowOriginToSibling, ParaIdToSibling};
26
27pub use sp_runtime::{Perbill, Saturating};
28
29#[cfg(not(feature = "runtime-benchmarks"))]
30use crate::xcm::XcmConfig;
31
32#[cfg(not(feature = "runtime-benchmarks"))]
33use xcm_executor;
34
35pub type PriceForSiblingParachainDelivery = polkadot_runtime_common::xcm_sender::ExponentialPrice<
37 FeeAssetId,
38 BaseDeliveryFee,
39 TransactionByteFee,
40 XcmpQueue,
41>;
42
43pub type PriceForParentDelivery = polkadot_runtime_common::xcm_sender::ExponentialPrice<
45 FeeAssetId,
46 BaseDeliveryFee,
47 TransactionByteFee,
48 ParachainSystem,
49>;
50
51parameter_types! {
52 pub MessageQueueServiceWeight: Weight = Perbill::from_percent(35) * RuntimeBlockWeights::get().max_block;
54}
55
56pub type XcmRouter = WithUniqueTopic<(
59 cumulus_primitives_utility::ParentAsUmp<ParachainSystem, PolkadotXcm, PriceForParentDelivery>,
61 XcmpQueue,
63)>;
64
65impl cumulus_pallet_xcmp_queue::Config for Runtime {
67 type RuntimeEvent = RuntimeEvent;
68 type ChannelInfo = ParachainSystem;
69 type VersionWrapper = PolkadotXcm;
70 type XcmpQueue = TransformOrigin<MessageQueue, AggregateMessageOrigin, ParaId, ParaIdToSibling>;
72 type MaxInboundSuspended = sp_core::ConstU32<1_000>;
73 type MaxActiveOutboundChannels = ConstU32<128>;
74 type MaxPageSize = ConstU32<{ 1 << 16 }>;
75 type ControllerOrigin = EnsureRoot<AccountId>;
76 type ControllerOriginConverter = XcmOriginToTransactDispatchOrigin;
77 type WeightInfo = weights::cumulus_pallet_xcmp_queue::SubstrateWeight<Runtime>;
78 type PriceForSiblingDelivery = PriceForSiblingParachainDelivery;
79}
80
81impl pallet_message_queue::Config for Runtime {
83 type RuntimeEvent = RuntimeEvent;
84 type WeightInfo = weights::pallet_message_queue::SubstrateWeight<Runtime>;
85 #[cfg(feature = "runtime-benchmarks")]
86 type MessageProcessor = pallet_message_queue::mock_helpers::NoopMessageProcessor<
87 cumulus_primitives_core::AggregateMessageOrigin,
88 >;
89 #[cfg(not(feature = "runtime-benchmarks"))]
90 type MessageProcessor = staging_xcm_builder::ProcessXcmMessage<
91 AggregateMessageOrigin,
92 xcm_executor::XcmExecutor<XcmConfig>,
93 RuntimeCall,
94 >;
95 type Size = u32;
96 type QueueChangeHandler = NarrowOriginToSibling<XcmpQueue>;
98 type QueuePausedQuery = NarrowOriginToSibling<XcmpQueue>;
99 type HeapSize = sp_core::ConstU32<{ 103 * 1024 }>;
100 type MaxStale = sp_core::ConstU32<8>;
101 type ServiceWeight = MessageQueueServiceWeight;
102 type IdleMaxServiceWeight = ();
103}