difftreelog
refactor rename local xcm_config to xcm_barrier
in: master
11 files changed
runtime/common/config/xcm/mod.rsdiffbeforeafterboth--- a/runtime/common/config/xcm/mod.rs
+++ b/runtime/common/config/xcm/mod.rs
@@ -33,7 +33,7 @@
use sp_std::{marker::PhantomData, vec::Vec};
use crate::{
Runtime, Call, Event, Origin, ParachainInfo, ParachainSystem, PolkadotXcm, XcmpQueue,
- xcm_config::Barrier,
+ xcm_barrier::Barrier,
};
use up_common::types::AccountId;
runtime/opal/src/lib.rsdiffbeforeafterboth35#[path = "../../common/mod.rs"]35#[path = "../../common/mod.rs"]36mod runtime_common;36mod runtime_common;373738pub mod xcm_config;38pub mod xcm_barrier;393940#[cfg(test)]40#[cfg(test)]41mod tests;41mod tests;runtime/opal/src/tests/xcm.rsdiffbeforeafterboth--- a/runtime/opal/src/tests/xcm.rs
+++ b/runtime/opal/src/tests/xcm.rs
@@ -15,7 +15,7 @@
// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
use logtest::Logger;
-use crate::{runtime_common::tests::xcm::*, xcm_config::Barrier};
+use crate::{runtime_common::tests::xcm::*, xcm_barrier::Barrier};
const OPAL_PARA_ID: u32 = 2095; // Same as Quartz
runtime/opal/src/xcm_barrier.rsdiffbeforeafterboth--- /dev/null
+++ b/runtime/opal/src/xcm_barrier.rs
@@ -0,0 +1,63 @@
+// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.
+// This file is part of Unique Network.
+
+// Unique Network is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// Unique Network is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
+
+use frame_support::{
+ {match_types, weights::Weight},
+ traits::Everything,
+};
+use xcm::{
+ latest::Xcm,
+ v1::{BodyId, Junction::*, Junctions::*, MultiLocation},
+};
+use xcm_builder::{AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom, TakeWeightCredit};
+use xcm_executor::traits::ShouldExecute;
+
+use crate::runtime_common::config::xcm::{DenyThenTry, DenyTransact};
+
+match_types! {
+ pub type ParentOrParentsUnitPlurality: impl Contains<MultiLocation> = {
+ MultiLocation { parents: 1, interior: Here } |
+ MultiLocation { parents: 1, interior: X1(Plurality { id: BodyId::Unit, .. }) }
+ };
+}
+
+/// Execution barrier that just takes `max_weight` from `weight_credit`.
+///
+/// Useful to allow XCM execution by local chain users via extrinsics.
+/// E.g. `pallet_xcm::reserve_asset_transfer` to transfer a reserve asset
+/// out of the local chain to another one.
+pub struct AllowAllDebug;
+impl ShouldExecute for AllowAllDebug {
+ fn should_execute<Call>(
+ _origin: &MultiLocation,
+ _message: &mut Xcm<Call>,
+ _max_weight: Weight,
+ _weight_credit: &mut Weight,
+ ) -> Result<(), ()> {
+ Ok(())
+ }
+}
+
+pub type Barrier = DenyThenTry<
+ DenyTransact,
+ (
+ TakeWeightCredit,
+ AllowTopLevelPaidExecutionFrom<Everything>,
+ AllowUnpaidExecutionFrom<ParentOrParentsUnitPlurality>,
+ // ^^^ Parent & its unit plurality gets free execution
+ AllowAllDebug,
+ ),
+>;
runtime/opal/src/xcm_config.rsdiffbeforeafterboth--- a/runtime/opal/src/xcm_config.rs
+++ /dev/null
@@ -1,63 +0,0 @@
-// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.
-// This file is part of Unique Network.
-
-// Unique Network is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-
-// Unique Network is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License
-// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
-
-use frame_support::{
- {match_types, weights::Weight},
- traits::Everything,
-};
-use xcm::{
- latest::Xcm,
- v1::{BodyId, Junction::*, Junctions::*, MultiLocation},
-};
-use xcm_builder::{AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom, TakeWeightCredit};
-use xcm_executor::traits::ShouldExecute;
-
-use crate::runtime_common::config::xcm::{DenyThenTry, DenyTransact};
-
-match_types! {
- pub type ParentOrParentsUnitPlurality: impl Contains<MultiLocation> = {
- MultiLocation { parents: 1, interior: Here } |
- MultiLocation { parents: 1, interior: X1(Plurality { id: BodyId::Unit, .. }) }
- };
-}
-
-/// Execution barrier that just takes `max_weight` from `weight_credit`.
-///
-/// Useful to allow XCM execution by local chain users via extrinsics.
-/// E.g. `pallet_xcm::reserve_asset_transfer` to transfer a reserve asset
-/// out of the local chain to another one.
-pub struct AllowAllDebug;
-impl ShouldExecute for AllowAllDebug {
- fn should_execute<Call>(
- _origin: &MultiLocation,
- _message: &mut Xcm<Call>,
- _max_weight: Weight,
- _weight_credit: &mut Weight,
- ) -> Result<(), ()> {
- Ok(())
- }
-}
-
-pub type Barrier = DenyThenTry<
- DenyTransact,
- (
- TakeWeightCredit,
- AllowTopLevelPaidExecutionFrom<Everything>,
- AllowUnpaidExecutionFrom<ParentOrParentsUnitPlurality>,
- // ^^^ Parent & its unit plurality gets free execution
- AllowAllDebug,
- ),
->;
runtime/quartz/src/lib.rsdiffbeforeafterboth--- a/runtime/quartz/src/lib.rs
+++ b/runtime/quartz/src/lib.rs
@@ -35,7 +35,7 @@
#[path = "../../common/mod.rs"]
mod runtime_common;
-pub mod xcm_config;
+pub mod xcm_barrier;
#[cfg(test)]
mod tests;
runtime/quartz/src/xcm_barrier.rsdiffbeforeafterboth--- /dev/null
+++ b/runtime/quartz/src/xcm_barrier.rs
@@ -0,0 +1,84 @@
+// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.
+// This file is part of Unique Network.
+
+// Unique Network is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// Unique Network is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
+
+use frame_support::{match_types, parameter_types, traits::Get};
+use sp_std::{vec, vec::Vec};
+use xcm::v1::{BodyId, Junction::*, Junctions::*, MultiLocation};
+use xcm_builder::{
+ AllowKnownQueryResponses, AllowSubscriptionsFrom, AllowUnpaidExecutionFrom, TakeWeightCredit,
+};
+
+use crate::{
+ ParachainInfo, PolkadotXcm,
+ runtime_common::config::xcm::{DenyThenTry, DenyTransact, DenyExchangeWithUnknownLocation},
+};
+
+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(_) }
+ };
+}
+
+parameter_types! {
+ pub QuartzAllowedLocations: Vec<MultiLocation> = vec![
+ // Self location
+ MultiLocation {
+ parents: 0,
+ interior: Here,
+ },
+ // Parent location
+ MultiLocation {
+ parents: 1,
+ interior: Here,
+ },
+ // Karura/Acala location
+ MultiLocation {
+ parents: 1,
+ interior: X1(Parachain(2000)),
+ },
+ // Moonriver location
+ MultiLocation {
+ parents: 1,
+ interior: X1(Parachain(2023)),
+ },
+ // Self parachain address
+ MultiLocation {
+ parents: 1,
+ interior: X1(Parachain(ParachainInfo::get().into())),
+ },
+ ];
+}
+
+pub type Barrier = DenyThenTry<
+ (
+ DenyTransact,
+ DenyExchangeWithUnknownLocation<QuartzAllowedLocations>,
+ ),
+ (
+ TakeWeightCredit,
+ // Parent and its exec plurality get free execution
+ AllowUnpaidExecutionFrom<ParentOrParentsExecutivePlurality>,
+ // Expected responses are OK.
+ AllowKnownQueryResponses<PolkadotXcm>,
+ // Subscriptions for version tracking are OK.
+ AllowSubscriptionsFrom<ParentOrSiblings>,
+ ),
+>;
runtime/quartz/src/xcm_config.rsdiffbeforeafterboth--- a/runtime/quartz/src/xcm_config.rs
+++ /dev/null
@@ -1,84 +0,0 @@
-// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.
-// This file is part of Unique Network.
-
-// Unique Network is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-
-// Unique Network is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License
-// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
-
-use frame_support::{match_types, parameter_types, traits::Get};
-use sp_std::{vec, vec::Vec};
-use xcm::v1::{BodyId, Junction::*, Junctions::*, MultiLocation};
-use xcm_builder::{
- AllowKnownQueryResponses, AllowSubscriptionsFrom, AllowUnpaidExecutionFrom, TakeWeightCredit,
-};
-
-use crate::{
- ParachainInfo, PolkadotXcm,
- runtime_common::config::xcm::{DenyThenTry, DenyTransact, DenyExchangeWithUnknownLocation},
-};
-
-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(_) }
- };
-}
-
-parameter_types! {
- pub QuartzAllowedLocations: Vec<MultiLocation> = vec![
- // Self location
- MultiLocation {
- parents: 0,
- interior: Here,
- },
- // Parent location
- MultiLocation {
- parents: 1,
- interior: Here,
- },
- // Karura/Acala location
- MultiLocation {
- parents: 1,
- interior: X1(Parachain(2000)),
- },
- // Moonriver location
- MultiLocation {
- parents: 1,
- interior: X1(Parachain(2023)),
- },
- // Self parachain address
- MultiLocation {
- parents: 1,
- interior: X1(Parachain(ParachainInfo::get().into())),
- },
- ];
-}
-
-pub type Barrier = DenyThenTry<
- (
- DenyTransact,
- DenyExchangeWithUnknownLocation<QuartzAllowedLocations>,
- ),
- (
- TakeWeightCredit,
- // Parent and its exec plurality get free execution
- AllowUnpaidExecutionFrom<ParentOrParentsExecutivePlurality>,
- // Expected responses are OK.
- AllowKnownQueryResponses<PolkadotXcm>,
- // Subscriptions for version tracking are OK.
- AllowSubscriptionsFrom<ParentOrSiblings>,
- ),
->;
runtime/unique/src/lib.rsdiffbeforeafterboth--- a/runtime/unique/src/lib.rs
+++ b/runtime/unique/src/lib.rs
@@ -35,7 +35,7 @@
#[path = "../../common/mod.rs"]
mod runtime_common;
-pub mod xcm_config;
+pub mod xcm_barrier;
#[cfg(test)]
mod tests;
runtime/unique/src/xcm_barrier.rsdiffbeforeafterboth--- /dev/null
+++ b/runtime/unique/src/xcm_barrier.rs
@@ -0,0 +1,84 @@
+// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.
+// This file is part of Unique Network.
+
+// Unique Network is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// Unique Network is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
+
+use frame_support::{match_types, parameter_types, traits::Get};
+use sp_std::{vec, vec::Vec};
+use xcm::v1::{BodyId, Junction::*, Junctions::*, MultiLocation};
+use xcm_builder::{
+ AllowKnownQueryResponses, AllowSubscriptionsFrom, AllowUnpaidExecutionFrom, TakeWeightCredit,
+};
+
+use crate::{
+ ParachainInfo, PolkadotXcm,
+ runtime_common::config::xcm::{DenyThenTry, DenyTransact, DenyExchangeWithUnknownLocation},
+};
+
+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(_) }
+ };
+}
+
+parameter_types! {
+ pub UniqueAllowedLocations: Vec<MultiLocation> = vec![
+ // Self location
+ MultiLocation {
+ parents: 0,
+ interior: Here,
+ },
+ // Parent location
+ MultiLocation {
+ parents: 1,
+ interior: Here,
+ },
+ // Karura/Acala location
+ MultiLocation {
+ parents: 1,
+ interior: X1(Parachain(2000)),
+ },
+ // Moonbeam location
+ MultiLocation {
+ parents: 1,
+ interior: X1(Parachain(2004)),
+ },
+ // Self parachain address
+ MultiLocation {
+ parents: 1,
+ interior: X1(Parachain(ParachainInfo::get().into())),
+ },
+ ];
+}
+
+pub type Barrier = DenyThenTry<
+ (
+ DenyTransact,
+ DenyExchangeWithUnknownLocation<UniqueAllowedLocations>,
+ ),
+ (
+ TakeWeightCredit,
+ // Parent and its exec plurality get free execution
+ AllowUnpaidExecutionFrom<ParentOrParentsExecutivePlurality>,
+ // Expected responses are OK.
+ AllowKnownQueryResponses<PolkadotXcm>,
+ // Subscriptions for version tracking are OK.
+ AllowSubscriptionsFrom<ParentOrSiblings>,
+ ),
+>;
runtime/unique/src/xcm_config.rsdiffbeforeafterboth--- a/runtime/unique/src/xcm_config.rs
+++ /dev/null
@@ -1,84 +0,0 @@
-// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.
-// This file is part of Unique Network.
-
-// Unique Network is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-
-// Unique Network is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License
-// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
-
-use frame_support::{match_types, parameter_types, traits::Get};
-use sp_std::{vec, vec::Vec};
-use xcm::v1::{BodyId, Junction::*, Junctions::*, MultiLocation};
-use xcm_builder::{
- AllowKnownQueryResponses, AllowSubscriptionsFrom, AllowUnpaidExecutionFrom, TakeWeightCredit,
-};
-
-use crate::{
- ParachainInfo, PolkadotXcm,
- runtime_common::config::xcm::{DenyThenTry, DenyTransact, DenyExchangeWithUnknownLocation},
-};
-
-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(_) }
- };
-}
-
-parameter_types! {
- pub UniqueAllowedLocations: Vec<MultiLocation> = vec![
- // Self location
- MultiLocation {
- parents: 0,
- interior: Here,
- },
- // Parent location
- MultiLocation {
- parents: 1,
- interior: Here,
- },
- // Karura/Acala location
- MultiLocation {
- parents: 1,
- interior: X1(Parachain(2000)),
- },
- // Moonbeam location
- MultiLocation {
- parents: 1,
- interior: X1(Parachain(2004)),
- },
- // Self parachain address
- MultiLocation {
- parents: 1,
- interior: X1(Parachain(ParachainInfo::get().into())),
- },
- ];
-}
-
-pub type Barrier = DenyThenTry<
- (
- DenyTransact,
- DenyExchangeWithUnknownLocation<UniqueAllowedLocations>,
- ),
- (
- TakeWeightCredit,
- // Parent and its exec plurality get free execution
- AllowUnpaidExecutionFrom<ParentOrParentsExecutivePlurality>,
- // Expected responses are OK.
- AllowKnownQueryResponses<PolkadotXcm>,
- // Subscriptions for version tracking are OK.
- AllowSubscriptionsFrom<ParentOrSiblings>,
- ),
->;