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.rsdiffbeforeafterboth20use xcm_builder::{AllowTopLevelPaidExecutionFrom, TakeWeightCredit};20use xcm_builder::{AllowTopLevelPaidExecutionFrom, TakeWeightCredit};21use xcm_executor::traits::ShouldExecute;21use xcm_executor::traits::ShouldExecute;2223use crate::runtime_common::config::xcm::{DenyThenTry, DenyTransact};242225/// Execution barrier that just takes `max_weight` from `weight_credit`.23/// Execution barrier that just takes `max_weight` from `weight_credit`.26///24///39 }37 }40}38}413942pub type Barrier = DenyThenTry<40pub type Barrier = (43 DenyTransact,44 (45 TakeWeightCredit,41 TakeWeightCredit,46 AllowTopLevelPaidExecutionFrom<Everything>,42 AllowTopLevelPaidExecutionFrom<Everything>,47 AllowAllDebug,43 AllowAllDebug,48 ),44);49>;5045runtime/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>,
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>,