From e5ff4d6e595ab540d6d087d43cf693e2601c9f6c Mon Sep 17 00:00:00 2001 From: green-jay Date: Sat, 29 Jul 2023 08:04:48 +0200 Subject: [PATCH 1/5] Whitelist polkadotXcm.send in Transact --- Cargo.lock | 2 +- runtime/hydradx/Cargo.toml | 2 +- runtime/hydradx/src/lib.rs | 2 +- runtime/hydradx/src/xcm.rs | 1 + 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f3e2e1fc3..c3b58de88 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3814,7 +3814,7 @@ dependencies = [ [[package]] name = "hydradx-runtime" -version = "169.0.0" +version = "170.0.0" dependencies = [ "cumulus-pallet-aura-ext", "cumulus-pallet-dmp-queue", diff --git a/runtime/hydradx/Cargo.toml b/runtime/hydradx/Cargo.toml index c37dfe1ac..b69adf064 100644 --- a/runtime/hydradx/Cargo.toml +++ b/runtime/hydradx/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "hydradx-runtime" -version = "169.0.0" +version = "170.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 47f8dac3e..5b125633d 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: 169, + spec_version: 170, 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 214020646..66aa480ad 100644 --- a/runtime/hydradx/src/xcm.rs +++ b/runtime/hydradx/src/xcm.rs @@ -413,6 +413,7 @@ impl Contains for SafeCallFilter { | RuntimeCall::Currencies(..) | RuntimeCall::Tokens(..) | RuntimeCall::OrmlXcm(..) + | RuntimeCall::PolkadotXcm(pallet_xcm::Call::send { .. },) ) } } From 8301fd99e8a5658153c1603b0b14a53895d03660 Mon Sep 17 00:00:00 2001 From: green-jay Date: Sat, 29 Jul 2023 08:36:29 +0200 Subject: [PATCH 2/5] allow also in local call filter --- runtime/hydradx/src/system.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/runtime/hydradx/src/system.rs b/runtime/hydradx/src/system.rs index 566866d3b..8e887e701 100644 --- a/runtime/hydradx/src/system.rs +++ b/runtime/hydradx/src/system.rs @@ -84,6 +84,7 @@ impl Contains for CallFilter { } match call { + RuntimeCall::PolkadotXcm(pallet_xcm::Call::send { .. }) => true, RuntimeCall::PolkadotXcm(_) => false, RuntimeCall::OrmlXcm(_) => false, _ => true, From f294ef00fb73933c08a698361e62662d62041b8e Mon Sep 17 00:00:00 2001 From: green-jay Date: Sat, 29 Jul 2023 09:29:46 +0200 Subject: [PATCH 3/5] add tests --- integration-tests/src/call_filter.rs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/integration-tests/src/call_filter.rs b/integration-tests/src/call_filter.rs index 89f2ee0db..b30bb1b8f 100644 --- a/integration-tests/src/call_filter.rs +++ b/integration-tests/src/call_filter.rs @@ -5,6 +5,7 @@ use frame_support::{ assert_ok, sp_runtime::{FixedU128, Permill}, traits::Contains, + weights::Weight, }; use polkadot_xcm::latest::prelude::*; use polkadot_xcm::VersionedXcm; @@ -206,7 +207,7 @@ fn transfer_should_not_work_when_transfering_omnipool_assets_to_omnipool_account } #[test] -fn calling_pallet_xcm_extrinsic_should_be_filtered_by_call_filter() { +fn calling_pallet_xcm_send_extrinsic_should_not_be_filtered_by_call_filter() { TestNet::reset(); Hydra::execute_with(|| { @@ -216,6 +217,21 @@ fn calling_pallet_xcm_extrinsic_should_be_filtered_by_call_filter() { message: Box::new(VersionedXcm::from(Xcm(vec![]))), }); + assert!(hydradx_runtime::CallFilter::contains(&call)); + }); +} + +#[test] +fn calling_pallet_xcm_extrinsic_should_be_filtered_by_call_filter() { + TestNet::reset(); + + Hydra::execute_with(|| { + // the values here don't need to make sense, all we need is a valid Call + let call = hydradx_runtime::RuntimeCall::PolkadotXcm(pallet_xcm::Call::execute { + message: Box::new(VersionedXcm::from(Xcm(vec![]))), + max_weight: Weight::zero(), + }); + assert!(!hydradx_runtime::CallFilter::contains(&call)); }); } From 29cbb2e7ca35780fb5cea3dff52cba3dcd312de3 Mon Sep 17 00:00:00 2001 From: green-jay Date: Sat, 29 Jul 2023 09:36:28 +0200 Subject: [PATCH 4/5] bump --- Cargo.lock | 2 +- integration-tests/Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c3b58de88..aa4d74c6d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -10072,7 +10072,7 @@ dependencies = [ [[package]] name = "runtime-integration-tests" -version = "1.8.1" +version = "1.8.2" dependencies = [ "cumulus-pallet-aura-ext", "cumulus-pallet-dmp-queue", diff --git a/integration-tests/Cargo.toml b/integration-tests/Cargo.toml index 99e769eac..f987bbb40 100644 --- a/integration-tests/Cargo.toml +++ b/integration-tests/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "runtime-integration-tests" -version = "1.8.1" +version = "1.8.2" description = "Integration tests" authors = ["GalacticCouncil"] edition = "2021" From 2c34d010be2f513d060abe9b3d636c21ecbb1aa1 Mon Sep 17 00:00:00 2001 From: mrq1911 Date: Sun, 30 Jul 2023 03:32:25 +0200 Subject: [PATCH 5/5] keep filtered in transact --- runtime/hydradx/src/xcm.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/runtime/hydradx/src/xcm.rs b/runtime/hydradx/src/xcm.rs index 66aa480ad..214020646 100644 --- a/runtime/hydradx/src/xcm.rs +++ b/runtime/hydradx/src/xcm.rs @@ -413,7 +413,6 @@ impl Contains for SafeCallFilter { | RuntimeCall::Currencies(..) | RuntimeCall::Tokens(..) | RuntimeCall::OrmlXcm(..) - | RuntimeCall::PolkadotXcm(pallet_xcm::Call::send { .. },) ) } }