From c44db729e0224f03b64e20d4db0ac50477ffd8a8 Mon Sep 17 00:00:00 2001 From: Roznovjak Date: Thu, 19 Sep 2024 14:07:07 +0200 Subject: [PATCH 1/3] remove SafeCallFilter and pallet_xcm from call filter --- Cargo.lock | 2 +- integration-tests/src/call_filter.rs | 16 ---- .../src/omnipool_liquidity_mining.rs | 2 +- integration-tests/src/router.rs | 2 - runtime/hydradx/Cargo.toml | 2 +- runtime/hydradx/src/lib.rs | 2 +- runtime/hydradx/src/system.rs | 2 - runtime/hydradx/src/xcm.rs | 92 +------------------ 8 files changed, 5 insertions(+), 115 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c64490657..cbdaf97a8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4938,7 +4938,7 @@ dependencies = [ [[package]] name = "hydradx-runtime" -version = "257.0.0" +version = "258.0.0" dependencies = [ "cumulus-pallet-aura-ext", "cumulus-pallet-parachain-system", diff --git a/integration-tests/src/call_filter.rs b/integration-tests/src/call_filter.rs index 419a6353d..b3d8b27d6 100644 --- a/integration-tests/src/call_filter.rs +++ b/integration-tests/src/call_filter.rs @@ -5,7 +5,6 @@ use frame_support::{ assert_ok, sp_runtime::{FixedU128, Permill}, traits::Contains, - weights::Weight, }; use polkadot_xcm::v3::prelude::*; use polkadot_xcm::VersionedXcm; @@ -238,21 +237,6 @@ fn calling_pallet_xcm_send_extrinsic_should_not_be_filtered_by_call_filter() { }); } -#[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)); - }); -} - #[test] fn calling_orml_xcm_extrinsic_should_be_filtered_by_call_filter() { TestNet::reset(); diff --git a/integration-tests/src/omnipool_liquidity_mining.rs b/integration-tests/src/omnipool_liquidity_mining.rs index 3a68f404c..7d16d5c3d 100644 --- a/integration-tests/src/omnipool_liquidity_mining.rs +++ b/integration-tests/src/omnipool_liquidity_mining.rs @@ -1295,7 +1295,7 @@ fn claim_rewards_should_work_when_farm_is_updated() { 10_000 * UNITS as i128, )); - let position_id = omnipool_add_liquidity(CHARLIE.into(), DOT, 1 * UNITS); + let position_id = omnipool_add_liquidity(CHARLIE.into(), DOT, UNITS); assert_nft_owner!( hydradx_runtime::OmnipoolCollectionId::get(), position_id, diff --git a/integration-tests/src/router.rs b/integration-tests/src/router.rs index b69445dc2..e68797d06 100644 --- a/integration-tests/src/router.rs +++ b/integration-tests/src/router.rs @@ -1352,7 +1352,6 @@ mod omnipool_router_tests { let extra_ed_charge = UNITS / 10; assert_balance!(ALICE.into(), HDX, 1000 * UNITS - ed); - let amount_to_sell = amount_to_sell; assert_ok!(Router::sell( hydradx_runtime::RuntimeOrigin::signed(ALICE.into()), insufficient_asset_1, @@ -5408,7 +5407,6 @@ mod sell_all { assert_balance!(ALICE.into(), pool_id, 0); //Act - let amount_to_sell = 3000 * UNITS; assert_ok!(Router::sell_all( hydradx_runtime::RuntimeOrigin::signed(ALICE.into()), stable_asset_1, diff --git a/runtime/hydradx/Cargo.toml b/runtime/hydradx/Cargo.toml index cc8c89077..8cef497de 100644 --- a/runtime/hydradx/Cargo.toml +++ b/runtime/hydradx/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "hydradx-runtime" -version = "257.0.0" +version = "258.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 601894f5f..30afa06ce 100644 --- a/runtime/hydradx/src/lib.rs +++ b/runtime/hydradx/src/lib.rs @@ -113,7 +113,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: create_runtime_str!("hydradx"), impl_name: create_runtime_str!("hydradx"), authoring_version: 1, - spec_version: 257, + spec_version: 258, impl_version: 0, apis: RUNTIME_API_VERSIONS, transaction_version: 1, diff --git a/runtime/hydradx/src/system.rs b/runtime/hydradx/src/system.rs index 77231cf04..82e9ad60d 100644 --- a/runtime/hydradx/src/system.rs +++ b/runtime/hydradx/src/system.rs @@ -95,11 +95,9 @@ impl Contains for CallFilter { } match call { - RuntimeCall::PolkadotXcm(pallet_xcm::Call::send { .. }) => true, // create and create2 are only allowed through RPC or Runtime API RuntimeCall::EVM(pallet_evm::Call::create { .. }) => false, RuntimeCall::EVM(pallet_evm::Call::create2 { .. }) => false, - RuntimeCall::PolkadotXcm(_) => false, RuntimeCall::OrmlXcm(_) => false, _ => true, } diff --git a/runtime/hydradx/src/xcm.rs b/runtime/hydradx/src/xcm.rs index 57713434a..853841cd2 100644 --- a/runtime/hydradx/src/xcm.rs +++ b/runtime/hydradx/src/xcm.rs @@ -185,7 +185,7 @@ impl Config for XcmConfig { type MessageExporter = (); type UniversalAliases = Nothing; type CallDispatcher = RuntimeCall; - type SafeCallFilter = SafeCallFilter; + type SafeCallFilter = Everything; type Aliasers = Nothing; type TransactionalProcessor = xcm_builder::FrameTransactionalProcessor; } @@ -436,93 +436,3 @@ pub type LocalAssetTransactor = ReroutingMultiCurrencyAdapter< OmnipoolProtocolAccount, TreasuryAccount, >; - -/// A call filter for the XCM Transact instruction. This is a temporary measure until we properly -/// account for proof size weights. -/// -/// Calls that are allowed through this filter must: -/// 1. Have a fixed weight; -/// 2. Cannot lead to another call being made; -/// 3. Have a defined proof size weight, e.g. no unbounded vecs in call parameters. -pub struct SafeCallFilter; -impl Contains for SafeCallFilter { - fn contains(call: &RuntimeCall) -> bool { - #[cfg(feature = "runtime-benchmarks")] - { - if matches!(call, RuntimeCall::System(frame_system::Call::remark_with_event { .. })) { - return true; - } - } - - // check the runtime call filter - if !CallFilter::contains(call) { - return false; - } - - matches!( - call, - RuntimeCall::System(frame_system::Call::kill_prefix { .. } | frame_system::Call::set_heap_pages { .. }) - | RuntimeCall::Timestamp(..) - | RuntimeCall::Balances(..) - | RuntimeCall::Treasury(..) - | RuntimeCall::Utility(pallet_utility::Call::as_derivative { .. }) - | RuntimeCall::Vesting(..) - | RuntimeCall::Proxy(..) - | RuntimeCall::CollatorSelection( - pallet_collator_selection::Call::set_desired_candidates { .. } - | pallet_collator_selection::Call::set_candidacy_bond { .. } - | pallet_collator_selection::Call::register_as_candidate { .. } - | pallet_collator_selection::Call::leave_intent { .. }, - ) | RuntimeCall::Session(pallet_session::Call::purge_keys { .. }) - | RuntimeCall::Uniques( - pallet_uniques::Call::create { .. } - | pallet_uniques::Call::force_create { .. } - | pallet_uniques::Call::mint { .. } - | pallet_uniques::Call::burn { .. } - | pallet_uniques::Call::transfer { .. } - | pallet_uniques::Call::freeze { .. } - | pallet_uniques::Call::thaw { .. } - | pallet_uniques::Call::freeze_collection { .. } - | pallet_uniques::Call::thaw_collection { .. } - | pallet_uniques::Call::transfer_ownership { .. } - | pallet_uniques::Call::set_team { .. } - | pallet_uniques::Call::approve_transfer { .. } - | pallet_uniques::Call::cancel_approval { .. } - | pallet_uniques::Call::force_item_status { .. } - | pallet_uniques::Call::set_attribute { .. } - | pallet_uniques::Call::clear_attribute { .. } - | pallet_uniques::Call::set_metadata { .. } - | pallet_uniques::Call::clear_metadata { .. } - | pallet_uniques::Call::set_collection_metadata { .. } - | pallet_uniques::Call::clear_collection_metadata { .. } - | pallet_uniques::Call::set_accept_ownership { .. } - | pallet_uniques::Call::set_price { .. } - | pallet_uniques::Call::buy_item { .. }, - ) | RuntimeCall::Identity( - pallet_identity::Call::add_registrar { .. } - | pallet_identity::Call::set_identity { .. } - | pallet_identity::Call::clear_identity { .. } - | pallet_identity::Call::request_judgement { .. } - | pallet_identity::Call::cancel_request { .. } - | pallet_identity::Call::set_fee { .. } - | pallet_identity::Call::set_account_id { .. } - | pallet_identity::Call::set_fields { .. } - | pallet_identity::Call::provide_judgement { .. } - | pallet_identity::Call::kill_identity { .. } - | pallet_identity::Call::add_sub { .. } - | pallet_identity::Call::rename_sub { .. } - | pallet_identity::Call::remove_sub { .. } - | pallet_identity::Call::quit_sub { .. }, - ) | RuntimeCall::Omnipool(..) - | RuntimeCall::OmnipoolLiquidityMining(..) - | RuntimeCall::OTC(..) - | RuntimeCall::CircuitBreaker(..) - | RuntimeCall::Router(..) - | RuntimeCall::DCA(..) - | RuntimeCall::MultiTransactionPayment(..) - | RuntimeCall::Currencies(..) - | RuntimeCall::Tokens(..) - | RuntimeCall::OrmlXcm(..) - ) - } -} From 392400486e7a4a3c6cafcdf479e3fee958074870 Mon Sep 17 00:00:00 2001 From: Roznovjak Date: Thu, 19 Sep 2024 16:17:16 +0200 Subject: [PATCH 2/3] bump crate version --- Cargo.lock | 2 +- integration-tests/Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index cbdaf97a8..b3b468628 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -11929,7 +11929,7 @@ dependencies = [ [[package]] name = "runtime-integration-tests" -version = "1.23.4" +version = "1.23.5" dependencies = [ "cumulus-pallet-aura-ext", "cumulus-pallet-parachain-system", diff --git a/integration-tests/Cargo.toml b/integration-tests/Cargo.toml index c5a291a12..998db0d4b 100644 --- a/integration-tests/Cargo.toml +++ b/integration-tests/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "runtime-integration-tests" -version = "1.23.4" +version = "1.23.5" description = "Integration tests" authors = ["GalacticCouncil"] edition = "2021" From a793c91ff3997376a8c0878bc526e92e280b8232 Mon Sep 17 00:00:00 2001 From: Roznovjak Date: Fri, 20 Sep 2024 09:41:24 +0200 Subject: [PATCH 3/3] rerun CI