difftreelog
fix remove unneeded barrier, add safecallfilter
in: master
4 files changed
runtime/common/config/xcm/mod.rsdiffbeforeafterboth125 }125 }126}126}127128pub 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 = message135 .iter()136 .find(|inst| matches![inst, Instruction::Transact { .. }]);137138 if transact_inst.is_some() {139 log::warn!(140 target: "xcm::barrier",141 "transact XCM rejected"142 );143144 Err(())145 } else {146 Ok(())147 }148 }149}150127151/// 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;214215 // 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}239218240#[cfg(feature = "runtime-benchmarks")]219#[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.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.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, UniqueDefaultAllowedLocations>,80 OverridableAllowedLocations<Runtime, UniqueDefaultAllowedLocations>,83 >,81 >,84 ),85 (82 (86 TakeWeightCredit,83 TakeWeightCredit,87 AllowTopLevelPaidExecutionFrom<Everything>,84 AllowTopLevelPaidExecutionFrom<Everything>,