Skip to content

Commit

Permalink
reimplement AllowSiblingParachains
Browse files Browse the repository at this point in the history
  • Loading branch information
TarekkMA committed Feb 19, 2025
1 parent 8041682 commit 518ccc4
Show file tree
Hide file tree
Showing 11 changed files with 17 additions and 160 deletions.
142 changes: 0 additions & 142 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,6 @@ xcm = { package = "staging-xcm", git = "https://github.com/moonbeam-foundation/p
xcm-builder = { package = "staging-xcm-builder", git = "https://github.com/moonbeam-foundation/polkadot-sdk", branch = "moonbeam-polkadot-stable2409", default-features = false }
xcm-executor = { package = "staging-xcm-executor", git = "https://github.com/moonbeam-foundation/polkadot-sdk", branch = "moonbeam-polkadot-stable2409", default-features = false }
xcm-runtime-apis = { git = "https://github.com/moonbeam-foundation/polkadot-sdk", branch = "moonbeam-polkadot-stable2409", default-features = false }
snowbridge-core = { git = "https://github.com/moonbeam-foundation/polkadot-sdk", branch = "moonbeam-polkadot-stable2409", default-features = false }

# Polkadot / XCM (client)
#kusama-runtime = { package = "staging-kusama-runtime", git = "https://github.com/moonbeam-foundation/polkadot-sdk", branch = "moonbeam-polkadot-stable2409" }
Expand Down
2 changes: 0 additions & 2 deletions pallets/moonbeam-foreign-assets/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ pallet-ethereum = { workspace = true, features = ["forbid-evm-reentrancy"] }
# Polkadot
xcm = { workspace = true }
xcm-executor = { workspace = true }
snowbridge-core = { workspace = true }

# Benchmarks
frame-benchmarking = { workspace = true, optional = true }
Expand Down Expand Up @@ -58,7 +57,6 @@ std = [
"sp-std/std",
"xcm/std",
"xcm-executor/std",
"snowbridge-core/std"
]

runtime-benchmarks = ["frame-benchmarking"]
Expand Down
1 change: 1 addition & 0 deletions runtime/common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,4 @@ mod impl_xcm_evm_runner;
pub mod migrations;
pub mod timestamp;
pub mod types;
pub mod xcm_origins;
10 changes: 10 additions & 0 deletions runtime/common/src/xcm_origins.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
use frame_support::traits::Contains;
use xcm::latest::Location;
use xcm::prelude::Parachain;

pub struct AllowSiblingParachains;
impl Contains<Location> for AllowSiblingParachains {
fn contains(location: &Location) -> bool {
matches!(location.unpack(), (1, [Parachain(_)]))
}
}
3 changes: 0 additions & 3 deletions runtime/moonbase/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ moonbeam-relay-encoder = { workspace = true }
moonbeam-runtime-common = { workspace = true }
session-keys-primitives = { workspace = true }
xcm-primitives = { workspace = true }
snowbridge-core = { workspace = true}

# Moonbeam pallets
moonbeam-xcm-benchmarks = { workspace = true }
Expand Down Expand Up @@ -325,7 +324,6 @@ std = [
"xcm-runtime-apis/std",
"xcm-primitives/std",
"xcm/std",
"snowbridge-core/std"
]

# Must be enabled for tracing runtimes only
Expand Down Expand Up @@ -406,7 +404,6 @@ runtime-benchmarks = [
"sp-runtime/runtime-benchmarks",
"xcm-builder/runtime-benchmarks",
"xcm-runtime-apis/runtime-benchmarks",
"snowbridge-core/runtime-benchmarks",
]

try-runtime = [
Expand Down
4 changes: 2 additions & 2 deletions runtime/moonbase/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ use xcm_primitives::{

use crate::governance::referenda::{FastGeneralAdminOrRoot, GeneralAdminOrRoot};
use crate::runtime_params::dynamic_params;
use moonbeam_runtime_common::xcm_origins::AllowSiblingParachains;
use pallet_moonbeam_foreign_assets::{MapSuccessToGovernance, MapSuccessToXcm};
use parity_scale_codec::{Decode, Encode};
use scale_info::TypeInfo;
use snowbridge_core::AllowSiblingsOnly;
use sp_core::Get;
use sp_std::{
convert::{From, Into, TryFrom},
Expand Down Expand Up @@ -699,7 +699,7 @@ impl frame_support::traits::Contains<AssetId> for EvmForeignAssetIdFilter {
}

pub type ForeignAssetManagerOrigin = EitherOf<
MapSuccessToXcm<EnsureXcm<AllowSiblingsOnly>>,
MapSuccessToXcm<EnsureXcm<AllowSiblingParachains>>,
MapSuccessToGovernance<
EitherOf<
EnsureRoot<AccountId>,
Expand Down
3 changes: 0 additions & 3 deletions runtime/moonbeam/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ moonbeam-relay-encoder = { workspace = true }
moonbeam-runtime-common = { workspace = true }
session-keys-primitives = { workspace = true }
xcm-primitives = { workspace = true }
snowbridge-core = { workspace = true }

# Moonbeam pallets
moonbeam-xcm-benchmarks = { workspace = true }
Expand Down Expand Up @@ -319,7 +318,6 @@ std = [
"xcm-runtime-apis/std",
"xcm-primitives/std",
"xcm/std",
"snowbridge-core/std"
]
evm-tracing = ["evm-tracing-events", "moonbeam-evm-tracer", "rlp", "sha3"]

Expand Down Expand Up @@ -395,7 +393,6 @@ runtime-benchmarks = [
"sp-runtime/runtime-benchmarks",
"xcm-builder/runtime-benchmarks",
"xcm-runtime-apis/runtime-benchmarks",
"snowbridge-core/runtime-benchmarks",
]

try-runtime = [
Expand Down
4 changes: 2 additions & 2 deletions runtime/moonbeam/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@ use xcm_primitives::{

use crate::governance::referenda::{FastGeneralAdminOrRoot, GeneralAdminOrRoot};
use crate::runtime_params::dynamic_params;
use moonbeam_runtime_common::xcm_origins::AllowSiblingParachains;
use pallet_moonbeam_foreign_assets::{MapSuccessToGovernance, MapSuccessToXcm};
use parity_scale_codec::{Decode, Encode};
use scale_info::TypeInfo;
use snowbridge_core::AllowSiblingsOnly;
use sp_core::Get;
use sp_std::{
convert::{From, Into, TryFrom},
Expand Down Expand Up @@ -684,7 +684,7 @@ impl frame_support::traits::Contains<AssetId> for EvmForeignAssetIdFilter {
}

pub type ForeignAssetManagerOrigin = EitherOf<
MapSuccessToXcm<EnsureXcm<AllowSiblingsOnly>>,
MapSuccessToXcm<EnsureXcm<AllowSiblingParachains>>,
MapSuccessToGovernance<
EitherOf<
EnsureRoot<AccountId>,
Expand Down
3 changes: 0 additions & 3 deletions runtime/moonriver/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ moonbeam-relay-encoder = { workspace = true }
moonbeam-runtime-common = { workspace = true }
session-keys-primitives = { workspace = true }
xcm-primitives = { workspace = true }
snowbridge-core = { workspace = true}

# Moonbeam pallets
moonbeam-xcm-benchmarks = { workspace = true }
Expand Down Expand Up @@ -319,7 +318,6 @@ std = [
"xcm-runtime-apis/std",
"xcm-primitives/std",
"xcm/std",
"snowbridge-core/std",
]

# Must be enabled for tracing runtimes only
Expand Down Expand Up @@ -400,7 +398,6 @@ runtime-benchmarks = [
"sp-runtime/runtime-benchmarks",
"xcm-builder/runtime-benchmarks",
"xcm-runtime-apis/runtime-benchmarks",
"snowbridge-core/runtime-benchmarks",
]
try-runtime = [
"cumulus-pallet-parachain-system/try-runtime",
Expand Down
4 changes: 2 additions & 2 deletions runtime/moonriver/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@ use xcm_primitives::{

use crate::governance::referenda::{FastGeneralAdminOrRoot, GeneralAdminOrRoot};
use crate::runtime_params::dynamic_params;
use moonbeam_runtime_common::xcm_origins::AllowSiblingParachains;
use pallet_moonbeam_foreign_assets::{MapSuccessToGovernance, MapSuccessToXcm};
use parity_scale_codec::{Decode, Encode};
use scale_info::TypeInfo;
use snowbridge_core::AllowSiblingsOnly;
use sp_core::Get;
use sp_std::{
convert::{From, Into, TryFrom},
Expand Down Expand Up @@ -697,7 +697,7 @@ impl frame_support::traits::Contains<AssetId> for EvmForeignAssetIdFilter {
}

pub type ForeignAssetManagerOrigin = EitherOf<
MapSuccessToXcm<EnsureXcm<AllowSiblingsOnly>>,
MapSuccessToXcm<EnsureXcm<AllowSiblingParachains>>,
MapSuccessToGovernance<
EitherOf<
EnsureRoot<AccountId>,
Expand Down

0 comments on commit 518ccc4

Please sign in to comment.