Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve XCM Config #131

Merged
merged 6 commits into from
Aug 30, 2022
Merged
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions polkadot-parachains/integritee-runtime/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ use core::marker::PhantomData;
use frame_support::{
pallet_prelude::Get,
parameter_types,
traits::Everything,
traits::{Everything, Nothing},
weights::{IdentityFee, Weight},
RuntimeDebug,
};
Expand Down Expand Up @@ -264,13 +264,13 @@ pub type LocalOriginToLocation = SignedToAccountId32<Origin, AccountId, RelayNet
// See acala and moonbeam example : https://github.com/integritee-network/parachain/issues/103
impl pallet_xcm::Config for Runtime {
type Event = Event;
type SendXcmOrigin = EnsureXcmOrigin<Origin, LocalOriginToLocation>;
type SendXcmOrigin = EnsureXcmOrigin<Origin, ()>; // Prohibit sending arbitrary XCMs from users of this chain
type XcmRouter = XcmRouter;
type ExecuteXcmOrigin = EnsureXcmOrigin<Origin, LocalOriginToLocation>;
type XcmExecuteFilter = Everything;
type ExecuteXcmOrigin = EnsureXcmOrigin<Origin, LocalOriginToLocation>; // Allow any local origin in XCM execution.
type XcmExecuteFilter = Nothing; // Disable generic XCM execution. This does not affect Teleport or Reserve Transfer.
Comment on lines +269 to +270
Copy link
Contributor

@clangenb clangenb Aug 30, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just for my understanding, is the combination of these two lines exactly the same as?

type ExecuteXcmOrigin = EnsureXcmOrigin<Origin, ()>; // Allow any local origin in XCM execution.
                                               //^^^ changed the line here
type XcmExecuteFilter = Nothing; // Disable generic XCM execution. This does not affect Teleport or Reserve Transfer.

Or would this also disable Teleport and Reserve Transfer then?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From https://github.com/paritytech/polkadot/blob/99d6b557c0594a35198be84d03833e5af692d109/xcm/pallet-xcm/src/lib.rs#L86 , i think it would also disable Teleport and Transfer for users of this chain. ExecuteXcmOrigin is called in execute, do_reserve_transfer_assets and do_teleport_assets.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I see. Thanks!

type XcmExecutor = XcmExecutor<XcmConfig>;
type XcmTeleportFilter = Everything;
type XcmReserveTransferFilter = Everything;
type XcmTeleportFilter = Nothing; // Do not allow teleports
type XcmReserveTransferFilter = Everything; // Transfer are allowed
type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>;
type LocationInverter = LocationInverter<Ancestry>;
type Origin = Origin;
Expand Down