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

difftreelog

fix remove unneeded barrier, add safecallfilter

Daniel Shiposha2023-03-22parent: #4253705.patch.diff
in: master

4 files changed

modifiedruntime/common/config/xcm/mod.rsdiffbeforeafterboth
125 }125 }
126}126}
127
128pub struct DenyTransact;
129impl TryPass for DenyTransact {
130 fn try_pass<Call>(
131 _origin: &MultiLocation,
132 message: &mut [Instruction<Call>],
133 ) -> Result<(), ()> {
134 let transact_inst = message
135 .iter()
136 .find(|inst| matches![inst, Instruction::Transact { .. }]);
137
138 if transact_inst.is_some() {
139 log::warn!(
140 target: "xcm::barrier",
141 "transact XCM rejected"
142 );
143
144 Err(())
145 } else {
146 Ok(())
147 }
148 }
149}
150127
151/// Deny executing the XCM if it matches any of the Deny filter regardless of anything else.128/// Deny executing the XCM if it matches any of the Deny filter regardless of anything else.
152/// If it passes the Deny, and matches one of the Allow cases then it is let through.129/// If it passes the Deny, and matches one of the Allow cases then it is let through.
235 type UniversalAliases = Nothing;212 type UniversalAliases = Nothing;
236 type CallDispatcher = RuntimeCall;213 type CallDispatcher = RuntimeCall;
214
215 // Deny all XCM Transacts.
237 type SafeCallFilter = Nothing; // ? Only non-recursive calls may go here, but do we need this?216 type SafeCallFilter = Nothing;
238}217}
239218
240#[cfg(feature = "runtime-benchmarks")]219#[cfg(feature = "runtime-benchmarks")]
modifiedruntime/opal/src/xcm_barrier.rsdiffbeforeafterboth
--- a/runtime/opal/src/xcm_barrier.rs
+++ b/runtime/opal/src/xcm_barrier.rs
@@ -20,8 +20,6 @@
 use xcm_builder::{AllowTopLevelPaidExecutionFrom, TakeWeightCredit};
 use xcm_executor::traits::ShouldExecute;
 
-use crate::runtime_common::config::xcm::{DenyThenTry, DenyTransact};
-
 /// Execution barrier that just takes `max_weight` from `weight_credit`.
 ///
 /// Useful to allow XCM execution by local chain users via extrinsics.
@@ -39,11 +37,8 @@
 	}
 }
 
-pub type Barrier = DenyThenTry<
-	DenyTransact,
-	(
-		TakeWeightCredit,
-		AllowTopLevelPaidExecutionFrom<Everything>,
-		AllowAllDebug,
-	),
->;
+pub type Barrier = (
+	TakeWeightCredit,
+	AllowTopLevelPaidExecutionFrom<Everything>,
+	AllowAllDebug,
+);
modifiedruntime/quartz/src/xcm_barrier.rsdiffbeforeafterboth
--- a/runtime/quartz/src/xcm_barrier.rs
+++ b/runtime/quartz/src/xcm_barrier.rs
@@ -28,7 +28,7 @@
 use crate::{
 	Runtime, ParachainInfo, PolkadotXcm,
 	runtime_common::{
-		config::xcm::{DenyThenTry, DenyTransact, DenyExchangeWithUnknownLocation},
+		config::xcm::{DenyThenTry, DenyExchangeWithUnknownLocation},
 		xcm::OverridableAllowedLocations,
 	},
 };
@@ -76,12 +76,9 @@
 }
 
 pub type Barrier = DenyThenTry<
-	(
-		DenyTransact,
-		DenyExchangeWithUnknownLocation<
-			OverridableAllowedLocations<Runtime, QuartzDefaultAllowedLocations>,
-		>,
-	),
+	DenyExchangeWithUnknownLocation<
+		OverridableAllowedLocations<Runtime, QuartzDefaultAllowedLocations>,
+	>,
 	(
 		TakeWeightCredit,
 		AllowTopLevelPaidExecutionFrom<Everything>,
modifiedruntime/unique/src/xcm_barrier.rsdiffbeforeafterboth
--- a/runtime/unique/src/xcm_barrier.rs
+++ b/runtime/unique/src/xcm_barrier.rs
@@ -28,7 +28,7 @@
 use crate::{
 	Runtime, ParachainInfo, PolkadotXcm,
 	runtime_common::{
-		config::xcm::{DenyThenTry, DenyTransact, DenyExchangeWithUnknownLocation},
+		config::xcm::{DenyThenTry, DenyExchangeWithUnknownLocation},
 		xcm::OverridableAllowedLocations,
 	},
 };
@@ -76,12 +76,9 @@
 }
 
 pub type Barrier = DenyThenTry<
-	(
-		DenyTransact,
-		DenyExchangeWithUnknownLocation<
-			OverridableAllowedLocations<Runtime, UniqueDefaultAllowedLocations>,
-		>,
-	),
+	DenyExchangeWithUnknownLocation<
+		OverridableAllowedLocations<Runtime, UniqueDefaultAllowedLocations>,
+	>,
 	(
 		TakeWeightCredit,
 		AllowTopLevelPaidExecutionFrom<Everything>,