git.delta.rocks / unique-network / refs/commits / 700b0c8abd12

difftreelog

fix enable throttling

Yaroslav Bolyukin2023-10-16parent: #8c199c3.patch.diff
in: master

6 files changed

modifiednode/cli/src/command.rsdiffbeforeafterboth
--- a/node/cli/src/command.rs
+++ b/node/cli/src/command.rs
@@ -396,6 +396,8 @@
 			}
 		}
 		#[cfg(feature = "try-runtime")]
+		// embedded try-runtime cli will be removed soon.
+		#[allow(deprecated)]
 		Some(Subcommand::TryRuntime(cmd)) => {
 			use std::{future::Future, pin::Pin};
 
modifiedpallets/inflation/src/lib.rsdiffbeforeafterboth
--- a/pallets/inflation/src/lib.rs
+++ b/pallets/inflation/src/lib.rs
@@ -71,7 +71,9 @@
 		type TreasuryAccountId: Get<Self::AccountId>;
 
 		// The block number provider, which should be callable from `on_initialize` hook.
-		type OnInitializeBlockNumberProvider: BlockNumberProvider<BlockNumber = BlockNumberFor<Self>>;
+		type OnInitializeBlockNumberProvider: BlockNumberProvider<
+			BlockNumber = BlockNumberFor<Self>,
+		>;
 
 		/// Number of blocks that pass between treasury balance updates due to inflation
 		#[pallet::constant]
modifiedprimitives/common/src/constants.rsdiffbeforeafterboth
--- a/primitives/common/src/constants.rs
+++ b/primitives/common/src/constants.rs
@@ -23,7 +23,10 @@
 
 use crate::types::{Balance, BlockNumber};
 
+#[cfg(not(feature = "lookahead"))]
 pub const MILLISECS_PER_BLOCK: u64 = 12000;
+#[cfg(feature = "lookahead")]
+pub const MILLISECS_PER_BLOCK: u64 = 3000;
 pub const MILLISECS_PER_RELAY_BLOCK: u64 = 6000;
 
 pub const SLOT_DURATION: u64 = MILLISECS_PER_BLOCK;
modifiedruntime/common/config/pallets/mod.rsdiffbeforeafterboth
--- a/runtime/common/config/pallets/mod.rs
+++ b/runtime/common/config/pallets/mod.rs
@@ -21,7 +21,7 @@
 	traits::{ConstU32, ConstU64, Currency},
 };
 use sp_arithmetic::Perbill;
-use sp_runtime::traits::{BlockNumberProvider, AccountIdConversion};
+use sp_runtime::traits::{AccountIdConversion, BlockNumberProvider};
 use up_common::{
 	constants::*,
 	types::{AccountId, Balance, BlockNumber},
@@ -111,8 +111,8 @@
 	type BlockNumber = BlockNumber;
 
 	fn current_block_number() -> Self::BlockNumber {
+		use hex_literal::hex;
 		use parity_scale_codec::Decode;
-		use hex_literal::hex;
 		use sp_io::storage;
 		// TODO: Replace with the following code after https://github.com/paritytech/polkadot-sdk/commit/3ea497b5a0fdda252f9c5a3c257cfaf8685f02fd lands
 		// <cumulus_pallet_parachain_system::Pallet<Runtime>>::last_relay_block_number()
@@ -122,7 +122,8 @@
 			// First parachain block
 			return Default::default()
 		};
-		BlockNumber::decode(&mut encoded.as_ref()).expect("typeof(RelayBlockNumber) == typeof(BlockNumber) == u32; qed")
+		BlockNumber::decode(&mut encoded.as_ref())
+			.expect("typeof(RelayBlockNumber) == typeof(BlockNumber) == u32; qed")
 	}
 }
 
modifiedruntime/common/config/parachain.rsdiffbeforeafterboth
before · runtime/common/config/parachain.rs
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 frame_support::{parameter_types, weights::Weight};18use up_common::constants::*;1920use crate::{DmpQueue, Runtime, RuntimeEvent, XcmpQueue};2122parameter_types! {23	pub const ReservedDmpWeight: Weight = MAXIMUM_BLOCK_WEIGHT.saturating_div(4);24	pub const ReservedXcmpWeight: Weight = MAXIMUM_BLOCK_WEIGHT.saturating_div(4);25}2627impl cumulus_pallet_parachain_system::Config for Runtime {28	type RuntimeEvent = RuntimeEvent;29	type SelfParaId = parachain_info::Pallet<Self>;30	type OnSystemEvent = ();31	// type DownwardMessageHandlers = cumulus_primitives_utility::UnqueuedDmpAsParent<32	// 	MaxDownwardMessageWeight,33	// 	XcmExecutor<XcmConfig>,34	// 	Call,35	// >;36	type OutboundXcmpMessageSource = XcmpQueue;37	type DmpMessageHandler = DmpQueue;38	type ReservedDmpWeight = ReservedDmpWeight;39	type ReservedXcmpWeight = ReservedXcmpWeight;40	type XcmpMessageHandler = XcmpQueue;41	type CheckAssociatedRelayNumber = cumulus_pallet_parachain_system::RelayNumberStrictlyIncreases;42}4344impl parachain_info::Config for Runtime {}4546impl cumulus_pallet_aura_ext::Config for Runtime {}
modifiedruntime/common/runtime_apis.rsdiffbeforeafterboth
--- a/runtime/common/runtime_apis.rs
+++ b/runtime/common/runtime_apis.rs
@@ -682,11 +682,10 @@
 			#[cfg(feature = "lookahead")]
 			impl cumulus_primitives_aura::AuraUnincludedSegmentApi<Block> for Runtime {
 				fn can_build_upon(
-					_included_hash: <Block as BlockT>::Hash,
-					_slot: cumulus_primitives_aura::Slot,
+					included_hash: <Block as BlockT>::Hash,
+					slot: cumulus_primitives_aura::Slot,
 				) -> bool {
-					// FIXME: Limit velocity
-					true
+					$crate::config::parachain::ConsensusHook::can_build_upon(included_hash, slot)
 				}
 			}