Skip to content

Commit

Permalink
WIP relax xcm send filter
Browse files Browse the repository at this point in the history
  • Loading branch information
acatangiu committed Jul 24, 2024
1 parent c61e836 commit 0daf834
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion relay/kusama/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ pub type LocalPalletOrSignedOriginToLocation = (

impl pallet_xcm::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
// This is basically safe to enable for everyone (safe the possibility of someone spamming the
// This is basically safe to enable for everyone (save the possibility of someone spamming the
// parachain if they're willing to pay the KSM to send from the Relay-chain).
type SendXcmOrigin =
xcm_builder::EnsureXcmOrigin<RuntimeOrigin, LocalPalletOrSignedOriginToLocation>;
Expand Down
11 changes: 7 additions & 4 deletions relay/polkadot/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,8 @@ impl Contains<Location> for CollectivesOrFellows {
fn contains(loc: &Location) -> bool {
matches!(
loc.unpack(),
(0, [Parachain(COLLECTIVES_ID)]) |
(0, [Parachain(COLLECTIVES_ID), Plurality { id: BodyId::Technical, .. }])
(0, [Parachain(COLLECTIVES_ID)])
| (0, [Parachain(COLLECTIVES_ID), Plurality { id: BodyId::Technical, .. }])
)
}
}
Expand Down Expand Up @@ -281,7 +281,7 @@ pub type TreasurerToPlurality = OriginToPluralityVoice<RuntimeOrigin, Treasurer,

/// Type to convert a pallet `Origin` type value into a `Location` value which represents an
/// interior location of this chain for a destination chain.
pub type LocalPalletOriginToLocation = (
pub type LocalPalletOrSignedOriginToLocation = (
// GeneralAdmin origin to be used in XCM as a corresponding Plurality `Location` value.
GeneralAdminToPlurality,
// StakingAdmin origin to be used in XCM as a corresponding Plurality `Location` value.
Expand All @@ -290,13 +290,16 @@ pub type LocalPalletOriginToLocation = (
FellowshipAdminToPlurality,
// `Treasurer` origin to be used in XCM as a corresponding Plurality `Location` value.
TreasurerToPlurality,
// And a usual Signed origin to be used in XCM as a corresponding AccountId32
SignedToAccountId32<RuntimeOrigin, AccountId, ThisNetwork>,
);

impl pallet_xcm::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
// We only allow the root, the general admin, the fellowship admin and the staking admin to send
// messages.
type SendXcmOrigin = xcm_builder::EnsureXcmOrigin<RuntimeOrigin, LocalPalletOriginToLocation>;
type SendXcmOrigin =
xcm_builder::EnsureXcmOrigin<RuntimeOrigin, LocalPalletOrSignedOriginToLocation>;
type XcmRouter = XcmRouter;
// Anyone can execute XCM messages locally.
type ExecuteXcmOrigin = xcm_builder::EnsureXcmOrigin<RuntimeOrigin, LocalOriginToLocation>;
Expand Down

0 comments on commit 0daf834

Please sign in to comment.