Skip to content

Commit

Permalink
WIP: [dmp,xcmp,message_queue] adapt paritytech/polkadot-sdk#1246
Browse files Browse the repository at this point in the history
  • Loading branch information
bkontur committed Jan 10, 2024
1 parent d39d8b7 commit 6eb085d
Show file tree
Hide file tree
Showing 31 changed files with 1,789 additions and 13 deletions.
6 changes: 6 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions system-parachains/asset-hubs/asset-hub-kusama/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ pallet-asset-conversion = { default-features = false, version = "9.0.0" }
pallet-aura = { default-features = false, version = "26.0.0" }
pallet-authorship = { default-features = false, version = "27.0.0" }
pallet-balances = { default-features = false, version = "27.0.0" }
pallet-message-queue = { default-features = false , version = "30.0.0" }
pallet-multisig = { default-features = false, version = "27.0.0" }
pallet-nft-fractionalization = { default-features = false, version = "9.0.0" }
pallet-nfts = { default-features = false, version = "21.0.0" }
Expand Down Expand Up @@ -126,6 +127,7 @@ runtime-benchmarks = [
"pallet-assets/runtime-benchmarks",
"pallet-balances/runtime-benchmarks",
"pallet-collator-selection/runtime-benchmarks",
"pallet-message-queue/runtime-benchmarks",
"pallet-multisig/runtime-benchmarks",
"pallet-nft-fractionalization/runtime-benchmarks",
"pallet-nfts/runtime-benchmarks",
Expand Down Expand Up @@ -160,6 +162,7 @@ try-runtime = [
"pallet-authorship/try-runtime",
"pallet-balances/try-runtime",
"pallet-collator-selection/try-runtime",
"pallet-message-queue/try-runtime",
"pallet-multisig/try-runtime",
"pallet-nft-fractionalization/try-runtime",
"pallet-nfts/try-runtime",
Expand Down Expand Up @@ -207,6 +210,7 @@ std = [
"pallet-authorship/std",
"pallet-balances/std",
"pallet-collator-selection/std",
"pallet-message-queue/std",
"pallet-multisig/std",
"pallet-nft-fractionalization/std",
"pallet-nfts-runtime-api/std",
Expand Down
36 changes: 33 additions & 3 deletions system-parachains/asset-hubs/asset-hub-kusama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,14 @@ use assets_common::{
AssetIdForTrustBackedAssetsConvert, MultiLocationForAssetId,
};
use cumulus_pallet_parachain_system::RelayNumberStrictlyIncreases;
use cumulus_primitives_core::AggregateMessageOrigin;
use sp_api::impl_runtime_apis;
use sp_core::{crypto::KeyTypeId, OpaqueMetadata};
use sp_runtime::{
create_runtime_str, generic, impl_opaque_keys,
traits::{AccountIdConversion, AccountIdLookup, BlakeTwo256, Block as BlockT, Verify},
transaction_validity::{TransactionSource, TransactionValidity},
ApplyExtrinsicResult, Permill,
ApplyExtrinsicResult, Perbill, Permill,
};

use sp_std::prelude::*;
Expand Down Expand Up @@ -69,7 +70,7 @@ use pallet_asset_conversion_tx_payment::AssetConversionAdapter;
use pallet_nfts::PalletFeatures;
use parachains_common::{
impls::DealWithFees, AccountId, AssetIdForTrustBackedAssets, AuraId, Balance, BlockNumber,
Hash, Header, Nonce, Signature,
Hash, Header, Nonce, Signature, message_queue::*,
};
use sp_runtime::RuntimeDebug;
use system_parachains_constants::{
Expand Down Expand Up @@ -606,13 +607,14 @@ impl pallet_proxy::Config for Runtime {
parameter_types! {
pub const ReservedXcmpWeight: Weight = MAXIMUM_BLOCK_WEIGHT.saturating_div(4);
pub const ReservedDmpWeight: Weight = MAXIMUM_BLOCK_WEIGHT.saturating_div(4);
pub const RelayOrigin: AggregateMessageOrigin = AggregateMessageOrigin::Parent;
}

impl cumulus_pallet_parachain_system::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type OnSystemEvent = ();
type SelfParaId = parachain_info::Pallet<Runtime>;
type DmpMessageHandler = DmpQueue;
type DmpQueue = frame_support::traits::EnqueueWithOrigin<MessageQueue, RelayOrigin>;
type ReservedDmpWeight = ReservedDmpWeight;
type OutboundXcmpMessageSource = XcmpQueue;
type XcmpMessageHandler = XcmpQueue;
Expand All @@ -624,10 +626,37 @@ impl cumulus_pallet_parachain_system::Config for Runtime {
BLOCK_PROCESSING_VELOCITY,
UNINCLUDED_SEGMENT_CAPACITY,
>;
type WeightInfo = weights::cumulus_pallet_parachain_system::WeightInfo<Runtime>;
}

impl parachain_info::Config 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 = weights::pallet_message_queue::WeightInfo<Runtime>;
#[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<xcm_config::XcmConfig>,
RuntimeCall,
>;
type Size = u32;
// The XCMP queue pallet is only ever able to handle the `Sibling(ParaId)` origin:
type QueueChangeHandler = NarrowOriginToSibling<XcmpQueue>;
type QueuePausedQuery = NarrowOriginToSibling<XcmpQueue>;
type HeapSize = sp_core::ConstU32<{ 64 * 1024 }>;
type MaxStale = sp_core::ConstU32<8>;
type ServiceWeight = MessageQueueServiceWeight;
}

impl cumulus_pallet_aura_ext::Config for Runtime {}

parameter_types! {
Expand Down Expand Up @@ -898,6 +927,7 @@ construct_runtime!(
CumulusXcm: cumulus_pallet_xcm::{Pallet, Event<T>, Origin} = 32,
DmpQueue: cumulus_pallet_dmp_queue::{Pallet, Call, Storage, Event<T>} = 33,
ToPolkadotXcmRouter: pallet_xcm_bridge_hub_router::<Instance1>::{Pallet, Storage, Call} = 34,
MessageQueue: pallet_message_queue::{Pallet, Call, Storage, Event<T>} = 35,

// Handy utilities.
Utility: pallet_utility::{Pallet, Call, Event} = 40,
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 6eb085d

Please sign in to comment.