git.delta.rocks / unique-network / refs/commits / d9af4aedc967

difftreelog

source

runtime/common/config/parachain.rs2.7 KiBsourcehistory
1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617use cumulus_primitives_core::AggregateMessageOrigin;18use frame_support::{parameter_types, traits::EnqueueWithOrigin, weights::Weight};19use up_common::constants::*;2021use crate::{MessageQueue, Runtime, RuntimeEvent, XcmpQueue};2223parameter_types! {24	pub const RelayMsgOrigin: AggregateMessageOrigin = AggregateMessageOrigin::Parent;25	pub const ReservedDmpWeight: Weight = MAXIMUM_BLOCK_WEIGHT.saturating_div(4);26	pub const ReservedXcmpWeight: Weight = MAXIMUM_BLOCK_WEIGHT.saturating_div(4);27}2829impl cumulus_pallet_parachain_system::Config for Runtime {30	type RuntimeEvent = RuntimeEvent;31	type SelfParaId = staging_parachain_info::Pallet<Self>;32	type OnSystemEvent = ();33	type WeightInfo = cumulus_pallet_parachain_system::weights::SubstrateWeight<Self>;34	type OutboundXcmpMessageSource = XcmpQueue;35	type DmpQueue = EnqueueWithOrigin<MessageQueue, RelayMsgOrigin>;36	type ReservedDmpWeight = ReservedDmpWeight;37	type ReservedXcmpWeight = ReservedXcmpWeight;38	type XcmpMessageHandler = XcmpQueue;39	#[cfg(not(feature = "lookahead"))]40	type CheckAssociatedRelayNumber = cumulus_pallet_parachain_system::RelayNumberStrictlyIncreases;41	#[cfg(feature = "lookahead")]42	type CheckAssociatedRelayNumber =43		cumulus_pallet_parachain_system::RelayNumberMonotonicallyIncreases;44	#[cfg(feature = "lookahead")]45	type ConsensusHook = ConsensusHook;46}4748impl staging_parachain_info::Config for Runtime {}4950impl cumulus_pallet_aura_ext::Config for Runtime {}5152/// Maximum number of blocks simultaneously accepted by the Runtime, not yet included53/// into the relay chain.54#[cfg(feature = "lookahead")]55const UNINCLUDED_SEGMENT_CAPACITY: u32 = 3;56/// How many parachain blocks are processed by the relay chain per parent. Limits the57/// number of blocks authored per slot.58#[cfg(feature = "lookahead")]59const BLOCK_PROCESSING_VELOCITY: u32 = 2;60#[cfg(feature = "lookahead")]61pub type ConsensusHook = cumulus_pallet_aura_ext::FixedVelocityConsensusHook<62	Runtime,63	{ MILLISECS_PER_RELAY_BLOCK as u32 },64	BLOCK_PROCESSING_VELOCITY,65	UNINCLUDED_SEGMENT_CAPACITY,66>;