diff --git a/Cargo.lock b/Cargo.lock index 8addd6520..62e192956 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -10084,7 +10084,7 @@ dependencies = [ [[package]] name = "runtime-integration-tests" -version = "1.8.0" +version = "1.8.1" dependencies = [ "cumulus-pallet-aura-ext", "cumulus-pallet-dmp-queue", diff --git a/integration-tests/Cargo.toml b/integration-tests/Cargo.toml index 6906a5e87..99e769eac 100644 --- a/integration-tests/Cargo.toml +++ b/integration-tests/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "runtime-integration-tests" -version = "1.8.0" +version = "1.8.1" description = "Integration tests" authors = ["GalacticCouncil"] edition = "2021" diff --git a/integration-tests/src/cross_chain_transfer.rs b/integration-tests/src/cross_chain_transfer.rs index 2467825a6..3bc596437 100644 --- a/integration-tests/src/cross_chain_transfer.rs +++ b/integration-tests/src/cross_chain_transfer.rs @@ -427,3 +427,27 @@ fn claim_asset(asset: MultiAsset, recipient: [u8; 32]) { )); }); } + +#[test] +fn polkadot_xcm_execute_extrinsic_should_not_be_allowed() { + TestNet::reset(); + + Hydra::execute_with(|| { + let message = VersionedXcm::V3(Xcm(vec![ + WithdrawAsset((Here, 410000000000u128).into()), + BuyExecution { + fees: (Here, 400000000000u128).into(), + weight_limit: Unlimited, + }, + ])); + + assert_noop!( + hydradx_runtime::PolkadotXcm::execute( + hydradx_runtime::RuntimeOrigin::signed(ALICE.into()), + Box::new(message), + Weight::from_ref_time(400_000_000_000) + ), + pallet_xcm::Error::::Filtered + ); + }); +} diff --git a/runtime/hydradx/src/xcm.rs b/runtime/hydradx/src/xcm.rs index 9669b5ad9..214020646 100644 --- a/runtime/hydradx/src/xcm.rs +++ b/runtime/hydradx/src/xcm.rs @@ -24,7 +24,7 @@ use xcm_builder::{ AccountId32Aliases, AllowKnownQueryResponses, AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom, EnsureXcmOrigin, FixedWeightBounds, ParentIsPreset, RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia, SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, - TakeWeightCredit, + TakeWeightCredit, WithComputedOrigin, }; use xcm_executor::{Config, XcmExecutor}; @@ -35,11 +35,18 @@ pub type LocalOriginToLocation = SignedToAccountId32, // Expected responses are OK. AllowKnownQueryResponses, - // Subscriptions for version tracking are OK. - AllowSubscriptionsFrom, + // Evaluate the barriers with the effective origin + WithComputedOrigin< + ( + AllowTopLevelPaidExecutionFrom, + // Subscriptions for version tracking are OK. + AllowSubscriptionsFrom, + ), + UniversalLocation, + ConstU32<8>, + >, ); parameter_types! { @@ -197,7 +204,7 @@ impl pallet_xcm::Config for Runtime { type SendXcmOrigin = EnsureXcmOrigin; type XcmRouter = XcmRouter; type ExecuteXcmOrigin = EnsureXcmOrigin; - type XcmExecuteFilter = Everything; + type XcmExecuteFilter = Nothing; type XcmExecutor = XcmExecutor; type XcmTeleportFilter = Nothing; type XcmReserveTransferFilter = Everything;