difftreelog
fix remove unneeded barrier, add safecallfilter
in: master
4 files changed
runtime/common/config/xcm/mod.rsdiffbeforeafterboth--- a/runtime/common/config/xcm/mod.rs
+++ b/runtime/common/config/xcm/mod.rs
@@ -125,29 +125,6 @@
}
}
-pub struct DenyTransact;
-impl TryPass for DenyTransact {
- fn try_pass<Call>(
- _origin: &MultiLocation,
- message: &mut [Instruction<Call>],
- ) -> Result<(), ()> {
- let transact_inst = message
- .iter()
- .find(|inst| matches![inst, Instruction::Transact { .. }]);
-
- if transact_inst.is_some() {
- log::warn!(
- target: "xcm::barrier",
- "transact XCM rejected"
- );
-
- Err(())
- } else {
- Ok(())
- }
- }
-}
-
/// Deny executing the XCM if it matches any of the Deny filter regardless of anything else.
/// If it passes the Deny, and matches one of the Allow cases then it is let through.
pub struct DenyThenTry<Deny, Allow>(PhantomData<Deny>, PhantomData<Allow>)
@@ -234,7 +211,9 @@
type MessageExporter = ();
type UniversalAliases = Nothing;
type CallDispatcher = RuntimeCall;
- type SafeCallFilter = Nothing; // ? Only non-recursive calls may go here, but do we need this?
+
+ // Deny all XCM Transacts.
+ type SafeCallFilter = Nothing;
}
#[cfg(feature = "runtime-benchmarks")]
runtime/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,
+);
runtime/quartz/src/xcm_barrier.rsdiffbeforeafterboth28use crate::{28use crate::{29 Runtime, ParachainInfo, PolkadotXcm,29 Runtime, ParachainInfo, PolkadotXcm,30 runtime_common::{30 runtime_common::{31 config::xcm::{DenyThenTry, DenyTransact, DenyExchangeWithUnknownLocation},31 config::xcm::{DenyThenTry, DenyExchangeWithUnknownLocation},32 xcm::OverridableAllowedLocations,32 xcm::OverridableAllowedLocations,33 },33 },34};34};76}76}777778pub type Barrier = DenyThenTry<78pub type Barrier = DenyThenTry<79 (80 DenyTransact,81 DenyExchangeWithUnknownLocation<79 DenyExchangeWithUnknownLocation<82 OverridableAllowedLocations<Runtime, QuartzDefaultAllowedLocations>,80 OverridableAllowedLocations<Runtime, QuartzDefaultAllowedLocations>,83 >,81 >,84 ),85 (82 (86 TakeWeightCredit,83 TakeWeightCredit,87 AllowTopLevelPaidExecutionFrom<Everything>,84 AllowTopLevelPaidExecutionFrom<Everything>,runtime/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>,