diff --git a/parachain/Cargo.lock b/parachain/Cargo.lock index e2d5f04375..aa6b8dd432 100644 --- a/parachain/Cargo.lock +++ b/parachain/Cargo.lock @@ -6646,6 +6646,7 @@ dependencies = [ "parity-scale-codec", "polkadot-parachain-primitives 6.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.11.0)", "polkadot-primitives 7.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.11.0)", + "polkadot-runtime-common", "polkadot-runtime-parachains", "precompile-utils", "runtime-common", @@ -10168,6 +10169,7 @@ dependencies = [ "parity-scale-codec", "polkadot-parachain-primitives 6.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.11.0)", "polkadot-primitives 7.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.11.0)", + "polkadot-runtime-common", "polkadot-runtime-parachains", "precompile-utils", "runtime-common", @@ -12885,6 +12887,7 @@ dependencies = [ "parity-scale-codec", "polkadot-parachain-primitives 6.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.11.0)", "polkadot-primitives 7.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.11.0)", + "polkadot-runtime-common", "polkadot-runtime-parachains", "precompile-utils", "runtime-common", @@ -13108,6 +13111,7 @@ dependencies = [ "parity-scale-codec", "polkadot-parachain-primitives 6.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.11.0)", "polkadot-primitives 7.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.11.0)", + "polkadot-runtime-common", "polkadot-runtime-parachains", "scale-info", "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.11.0)", diff --git a/parachain/Cargo.toml b/parachain/Cargo.toml index 9b7e12dddf..c7ff50e255 100644 --- a/parachain/Cargo.toml +++ b/parachain/Cargo.toml @@ -219,6 +219,7 @@ pallet-tips = { git = "https://github.com/paritytech/polkadot-sdk", branch = "re pallet-timestamp = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.11.0", default-features = false } pallet-xcm = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.11.0", default-features = false } parachains-common = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.11.0", default-features = false } +polkadot-runtime-common = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.11.0", default-features = false } xcm = { package = "staging-xcm", git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.11.0", default-features = false } xcm-builder = { package = "staging-xcm-builder", git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.11.0", default-features = false } xcm-executor = { package = "staging-xcm-executor", git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.11.0", default-features = false } diff --git a/parachain/runtime/common/Cargo.toml b/parachain/runtime/common/Cargo.toml index ea730f40a1..5e0af400df 100644 --- a/parachain/runtime/common/Cargo.toml +++ b/parachain/runtime/common/Cargo.toml @@ -36,6 +36,7 @@ parachain-info = { workspace = true } pallet-xcm = { workspace = true } parachains-common = { workspace = true } +polkadot-runtime-common = { workspace = true } xcm = { workspace = true } staging-xcm = { workspace = true } xcm-builder = { workspace = true } @@ -104,6 +105,7 @@ std = [ "orml-traits/std", "orml-xtokens/std", "parachains-common/std", + "polkadot-runtime-common/std", ] runtime-benchmarks = [ diff --git a/parachain/runtime/litentry/Cargo.toml b/parachain/runtime/litentry/Cargo.toml index 156eb6fd6c..5eb74b9a7d 100644 --- a/parachain/runtime/litentry/Cargo.toml +++ b/parachain/runtime/litentry/Cargo.toml @@ -45,6 +45,7 @@ pallet-democracy = { workspace = true } pallet-identity = { workspace = true } pallet-indices = { workspace = true } pallet-membership = { workspace = true } +pallet-message-queue = { workspace = true } pallet-multisig = { workspace = true } pallet-preimage = { workspace = true } pallet-proxy = { workspace = true } @@ -69,6 +70,7 @@ parachain-info = { workspace = true } pallet-xcm = { workspace = true } parachains-common = { workspace = true } +polkadot-runtime-common = { workspace = true } polkadot-parachain-primitives = { workspace = true } xcm = { workspace = true } staging-xcm = { workspace = true } @@ -132,7 +134,6 @@ polkadot-runtime-parachains = { workspace = true, features = ["std"] } runtime-common = { workspace = true, features = ["tests"] } sp-state-machine = { workspace = true, features = ["std"] } xcm-simulator = { workspace = true } -pallet-message-queue = { workspace = true, features = ["std"] } [build-dependencies] substrate-wasm-builder = { workspace = true } @@ -157,6 +158,7 @@ runtime-benchmarks = [ "pallet-evm/runtime-benchmarks", "pallet-identity/runtime-benchmarks", "pallet-membership/runtime-benchmarks", + "pallet-message-queue/runtime-benchmarks", "pallet-multisig/runtime-benchmarks", "pallet-parachain-staking/runtime-benchmarks", "pallet-preimage/runtime-benchmarks", @@ -229,6 +231,7 @@ std = [ "pallet-identity/std", "pallet-indices/std", "pallet-membership/std", + "pallet-message-queue/std", "pallet-multisig/std", "pallet-parachain-staking/std", "pallet-preimage/std", @@ -280,6 +283,7 @@ std = [ "moonbeam-rpc-primitives-txpool/std", "precompile-utils/std", "parachains-common/std", + "polkadot-runtime-common/std", ] try-runtime = [ "hex", @@ -316,6 +320,7 @@ try-runtime = [ "pallet-identity-management/try-runtime", "pallet-extrinsic-filter/try-runtime", "pallet-membership/try-runtime", + "pallet-message-queue/try-runtime", "pallet-multisig/try-runtime", "pallet-parachain-staking/try-runtime", "pallet-preimage/try-runtime", diff --git a/parachain/runtime/litentry/src/lib.rs b/parachain/runtime/litentry/src/lib.rs index c2b2cca807..28ed569c09 100644 --- a/parachain/runtime/litentry/src/lib.rs +++ b/parachain/runtime/litentry/src/lib.rs @@ -59,6 +59,7 @@ use sp_version::RuntimeVersion; // XCM Imports use xcm_builder::PayOverXcm; use xcm_executor::XcmExecutor; +use xcm::latest::prelude::Junction; pub use constants::currency::deposit; pub use core_primitives::{ @@ -79,6 +80,7 @@ use runtime_common::{ NORMAL_DISPATCH_RATIO, WEIGHT_PER_GAS, WEIGHT_TO_FEE_FACTOR, impls::{ContainsParts, LocatableAssetConverter, VersionedLocationConverter} }; +use polkadot_runtime_common::xcm_sender::NoPriceForMessageDelivery; use xcm_config::{XcmConfig, XcmOriginToTransactDispatchOrigin}; use pallet_ethereum::{Call::transact, PostLogContent, TransactionStatus}; @@ -824,18 +826,45 @@ impl cumulus_pallet_xcmp_queue::Config for Runtime { type ControllerOrigin = EnsureRootOrAllCouncil; type ControllerOriginConverter = XcmOriginToTransactDispatchOrigin; type WeightInfo = weights::cumulus_pallet_xcmp_queue::WeightInfo; - type PriceForSiblingDelivery = (); + type PriceForSiblingDelivery = NoPriceForMessageDelivery; // Enqueue XCMP messages from siblings for later processing. type XcmpQueue = TransformOrigin; type MaxInboundSuspended = sp_core::ConstU32<1_000>; } +parameter_types! { + /// All messages that came into the `DmpSink`. + pub static RecordedMessages: Vec> = vec![]; +} + +/// Can be used as [`Config::DmpSink`] to record all messages that came in. +pub struct RecordingDmpSink; +impl frame_support::traits::HandleMessage for RecordingDmpSink { + type MaxMessageLen = ConstU32<16>; + + fn handle_message(msg: frame_support::BoundedSlice) { + RecordedMessages::mutate(|n| n.push(msg.to_vec())); + } + + fn handle_messages<'a>(_: impl Iterator>) { + unimplemented!() + } + + fn sweep_queue() { + unimplemented!() + } + + fn footprint() -> frame_support::traits::QueueFootprint { + unimplemented!() + } +} + impl cumulus_pallet_dmp_queue::Config for Runtime { type RuntimeEvent = RuntimeEvent; // TODO need to generate type WeightInfo = (); // type WeightInfo = weights::cumulus_pallet_dmp_queue::WeightInfo; - type DmpSink = (); + type DmpSink = RecordingDmpSink; } parameter_types! { @@ -1232,6 +1261,33 @@ impl pallet_score_staking::Config for Runtime { impl runtime_common::BaseRuntimeRequirements for Runtime {} impl runtime_common::ParaRuntimeRequirements for Runtime {} +parameter_types! { + pub MessageQueueServiceWeight: Weight = Perbill::from_percent(35) * RuntimeBlockWeights::get().max_block; +} + +impl pallet_message_queue::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type WeightInfo = (); + #[cfg(feature = "runtime-benchmarks")] + type MessageProcessor = pallet_message_queue::mock_helpers::NoopMessageProcessor< + cumulus_primitives_core::AggregateMessageOrigin, + >; + #[cfg(not(feature = "runtime-benchmarks"))] + type MessageProcessor = xcm_builder::ProcessXcmMessage< + AggregateMessageOrigin, + xcm_executor::XcmExecutor, + RuntimeCall, + >; + type Size = u32; + // The XCMP queue pallet is only ever able to handle the `Sibling(ParaId)` origin: + type QueueChangeHandler = NarrowOriginToSibling; + type QueuePausedQuery = NarrowOriginToSibling; + type HeapSize = sp_core::ConstU32<{ 64 * 1024 }>; + type MaxStale = sp_core::ConstU32<8>; + type ServiceWeight = MessageQueueServiceWeight; + type IdleMaxServiceWeight = (); +} + construct_runtime! { pub enum Runtime { @@ -1293,6 +1349,7 @@ construct_runtime! { // XTokens: orml_xtokens = 54, // 55 is saved for old pallet: Tokens: orml_tokens Assets: pallet_assets = 56, + MessageQueue: pallet_message_queue = 57, // Litentry pallets ChainBridge: pallet_chain_bridge= 60, diff --git a/parachain/runtime/litentry/src/xcm_config.rs b/parachain/runtime/litentry/src/xcm_config.rs index 62648a532f..6d6d8d8729 100644 --- a/parachain/runtime/litentry/src/xcm_config.rs +++ b/parachain/runtime/litentry/src/xcm_config.rs @@ -71,12 +71,6 @@ parameter_types! { pub UniversalLocation: InteriorLocation = Parachain(ParachainInfo::parachain_id().into()).into(); } -impl orml_traits::parameters::frame_support::traits::Get for UniversalLocation { - fn get() -> Junctions { - UniversalLocation::get() - } -} - /// Type for specifying how a `Location` can be converted into an `AccountId`. This is used /// when determining ownership of accounts for asset transacting and when attempting to use XCM /// `Transact` in order to determine the dispatch Origin. diff --git a/parachain/runtime/paseo/Cargo.toml b/parachain/runtime/paseo/Cargo.toml index 2294bd01df..3ab5e1ce44 100644 --- a/parachain/runtime/paseo/Cargo.toml +++ b/parachain/runtime/paseo/Cargo.toml @@ -40,6 +40,7 @@ pallet-democracy = { workspace = true } pallet-identity = { workspace = true } pallet-indices = { workspace = true } pallet-membership = { workspace = true } +pallet-message-queue = { workspace = true } pallet-multisig = { workspace = true } pallet-preimage = { workspace = true } pallet-proxy = { workspace = true } @@ -66,6 +67,7 @@ parachain-info = { workspace = true } pallet-xcm = { workspace = true } parachains-common = { workspace = true } +polkadot-runtime-common = { workspace = true } polkadot-parachain-primitives = { workspace = true } xcm = { workspace = true } staging-xcm = { workspace = true } @@ -132,7 +134,6 @@ polkadot-runtime-parachains = { workspace = true, features = ["std"] } runtime-common = { workspace = true, features = ["tests"] } sp-state-machine = { workspace = true, features = ["std"] } xcm-simulator = { workspace = true } -pallet-message-queue = { workspace = true, features = ["std"] } [build-dependencies] substrate-wasm-builder = { workspace = true } @@ -157,6 +158,7 @@ runtime-benchmarks = [ "pallet-evm/runtime-benchmarks", "pallet-identity/runtime-benchmarks", "pallet-membership/runtime-benchmarks", + "pallet-message-queue/runtime-benchmarks", "pallet-multisig/runtime-benchmarks", "pallet-parachain-staking/runtime-benchmarks", "pallet-preimage/runtime-benchmarks", @@ -291,6 +293,7 @@ std = [ "pallet-bitacross/std", "precompile-utils/std", "parachains-common/std", + "polkadot-runtime-common/std", ] try-runtime = [ "cumulus-pallet-aura-ext/try-runtime", @@ -326,6 +329,7 @@ try-runtime = [ "pallet-group/try-runtime", "pallet-identity-management/try-runtime", "pallet-membership/try-runtime", + "pallet-message-queue/try-runtime", "pallet-multisig/try-runtime", "pallet-parachain-staking/try-runtime", "pallet-preimage/try-runtime", diff --git a/parachain/runtime/paseo/src/lib.rs b/parachain/runtime/paseo/src/lib.rs index e2b699dd44..5ad1946345 100644 --- a/parachain/runtime/paseo/src/lib.rs +++ b/parachain/runtime/paseo/src/lib.rs @@ -69,6 +69,7 @@ use sp_version::RuntimeVersion; // XCM Imports use xcm_builder::PayOverXcm; use xcm_executor::XcmExecutor; +use xcm::latest::prelude::Junction; pub use constants::currency::deposit; pub use core_primitives::{ @@ -90,6 +91,7 @@ use runtime_common::{ WEIGHT_TO_FEE_FACTOR, impls::{ContainsParts, LocatableAssetConverter, VersionedLocationConverter} }; +use polkadot_runtime_common::xcm_sender::NoPriceForMessageDelivery; use xcm_config::{XcmConfig, XcmOriginToTransactDispatchOrigin}; use pallet_ethereum::{Call::transact, PostLogContent, TransactionStatus}; @@ -763,7 +765,9 @@ impl SortedMembers for CouncilProvider { } fn sorted_members() -> Vec { - pallet_collective::pallet::Members::::get() + // pallet_collective::pallet::Members::::get() + // TODO + unimplemented!() } #[cfg(feature = "runtime-benchmarks")] @@ -879,18 +883,45 @@ impl cumulus_pallet_xcmp_queue::Config for Runtime { type ControllerOrigin = EnsureRootOrAllCouncil; type ControllerOriginConverter = XcmOriginToTransactDispatchOrigin; type WeightInfo = weights::cumulus_pallet_xcmp_queue::WeightInfo; - type PriceForSiblingDelivery = (); + type PriceForSiblingDelivery = NoPriceForMessageDelivery; // Enqueue XCMP messages from siblings for later processing. type XcmpQueue = TransformOrigin; type MaxInboundSuspended = sp_core::ConstU32<1_000>; } +parameter_types! { + /// All messages that came into the `DmpSink`. + pub static RecordedMessages: Vec> = vec![]; +} + +/// Can be used as [`Config::DmpSink`] to record all messages that came in. +pub struct RecordingDmpSink; +impl frame_support::traits::HandleMessage for RecordingDmpSink { + type MaxMessageLen = ConstU32<16>; + + fn handle_message(msg: frame_support::BoundedSlice) { + RecordedMessages::mutate(|n| n.push(msg.to_vec())); + } + + fn handle_messages<'a>(_: impl Iterator>) { + unimplemented!() + } + + fn sweep_queue() { + unimplemented!() + } + + fn footprint() -> frame_support::traits::QueueFootprint { + unimplemented!() + } +} + impl cumulus_pallet_dmp_queue::Config for Runtime { type RuntimeEvent = RuntimeEvent; // TODO need to generate type WeightInfo = (); // type WeightInfo = weights::cumulus_pallet_dmp_queue::WeightInfo; - type DmpSink = (); + type DmpSink = RecordingDmpSink; } parameter_types! { @@ -1271,6 +1302,33 @@ impl pallet_score_staking::Config for Runtime { impl runtime_common::BaseRuntimeRequirements for Runtime {} impl runtime_common::ParaRuntimeRequirements for Runtime {} +parameter_types! { + pub MessageQueueServiceWeight: Weight = Perbill::from_percent(35) * RuntimeBlockWeights::get().max_block; +} + +impl pallet_message_queue::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type WeightInfo = (); + #[cfg(feature = "runtime-benchmarks")] + type MessageProcessor = pallet_message_queue::mock_helpers::NoopMessageProcessor< + cumulus_primitives_core::AggregateMessageOrigin, + >; + #[cfg(not(feature = "runtime-benchmarks"))] + type MessageProcessor = xcm_builder::ProcessXcmMessage< + AggregateMessageOrigin, + xcm_executor::XcmExecutor, + RuntimeCall, + >; + type Size = u32; + // The XCMP queue pallet is only ever able to handle the `Sibling(ParaId)` origin: + type QueueChangeHandler = NarrowOriginToSibling; + type QueuePausedQuery = NarrowOriginToSibling; + type HeapSize = sp_core::ConstU32<{ 64 * 1024 }>; + type MaxStale = sp_core::ConstU32<8>; + type ServiceWeight = MessageQueueServiceWeight; + type IdleMaxServiceWeight = (); +} + construct_runtime! { pub enum Runtime { @@ -1333,6 +1391,7 @@ construct_runtime! { // XTokens: orml_xtokens = 54, // 55 is saved for old pallet: Tokens: orml_tokens Assets: pallet_assets = 56, + MessageQueue: pallet_message_queue = 57, // Rococo pallets ChainBridge: pallet_chain_bridge= 60, diff --git a/parachain/runtime/paseo/src/xcm_config.rs b/parachain/runtime/paseo/src/xcm_config.rs index a798236392..c791f681d7 100644 --- a/parachain/runtime/paseo/src/xcm_config.rs +++ b/parachain/runtime/paseo/src/xcm_config.rs @@ -70,12 +70,6 @@ parameter_types! { pub UniversalLocation: InteriorLocation = Parachain(ParachainInfo::parachain_id().into()).into(); } -impl orml_traits::parameters::frame_support::traits::Get for UniversalLocation { - fn get() -> Junctions { - UniversalLocation::get() - } -} - /// Type for specifying how a `Location` can be converted into an `AccountId`. This is used /// when determining ownership of accounts for asset transacting and when attempting to use XCM /// `Transact` in order to determine the dispatch Origin. diff --git a/parachain/runtime/rococo/Cargo.toml b/parachain/runtime/rococo/Cargo.toml index 6b04cb62e6..0ddab0988e 100644 --- a/parachain/runtime/rococo/Cargo.toml +++ b/parachain/runtime/rococo/Cargo.toml @@ -40,6 +40,7 @@ pallet-democracy = { workspace = true } pallet-identity = { workspace = true } pallet-indices = { workspace = true } pallet-membership = { workspace = true } +pallet-message-queue = { workspace = true } pallet-multisig = { workspace = true } pallet-preimage = { workspace = true } pallet-proxy = { workspace = true } @@ -66,6 +67,7 @@ parachain-info = { workspace = true } pallet-xcm = { workspace = true } parachains-common = { workspace = true } +polkadot-runtime-common = { workspace = true } polkadot-parachain-primitives = { workspace = true } xcm = { workspace = true } staging-xcm = { workspace = true } @@ -132,7 +134,6 @@ polkadot-runtime-parachains = { workspace = true, features = ["std"] } runtime-common = { workspace = true, features = ["tests"] } sp-state-machine = { workspace = true, features = ["std"] } xcm-simulator = { workspace = true } -pallet-message-queue = { workspace = true, features = ["std"] } [build-dependencies] substrate-wasm-builder = { workspace = true } @@ -157,6 +158,7 @@ runtime-benchmarks = [ "pallet-evm/runtime-benchmarks", "pallet-identity/runtime-benchmarks", "pallet-membership/runtime-benchmarks", + "pallet-message-queue/runtime-benchmarks", "pallet-multisig/runtime-benchmarks", "pallet-parachain-staking/runtime-benchmarks", "pallet-preimage/runtime-benchmarks", @@ -234,6 +236,7 @@ std = [ "pallet-indices/std", "pallet-membership/std", "pallet-message-queue/std", + "pallet-message-queue/std", "pallet-multisig/std", "pallet-parachain-staking/std", "pallet-preimage/std", @@ -291,6 +294,7 @@ std = [ "pallet-bitacross/std", "precompile-utils/std", "parachains-common/std", + "polkadot-runtime-common/std", ] try-runtime = [ "cumulus-pallet-aura-ext/try-runtime", @@ -326,6 +330,7 @@ try-runtime = [ "pallet-group/try-runtime", "pallet-identity-management/try-runtime", "pallet-membership/try-runtime", + "pallet-message-queue/try-runtime", "pallet-multisig/try-runtime", "pallet-parachain-staking/try-runtime", "pallet-preimage/try-runtime", diff --git a/parachain/runtime/rococo/src/lib.rs b/parachain/runtime/rococo/src/lib.rs index ea49702000..be41870ac0 100644 --- a/parachain/runtime/rococo/src/lib.rs +++ b/parachain/runtime/rococo/src/lib.rs @@ -62,6 +62,7 @@ use sp_version::RuntimeVersion; // XCM Imports use xcm_builder::PayOverXcm; use xcm_executor::XcmExecutor; +use xcm::latest::prelude::Junction; pub use constants::currency::deposit; pub use core_primitives::{ @@ -72,7 +73,7 @@ pub use core_primitives::{ pub use runtime_common::currency::*; use runtime_common::{ - impl_runtime_transaction_payment_fees, prod_or_fast, AccountIndex, BlockHashCount, BlockLength, MessageQueue, + impl_runtime_transaction_payment_fees, prod_or_fast, AccountIndex, BlockHashCount, BlockLength, CouncilInstance, CouncilMembershipInstance, DeveloperCommitteeInstance, DeveloperCommitteeMembershipInstance, EnsureEnclaveSigner, EnsureOmniAccount, EnsureRootOrAllCouncil, EnsureRootOrAllTechnicalCommittee, EnsureRootOrHalfCouncil, EnsureRootOrHalfTechnicalCommittee, @@ -83,6 +84,7 @@ use runtime_common::{ WEIGHT_TO_FEE_FACTOR, impls::{ContainsParts, LocatableAssetConverter, VersionedLocationConverter} }; +use polkadot_runtime_common::xcm_sender::NoPriceForMessageDelivery; use xcm_config::{XcmConfig, XcmOriginToTransactDispatchOrigin}; use pallet_ethereum::{Call::transact, PostLogContent, TransactionStatus}; @@ -756,7 +758,9 @@ impl SortedMembers for CouncilProvider { } fn sorted_members() -> Vec { - pallet_collective::pallet::Members::::get() + // pallet_collective::pallet::Members::::get() + // TODO + unimplemented!() } #[cfg(feature = "runtime-benchmarks")] @@ -876,18 +880,45 @@ impl cumulus_pallet_xcmp_queue::Config for Runtime { type ControllerOrigin = EnsureRootOrAllCouncil; type ControllerOriginConverter = XcmOriginToTransactDispatchOrigin; type WeightInfo = weights::cumulus_pallet_xcmp_queue::WeightInfo; - type PriceForSiblingDelivery = (); + type PriceForSiblingDelivery = NoPriceForMessageDelivery; // Enqueue XCMP messages from siblings for later processing. type XcmpQueue = TransformOrigin; type MaxInboundSuspended = sp_core::ConstU32<1_000>; } +parameter_types! { + /// All messages that came into the `DmpSink`. + pub static RecordedMessages: Vec> = vec![]; +} + +/// Can be used as [`Config::DmpSink`] to record all messages that came in. +pub struct RecordingDmpSink; +impl frame_support::traits::HandleMessage for RecordingDmpSink { + type MaxMessageLen = ConstU32<16>; + + fn handle_message(msg: frame_support::BoundedSlice) { + RecordedMessages::mutate(|n| n.push(msg.to_vec())); + } + + fn handle_messages<'a>(_: impl Iterator>) { + unimplemented!() + } + + fn sweep_queue() { + unimplemented!() + } + + fn footprint() -> frame_support::traits::QueueFootprint { + unimplemented!() + } +} + impl cumulus_pallet_dmp_queue::Config for Runtime { type RuntimeEvent = RuntimeEvent; // TODO need to generate type WeightInfo = (); // type WeightInfo = weights::cumulus_pallet_dmp_queue::WeightInfo; - type DmpSink = (); + type DmpSink = RecordingDmpSink; } parameter_types! { @@ -1268,6 +1299,33 @@ impl pallet_score_staking::Config for Runtime { impl runtime_common::BaseRuntimeRequirements for Runtime {} impl runtime_common::ParaRuntimeRequirements for Runtime {} +parameter_types! { + pub MessageQueueServiceWeight: Weight = Perbill::from_percent(35) * RuntimeBlockWeights::get().max_block; +} + +impl pallet_message_queue::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type WeightInfo = (); + #[cfg(feature = "runtime-benchmarks")] + type MessageProcessor = pallet_message_queue::mock_helpers::NoopMessageProcessor< + cumulus_primitives_core::AggregateMessageOrigin, + >; + #[cfg(not(feature = "runtime-benchmarks"))] + type MessageProcessor = xcm_builder::ProcessXcmMessage< + AggregateMessageOrigin, + xcm_executor::XcmExecutor, + RuntimeCall, + >; + type Size = u32; + // The XCMP queue pallet is only ever able to handle the `Sibling(ParaId)` origin: + type QueueChangeHandler = NarrowOriginToSibling; + type QueuePausedQuery = NarrowOriginToSibling; + type HeapSize = sp_core::ConstU32<{ 64 * 1024 }>; + type MaxStale = sp_core::ConstU32<8>; + type ServiceWeight = MessageQueueServiceWeight; + type IdleMaxServiceWeight = (); +} + construct_runtime! { pub enum Runtime { @@ -1330,6 +1388,7 @@ construct_runtime! { // XTokens: orml_xtokens = 54, // 55 is saved for old pallet: Tokens: orml_tokens Assets: pallet_assets = 56, + MessageQueue: pallet_message_queue = 57, // Rococo pallets ChainBridge: pallet_chain_bridge= 60, diff --git a/parachain/runtime/rococo/src/xcm_config.rs b/parachain/runtime/rococo/src/xcm_config.rs index c5e656b30a..bc52539273 100644 --- a/parachain/runtime/rococo/src/xcm_config.rs +++ b/parachain/runtime/rococo/src/xcm_config.rs @@ -70,18 +70,6 @@ parameter_types! { pub UniversalLocation: InteriorLocation = Parachain(ParachainInfo::parachain_id().into()).into(); } -impl orml_traits::parameters::frame_support::traits::Get for UniversalLocation { - fn get() -> Junctions { - UniversalLocation::get() - } -} - -impl sp_core::Get for UniversalLocation { - fn get() -> Junctions { - UniversalLocation::get() - } -} - /// Type for specifying how a `Location` can be converted into an `AccountId`. This is used /// when determining ownership of accounts for asset transacting and when attempting to use XCM /// `Transact` in order to determine the dispatch Origin.