git.delta.rocks / unique-network / refs/commits / 6c3625540f0f

difftreelog

fix remove AllowUnpaidExecutionFrom from barrier

Daniel Shiposha2022-09-07parent: #13887cf.patch.diff
in: master

3 files changed

modifiedruntime/opal/src/xcm_barrier.rsdiffbeforeafterboth
before · runtime/opal/src/xcm_barrier.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::{18	{match_types, weights::Weight},19	traits::Everything,20};21use xcm::{22	latest::Xcm,23	v1::{BodyId, Junction::*, Junctions::*, MultiLocation},24};25use xcm_builder::{AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom, TakeWeightCredit};26use xcm_executor::traits::ShouldExecute;2728use crate::runtime_common::config::xcm::{DenyThenTry, DenyTransact};2930match_types! {31	pub type ParentOrParentsUnitPlurality: impl Contains<MultiLocation> = {32		MultiLocation { parents: 1, interior: Here } |33		MultiLocation { parents: 1, interior: X1(Plurality { id: BodyId::Unit, .. }) }34	};35}3637/// Execution barrier that just takes `max_weight` from `weight_credit`.38///39/// Useful to allow XCM execution by local chain users via extrinsics.40/// E.g. `pallet_xcm::reserve_asset_transfer` to transfer a reserve asset41/// out of the local chain to another one.42pub struct AllowAllDebug;43impl ShouldExecute for AllowAllDebug {44	fn should_execute<Call>(45		_origin: &MultiLocation,46		_message: &mut Xcm<Call>,47		_max_weight: Weight,48		_weight_credit: &mut Weight,49	) -> Result<(), ()> {50		Ok(())51	}52}5354pub type Barrier = DenyThenTry<55	DenyTransact,56	(57		TakeWeightCredit,58		AllowTopLevelPaidExecutionFrom<Everything>,59		AllowUnpaidExecutionFrom<ParentOrParentsUnitPlurality>,60		// ^^^ Parent & its unit plurality gets free execution61		AllowAllDebug,62	),63>;
after · runtime/opal/src/xcm_barrier.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::{weights::Weight, traits::Everything};18use xcm::{latest::Xcm, v1::MultiLocation};19use xcm_builder::{AllowTopLevelPaidExecutionFrom, TakeWeightCredit};20use xcm_executor::traits::ShouldExecute;2122use crate::runtime_common::config::xcm::{DenyThenTry, DenyTransact};2324/// Execution barrier that just takes `max_weight` from `weight_credit`.25///26/// Useful to allow XCM execution by local chain users via extrinsics.27/// E.g. `pallet_xcm::reserve_asset_transfer` to transfer a reserve asset28/// out of the local chain to another one.29pub struct AllowAllDebug;30impl ShouldExecute for AllowAllDebug {31	fn should_execute<Call>(32		_origin: &MultiLocation,33		_message: &mut Xcm<Call>,34		_max_weight: Weight,35		_weight_credit: &mut Weight,36	) -> Result<(), ()> {37		Ok(())38	}39}4041pub type Barrier = DenyThenTry<42	DenyTransact,43	(44		TakeWeightCredit,45		AllowTopLevelPaidExecutionFrom<Everything>,46		AllowAllDebug,47	),48>;
modifiedruntime/quartz/src/xcm_barrier.rsdiffbeforeafterboth
--- a/runtime/quartz/src/xcm_barrier.rs
+++ b/runtime/quartz/src/xcm_barrier.rs
@@ -19,9 +19,9 @@
 	traits::{Get, Everything},
 };
 use sp_std::{vec, vec::Vec};
-use xcm::v1::{BodyId, Junction::*, Junctions::*, MultiLocation};
+use xcm::v1::{Junction::*, Junctions::*, MultiLocation};
 use xcm_builder::{
-	AllowKnownQueryResponses, AllowSubscriptionsFrom, AllowUnpaidExecutionFrom, TakeWeightCredit,
+	AllowKnownQueryResponses, AllowSubscriptionsFrom, TakeWeightCredit,
 	AllowTopLevelPaidExecutionFrom,
 };
 
@@ -31,10 +31,6 @@
 };
 
 match_types! {
-	pub type ParentOrParentsExecutivePlurality: impl Contains<MultiLocation> = {
-		MultiLocation { parents: 1, interior: Here } |
-		MultiLocation { parents: 1, interior: X1(Plurality { id: BodyId::Executive, .. }) }
-	};
 	pub type ParentOrSiblings: impl Contains<MultiLocation> = {
 		MultiLocation { parents: 1, interior: Here } |
 		MultiLocation { parents: 1, interior: X1(_) }
@@ -79,8 +75,6 @@
 	(
 		TakeWeightCredit,
 		AllowTopLevelPaidExecutionFrom<Everything>,
-		// Parent and its exec plurality get free execution
-		AllowUnpaidExecutionFrom<ParentOrParentsExecutivePlurality>,
 		// Expected responses are OK.
 		AllowKnownQueryResponses<PolkadotXcm>,
 		// Subscriptions for version tracking are OK.
modifiedruntime/unique/src/xcm_barrier.rsdiffbeforeafterboth
--- a/runtime/unique/src/xcm_barrier.rs
+++ b/runtime/unique/src/xcm_barrier.rs
@@ -19,9 +19,9 @@
 	traits::{Get, Everything},
 };
 use sp_std::{vec, vec::Vec};
-use xcm::v1::{BodyId, Junction::*, Junctions::*, MultiLocation};
+use xcm::v1::{Junction::*, Junctions::*, MultiLocation};
 use xcm_builder::{
-	AllowKnownQueryResponses, AllowSubscriptionsFrom, AllowUnpaidExecutionFrom, TakeWeightCredit,
+	AllowKnownQueryResponses, AllowSubscriptionsFrom, TakeWeightCredit,
 	AllowTopLevelPaidExecutionFrom,
 };
 
@@ -31,10 +31,6 @@
 };
 
 match_types! {
-	pub type ParentOrParentsExecutivePlurality: impl Contains<MultiLocation> = {
-		MultiLocation { parents: 1, interior: Here } |
-		MultiLocation { parents: 1, interior: X1(Plurality { id: BodyId::Executive, .. }) }
-	};
 	pub type ParentOrSiblings: impl Contains<MultiLocation> = {
 		MultiLocation { parents: 1, interior: Here } |
 		MultiLocation { parents: 1, interior: X1(_) }
@@ -79,8 +75,6 @@
 	(
 		TakeWeightCredit,
 		AllowTopLevelPaidExecutionFrom<Everything>,
-		// Parent and its exec plurality get free execution
-		AllowUnpaidExecutionFrom<ParentOrParentsExecutivePlurality>,
 		// Expected responses are OK.
 		AllowKnownQueryResponses<PolkadotXcm>,
 		// Subscriptions for version tracking are OK.