From 07cbd4134cb67d6b33b5db02db79986397d7fd93 Mon Sep 17 00:00:00 2001 From: Roznovjak Date: Mon, 3 Jul 2023 09:52:02 +0200 Subject: [PATCH 1/6] update xcm config --- Cargo.lock | 4 ++-- integration-tests/Cargo.toml | 2 +- integration-tests/src/cross_chain_transfer.rs | 24 +++++++++++++++++++ runtime/hydradx/Cargo.toml | 2 +- runtime/hydradx/src/lib.rs | 2 +- runtime/hydradx/src/xcm.rs | 16 +++++++++---- 6 files changed, 40 insertions(+), 10 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1174a47d5..33eb316cd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3838,7 +3838,7 @@ dependencies = [ [[package]] name = "hydradx-runtime" -version = "162.0.0" +version = "163.0.0" dependencies = [ "common-runtime", "cumulus-pallet-aura-ext", @@ -10092,7 +10092,7 @@ dependencies = [ [[package]] name = "runtime-integration-tests" -version = "1.7.16" +version = "1.7.17" dependencies = [ "common-runtime", "cumulus-pallet-aura-ext", diff --git a/integration-tests/Cargo.toml b/integration-tests/Cargo.toml index 3630897f1..45f870919 100644 --- a/integration-tests/Cargo.toml +++ b/integration-tests/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "runtime-integration-tests" -version = "1.7.16" +version = "1.7.17" 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 9a4f72a75..52ca92557 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/Cargo.toml b/runtime/hydradx/Cargo.toml index 7c3778599..454706393 100644 --- a/runtime/hydradx/Cargo.toml +++ b/runtime/hydradx/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "hydradx-runtime" -version = "162.0.0" +version = "163.0.0" authors = ["GalacticCouncil"] edition = "2021" license = "Apache 2.0" diff --git a/runtime/hydradx/src/lib.rs b/runtime/hydradx/src/lib.rs index 8c1d81397..9f23e6935 100644 --- a/runtime/hydradx/src/lib.rs +++ b/runtime/hydradx/src/lib.rs @@ -110,7 +110,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: create_runtime_str!("hydradx"), impl_name: create_runtime_str!("hydradx"), authoring_version: 1, - spec_version: 162, + spec_version: 163, impl_version: 0, apis: RUNTIME_API_VERSIONS, transaction_version: 1, diff --git a/runtime/hydradx/src/xcm.rs b/runtime/hydradx/src/xcm.rs index e329c60cd..8d08ffc38 100644 --- a/runtime/hydradx/src/xcm.rs +++ b/runtime/hydradx/src/xcm.rs @@ -19,7 +19,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}; @@ -27,11 +27,17 @@ pub type LocalOriginToLocation = SignedToAccountId32, // Expected responses are OK. AllowKnownQueryResponses, - // Subscriptions for version tracking are OK. - AllowSubscriptionsFrom, + WithComputedOrigin< + ( + AllowTopLevelPaidExecutionFrom, + // Subscriptions for version tracking are OK. + AllowSubscriptionsFrom, + ), + UniversalLocation, + ConstU32<1>, + >, ); parameter_types! { @@ -185,7 +191,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; From b6c62d7e8f8bb661bca05906b3ab7e20cb5f0bf3 Mon Sep 17 00:00:00 2001 From: Roznovjak Date: Mon, 3 Jul 2023 10:17:08 +0200 Subject: [PATCH 2/6] bump versions --- Cargo.lock | 4 ++-- integration-tests/Cargo.toml | 2 +- runtime/hydradx/Cargo.toml | 2 +- runtime/hydradx/src/lib.rs | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c2d986a7c..c28a52e5b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3799,7 +3799,7 @@ dependencies = [ [[package]] name = "hydradx-runtime" -version = "163.0.0" +version = "164.0.0" dependencies = [ "cumulus-pallet-aura-ext", "cumulus-pallet-dmp-queue", @@ -10054,7 +10054,7 @@ dependencies = [ [[package]] name = "runtime-integration-tests" -version = "1.7.17" +version = "1.7.18" dependencies = [ "cumulus-pallet-aura-ext", "cumulus-pallet-dmp-queue", diff --git a/integration-tests/Cargo.toml b/integration-tests/Cargo.toml index b8617a636..b4b923c67 100644 --- a/integration-tests/Cargo.toml +++ b/integration-tests/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "runtime-integration-tests" -version = "1.7.17" +version = "1.7.18" description = "Integration tests" authors = ["GalacticCouncil"] edition = "2021" diff --git a/runtime/hydradx/Cargo.toml b/runtime/hydradx/Cargo.toml index c4b8e2430..f1b05ef01 100644 --- a/runtime/hydradx/Cargo.toml +++ b/runtime/hydradx/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "hydradx-runtime" -version = "163.0.0" +version = "164.0.0" authors = ["GalacticCouncil"] edition = "2021" license = "Apache 2.0" diff --git a/runtime/hydradx/src/lib.rs b/runtime/hydradx/src/lib.rs index 3d4e43737..ff6c2f9bc 100644 --- a/runtime/hydradx/src/lib.rs +++ b/runtime/hydradx/src/lib.rs @@ -96,7 +96,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: create_runtime_str!("hydradx"), impl_name: create_runtime_str!("hydradx"), authoring_version: 1, - spec_version: 163, + spec_version: 164, impl_version: 0, apis: RUNTIME_API_VERSIONS, transaction_version: 1, From 4fd5fdf3e9cef145d4ebc54b53f713f91ac89e94 Mon Sep 17 00:00:00 2001 From: Roznovjak Date: Mon, 3 Jul 2023 14:18:29 +0200 Subject: [PATCH 3/6] add comment --- runtime/hydradx/src/xcm.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/runtime/hydradx/src/xcm.rs b/runtime/hydradx/src/xcm.rs index 52c76ef55..01d90d33d 100644 --- a/runtime/hydradx/src/xcm.rs +++ b/runtime/hydradx/src/xcm.rs @@ -36,6 +36,7 @@ pub type Barrier = ( TakeWeightCredit, // Expected responses are OK. AllowKnownQueryResponses, + // Evaluate the barriers with the effective origin WithComputedOrigin< ( AllowTopLevelPaidExecutionFrom, From ef3f518873a8619f20eebe7f3f1e34edbeadd231 Mon Sep 17 00:00:00 2001 From: Roznovjak Date: Mon, 3 Jul 2023 17:38:26 +0200 Subject: [PATCH 4/6] bump versions --- Cargo.lock | 4 ++-- integration-tests/Cargo.toml | 2 +- runtime/hydradx/Cargo.toml | 2 +- runtime/hydradx/src/lib.rs | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c93306162..7d1bfb172 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3799,7 +3799,7 @@ dependencies = [ [[package]] name = "hydradx-runtime" -version = "164.0.0" +version = "165.0.0" dependencies = [ "cumulus-pallet-aura-ext", "cumulus-pallet-dmp-queue", @@ -10055,7 +10055,7 @@ dependencies = [ [[package]] name = "runtime-integration-tests" -version = "1.7.18" +version = "1.7.19" dependencies = [ "cumulus-pallet-aura-ext", "cumulus-pallet-dmp-queue", diff --git a/integration-tests/Cargo.toml b/integration-tests/Cargo.toml index 9a4d94a94..45270c051 100644 --- a/integration-tests/Cargo.toml +++ b/integration-tests/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "runtime-integration-tests" -version = "1.7.18" +version = "1.7.19" description = "Integration tests" authors = ["GalacticCouncil"] edition = "2021" diff --git a/runtime/hydradx/Cargo.toml b/runtime/hydradx/Cargo.toml index 33571e44e..3ae0dcd95 100644 --- a/runtime/hydradx/Cargo.toml +++ b/runtime/hydradx/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "hydradx-runtime" -version = "164.0.0" +version = "165.0.0" authors = ["GalacticCouncil"] edition = "2021" license = "Apache 2.0" diff --git a/runtime/hydradx/src/lib.rs b/runtime/hydradx/src/lib.rs index a012dedf4..614c8e3de 100644 --- a/runtime/hydradx/src/lib.rs +++ b/runtime/hydradx/src/lib.rs @@ -96,7 +96,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: create_runtime_str!("hydradx"), impl_name: create_runtime_str!("hydradx"), authoring_version: 1, - spec_version: 164, + spec_version: 165, impl_version: 0, apis: RUNTIME_API_VERSIONS, transaction_version: 1, From c197884481e77663b24fb4a3640269fa7369a051 Mon Sep 17 00:00:00 2001 From: Alexander Popiak Date: Thu, 27 Jul 2023 13:31:35 +0200 Subject: [PATCH 5/6] change computed origin count to 8 --- runtime/hydradx/src/xcm.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/hydradx/src/xcm.rs b/runtime/hydradx/src/xcm.rs index b73c18efc..214020646 100644 --- a/runtime/hydradx/src/xcm.rs +++ b/runtime/hydradx/src/xcm.rs @@ -45,7 +45,7 @@ pub type Barrier = ( AllowSubscriptionsFrom, ), UniversalLocation, - ConstU32<1>, + ConstU32<8>, >, ); From 4227f11eacaf95fb635f87f11f64afec036c86c5 Mon Sep 17 00:00:00 2001 From: Alexander Popiak Date: Thu, 27 Jul 2023 16:35:04 +0200 Subject: [PATCH 6/6] bump runtime version --- Cargo.lock | 2 +- runtime/hydradx/Cargo.toml | 2 +- runtime/hydradx/src/lib.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 004fa0588..b07591fd9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3815,7 +3815,7 @@ dependencies = [ [[package]] name = "hydradx-runtime" -version = "168.0.0" +version = "169.0.0" dependencies = [ "cumulus-pallet-aura-ext", "cumulus-pallet-dmp-queue", diff --git a/runtime/hydradx/Cargo.toml b/runtime/hydradx/Cargo.toml index 00b823e57..c37dfe1ac 100644 --- a/runtime/hydradx/Cargo.toml +++ b/runtime/hydradx/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "hydradx-runtime" -version = "168.0.0" +version = "169.0.0" authors = ["GalacticCouncil"] edition = "2021" license = "Apache 2.0" diff --git a/runtime/hydradx/src/lib.rs b/runtime/hydradx/src/lib.rs index 76f3450d1..47f8dac3e 100644 --- a/runtime/hydradx/src/lib.rs +++ b/runtime/hydradx/src/lib.rs @@ -95,7 +95,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: create_runtime_str!("hydradx"), impl_name: create_runtime_str!("hydradx"), authoring_version: 1, - spec_version: 168, + spec_version: 169, impl_version: 0, apis: RUNTIME_API_VERSIONS, transaction_version: 1,