git.delta.rocks / unique-network / refs/commits / 716fee23155e

difftreelog

chore remove unique-scheduler leftovers

Yaroslav Bolyukin2023-10-04parent: #13e91d3.patch.diff
in: master

10 files changed

modifiedCargo.tomldiffbeforeafterboth
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,5 @@
 [workspace]
 default-members = ['client/*', 'node/*', 'runtime/opal']
-exclude = ['pallets/scheduler-v2']
 members = [
 	'client/*',
 	'crates/*',
@@ -54,7 +53,6 @@
 pallet-structure = { default-features = false, path = "pallets/structure" }
 pallet-test-utils = { default-features = false, path = "test-pallets/utils" }
 pallet-unique = { path = "pallets/unique", default-features = false }
-# pallet-unique-scheduler-v2 = { path = "pallets/scheduler-v2", default-features = false }
 precompile-utils-macro = { path = "runtime/common/ethereum/precompiles/utils/macro" }
 struct-versioning = { path = "crates/struct-versioning" }
 uc-rpc = { path = "client/rpc" }
modifiedMakefilediffbeforeafterboth
--- a/Makefile
+++ b/Makefile
@@ -128,10 +128,6 @@
 bench-structure:
 	make _bench PALLET=structure
 
-.PHONY: bench-scheduler
-bench-scheduler:
-	make _bench PALLET=unique-scheduler-v2 PALLET_DIR=scheduler-v2
-
 .PHONY: bench-foreign-assets
 bench-foreign-assets:
 	make _bench PALLET=foreign-assets
@@ -157,7 +153,6 @@
 	make _bench PALLET=xcm OUTPUT=./runtime/common/weights/xcm.rs TEMPLATE="--template=.maintain/external-weight-template.hbs"
 
 .PHONY: bench
-# Disabled: bench-scheduler
 bench: bench-app-promotion bench-common bench-evm-migration bench-unique bench-structure bench-fungible bench-refungible bench-nonfungible bench-configuration bench-foreign-assets bench-maintenance bench-xcm bench-collator-selection bench-identity
 
 .PHONY: check
modifiedruntime/common/config/pallets/mod.rsdiffbeforeafterboth
--- a/runtime/common/config/pallets/mod.rs
+++ b/runtime/common/config/pallets/mod.rs
@@ -40,9 +40,6 @@
 	Balances, Runtime, RuntimeCall, RuntimeEvent, DECIMALS, TOKEN_SYMBOL, VERSION,
 };
 
-#[cfg(feature = "unique-scheduler")]
-pub mod scheduler;
-
 #[cfg(feature = "foreign-assets")]
 pub mod foreign_asset;
 
deletedruntime/common/config/pallets/scheduler.rsdiffbeforeafterboth
--- a/runtime/common/config/pallets/scheduler.rs
+++ /dev/null
@@ -1,88 +0,0 @@
-// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.
-// This file is part of Unique Network.
-
-// Unique Network is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-
-// Unique Network is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License
-// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
-
-use core::cmp::Ordering;
-
-use frame_support::{
-	parameter_types,
-	traits::{EnsureOrigin, PrivilegeCmp},
-	weights::Weight,
-};
-use frame_system::{EnsureRoot, RawOrigin};
-use pallet_unique_scheduler_v2::ScheduledEnsureOriginSuccess;
-use parity_scale_codec::Decode;
-use sp_runtime::Perbill;
-use up_common::types::AccountId;
-
-use crate::{
-	runtime_common::{config::substrate::RuntimeBlockWeights, scheduler::SchedulerPaymentExecutor},
-	OriginCaller, Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin,
-};
-
-parameter_types! {
-	pub MaximumSchedulerWeight: Weight = Perbill::from_percent(50) *
-		RuntimeBlockWeights::get().max_block;
-	pub const MaxScheduledPerBlock: u32 = 50;
-
-	pub const NoPreimagePostponement: Option<u32> = Some(10);
-	pub const Preimage: Option<u32> = Some(10);
-}
-
-pub struct EnsureSignedOrRoot<AccountId>(sp_std::marker::PhantomData<AccountId>);
-impl<O: Into<Result<RawOrigin<AccountId>, O>> + From<RawOrigin<AccountId>>, AccountId: Decode>
-	EnsureOrigin<O> for EnsureSignedOrRoot<AccountId>
-{
-	type Success = ScheduledEnsureOriginSuccess<AccountId>;
-	fn try_origin(o: O) -> Result<Self::Success, O> {
-		o.into().and_then(|o| match o {
-			RawOrigin::Root => Ok(ScheduledEnsureOriginSuccess::Root),
-			RawOrigin::Signed(who) => Ok(ScheduledEnsureOriginSuccess::Signed(who)),
-			r => Err(O::from(r)),
-		})
-	}
-}
-
-pub struct EqualOrRootOnly;
-impl PrivilegeCmp<OriginCaller> for EqualOrRootOnly {
-	fn cmp_privilege(left: &OriginCaller, right: &OriginCaller) -> Option<Ordering> {
-		use RawOrigin::*;
-
-		let left = left.clone().try_into().ok()?;
-		let right = right.clone().try_into().ok()?;
-
-		match (left, right) {
-			(Root, Root) => Some(Ordering::Equal),
-			(Root, _) => Some(Ordering::Greater),
-			(_, Root) => Some(Ordering::Less),
-			lr @ _ => (lr.0 == lr.1).then(|| Ordering::Equal),
-		}
-	}
-}
-
-impl pallet_unique_scheduler_v2::Config for Runtime {
-	type RuntimeEvent = RuntimeEvent;
-	type RuntimeOrigin = RuntimeOrigin;
-	type PalletsOrigin = OriginCaller;
-	type RuntimeCall = RuntimeCall;
-	type MaximumWeight = MaximumSchedulerWeight;
-	type ScheduleOrigin = EnsureSignedOrRoot<AccountId>;
-	type OriginPrivilegeCmp = EqualOrRootOnly;
-	type MaxScheduledPerBlock = MaxScheduledPerBlock;
-	type WeightInfo = ();
-	type Preimages = ();
-	type CallExecutor = SchedulerPaymentExecutor;
-	type PrioritySetOrigin = EnsureRoot<AccountId>;
-}
modifiedruntime/common/maintenance.rsdiffbeforeafterboth
before · runtime/common/maintenance.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 parity_scale_codec::{Decode, Encode};18use scale_info::TypeInfo;19use sp_runtime::{20	traits::{DispatchInfoOf, SignedExtension},21	transaction_validity::{22		InvalidTransaction, TransactionValidity, TransactionValidityError, ValidTransaction,23	},24};25use up_common::types::AccountId;2627use crate::{Maintenance, RuntimeCall};2829#[derive(Debug, Encode, Decode, PartialEq, Eq, Clone, TypeInfo)]30pub struct CheckMaintenance;3132impl SignedExtension for CheckMaintenance {33	type AccountId = AccountId;34	type Call = RuntimeCall;35	type AdditionalSigned = ();36	type Pre = ();3738	const IDENTIFIER: &'static str = "CheckMaintenance";3940	fn additional_signed(&self) -> Result<Self::AdditionalSigned, TransactionValidityError> {41		Ok(())42	}4344	fn pre_dispatch(45		self,46		who: &Self::AccountId,47		call: &Self::Call,48		info: &DispatchInfoOf<Self::Call>,49		len: usize,50	) -> Result<Self::Pre, TransactionValidityError> {51		self.validate(who, call, info, len).map(|_| ())52	}5354	fn validate(55		&self,56		_who: &Self::AccountId,57		call: &Self::Call,58		_info: &DispatchInfoOf<Self::Call>,59		_len: usize,60	) -> TransactionValidity {61		if Maintenance::is_enabled() {62			match call {63				RuntimeCall::EvmMigration(_)64				| RuntimeCall::EVM(_)65				| RuntimeCall::Ethereum(_)66				| RuntimeCall::Inflation(_)67				| RuntimeCall::Structure(_)68				| RuntimeCall::Unique(_) => Err(TransactionValidityError::Invalid(InvalidTransaction::Call)),6970				#[cfg(feature = "unique-scheduler")]71				RuntimeCall::Scheduler(_) => Err(TransactionValidityError::Invalid(InvalidTransaction::Call)),7273				#[cfg(feature = "app-promotion")]74				RuntimeCall::AppPromotion(_) => {75					Err(TransactionValidityError::Invalid(InvalidTransaction::Call))76				}7778				#[cfg(feature = "foreign-assets")]79				RuntimeCall::ForeignAssets(_) => {80					Err(TransactionValidityError::Invalid(InvalidTransaction::Call))81				}8283				#[cfg(feature = "collator-selection")]84				RuntimeCall::CollatorSelection(_)85				| RuntimeCall::Session(_)86				| RuntimeCall::Identity(_) => Err(TransactionValidityError::Invalid(InvalidTransaction::Call)),8788				#[cfg(feature = "pallet-test-utils")]89				RuntimeCall::TestUtils(_) => Err(TransactionValidityError::Invalid(InvalidTransaction::Call)),9091				_ => Ok(ValidTransaction::default()),92			}93		} else {94			Ok(ValidTransaction::default())95		}96	}9798	fn pre_dispatch_unsigned(99		call: &Self::Call,100		info: &DispatchInfoOf<Self::Call>,101		len: usize,102	) -> Result<(), TransactionValidityError> {103		Self::validate_unsigned(call, info, len).map(|_| ())104	}105106	fn validate_unsigned(107		call: &Self::Call,108		_info: &DispatchInfoOf<Self::Call>,109		_len: usize,110	) -> TransactionValidity {111		if Maintenance::is_enabled() {112			match call {113				RuntimeCall::EVM(_) | RuntimeCall::Ethereum(_) | RuntimeCall::EvmMigration(_) => {114					Err(TransactionValidityError::Invalid(InvalidTransaction::Call))115				}116				_ => Ok(ValidTransaction::default()),117			}118		} else {119			Ok(ValidTransaction::default())120		}121	}122}
after · runtime/common/maintenance.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 parity_scale_codec::{Decode, Encode};18use scale_info::TypeInfo;19use sp_runtime::{20	traits::{DispatchInfoOf, SignedExtension},21	transaction_validity::{22		InvalidTransaction, TransactionValidity, TransactionValidityError, ValidTransaction,23	},24};25use up_common::types::AccountId;2627use crate::{Maintenance, RuntimeCall};2829#[derive(Debug, Encode, Decode, PartialEq, Eq, Clone, TypeInfo)]30pub struct CheckMaintenance;3132impl SignedExtension for CheckMaintenance {33	type AccountId = AccountId;34	type Call = RuntimeCall;35	type AdditionalSigned = ();36	type Pre = ();3738	const IDENTIFIER: &'static str = "CheckMaintenance";3940	fn additional_signed(&self) -> Result<Self::AdditionalSigned, TransactionValidityError> {41		Ok(())42	}4344	fn pre_dispatch(45		self,46		who: &Self::AccountId,47		call: &Self::Call,48		info: &DispatchInfoOf<Self::Call>,49		len: usize,50	) -> Result<Self::Pre, TransactionValidityError> {51		self.validate(who, call, info, len).map(|_| ())52	}5354	fn validate(55		&self,56		_who: &Self::AccountId,57		call: &Self::Call,58		_info: &DispatchInfoOf<Self::Call>,59		_len: usize,60	) -> TransactionValidity {61		if Maintenance::is_enabled() {62			match call {63				RuntimeCall::EvmMigration(_)64				| RuntimeCall::EVM(_)65				| RuntimeCall::Ethereum(_)66				| RuntimeCall::Inflation(_)67				| RuntimeCall::Structure(_)68				| RuntimeCall::Unique(_) => Err(TransactionValidityError::Invalid(InvalidTransaction::Call)),6970				#[cfg(feature = "app-promotion")]71				RuntimeCall::AppPromotion(_) => {72					Err(TransactionValidityError::Invalid(InvalidTransaction::Call))73				}7475				#[cfg(feature = "foreign-assets")]76				RuntimeCall::ForeignAssets(_) => {77					Err(TransactionValidityError::Invalid(InvalidTransaction::Call))78				}7980				#[cfg(feature = "collator-selection")]81				RuntimeCall::CollatorSelection(_)82				| RuntimeCall::Session(_)83				| RuntimeCall::Identity(_) => Err(TransactionValidityError::Invalid(InvalidTransaction::Call)),8485				#[cfg(feature = "pallet-test-utils")]86				RuntimeCall::TestUtils(_) => Err(TransactionValidityError::Invalid(InvalidTransaction::Call)),8788				_ => Ok(ValidTransaction::default()),89			}90		} else {91			Ok(ValidTransaction::default())92		}93	}9495	fn pre_dispatch_unsigned(96		call: &Self::Call,97		info: &DispatchInfoOf<Self::Call>,98		len: usize,99	) -> Result<(), TransactionValidityError> {100		Self::validate_unsigned(call, info, len).map(|_| ())101	}102103	fn validate_unsigned(104		call: &Self::Call,105		_info: &DispatchInfoOf<Self::Call>,106		_len: usize,107	) -> TransactionValidity {108		if Maintenance::is_enabled() {109			match call {110				RuntimeCall::EVM(_) | RuntimeCall::Ethereum(_) | RuntimeCall::EvmMigration(_) => {111					Err(TransactionValidityError::Invalid(InvalidTransaction::Call))112				}113				_ => Ok(ValidTransaction::default()),114			}115		} else {116			Ok(ValidTransaction::default())117		}118	}119}
modifiedruntime/common/mod.rsdiffbeforeafterboth
--- a/runtime/common/mod.rs
+++ b/runtime/common/mod.rs
@@ -23,9 +23,6 @@
 pub mod maintenance;
 pub mod runtime_apis;
 
-#[cfg(feature = "unique-scheduler")]
-pub mod scheduler;
-
 pub mod sponsoring;
 #[allow(missing_docs)]
 pub mod weights;
modifiedruntime/common/runtime_apis.rsdiffbeforeafterboth
--- a/runtime/common/runtime_apis.rs
+++ b/runtime/common/runtime_apis.rs
@@ -548,9 +548,6 @@
 					#[cfg(feature = "refungible")]
 					list_benchmark!(list, extra, pallet_refungible, Refungible);
 
-					#[cfg(feature = "unique-scheduler")]
-					list_benchmark!(list, extra, pallet_unique_scheduler_v2, Scheduler);
-
 					#[cfg(feature = "collator-selection")]
 					list_benchmark!(list, extra, pallet_collator_selection, CollatorSelection);
 
@@ -613,9 +610,6 @@
 
 					#[cfg(feature = "refungible")]
 					add_benchmark!(params, batches, pallet_refungible, Refungible);
-
-					#[cfg(feature = "unique-scheduler")]
-					add_benchmark!(params, batches, pallet_unique_scheduler_v2, Scheduler);
 
 					#[cfg(feature = "collator-selection")]
 					add_benchmark!(params, batches, pallet_collator_selection, CollatorSelection);
modifiedruntime/opal/Cargo.tomldiffbeforeafterboth
--- a/runtime/opal/Cargo.toml
+++ b/runtime/opal/Cargo.toml
@@ -229,7 +229,6 @@
 preimage = []
 refungible = []
 session-test-timings = []
-unique-scheduler = []
 
 ################################################################################
 # local dependencies
modifiedruntime/quartz/Cargo.tomldiffbeforeafterboth
--- a/runtime/quartz/Cargo.toml
+++ b/runtime/quartz/Cargo.toml
@@ -221,7 +221,6 @@
 preimage = []
 refungible = []
 session-test-timings = []
-unique-scheduler = []
 
 ################################################################################
 # local dependencies
modifiedruntime/unique/Cargo.tomldiffbeforeafterboth
--- a/runtime/unique/Cargo.toml
+++ b/runtime/unique/Cargo.toml
@@ -224,7 +224,6 @@
 preimage = []
 refungible = []
 session-test-timings = []
-unique-scheduler = []
 
 ################################################################################
 # local dependencies