From 445ba548c9fe78a8ff4574670ac5031cbe49257e Mon Sep 17 00:00:00 2001 From: Alexander Popiak Date: Wed, 12 Jul 2023 12:27:34 +0200 Subject: [PATCH 01/24] correct rate limiter Cargo.toml --- pallets/xcm-rate-limiter/Cargo.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pallets/xcm-rate-limiter/Cargo.toml b/pallets/xcm-rate-limiter/Cargo.toml index 10323d6ae8..7ac968e5b4 100644 --- a/pallets/xcm-rate-limiter/Cargo.toml +++ b/pallets/xcm-rate-limiter/Cargo.toml @@ -6,7 +6,7 @@ edition = "2021" license = "Apache-2.0" homepage = 'https://github.com/galacticcouncil/hydradx-node' repository = 'https://github.com/galacticcouncil/hydradx-node' -description = "Circuit breakers for AMMs" +description = "Rate limiter for tokens arriving via XCM" [package.metadata.docs.rs] targets = ['x86_64-unknown-linux-gnu'] @@ -19,7 +19,6 @@ scale-info = { version = "2.3.1", default-features = false, features = ["derive" # Hydradx hydradx-traits = { workspace = true } hydra-dx-math = { workspace = true } -pallet-omnipool = { workspace = true } # Substrate dependencies frame-benchmarking = { workspace = true, optional = true} @@ -43,6 +42,7 @@ orml-traits = { workspace = true } [dev-dependencies] pallet-balances = { workspace = true, features = ["std"] } +pallet-omnipool = { workspace = true, features = ["std"] } orml-tokens = { workspace = true, features = ["std"] } test-utils = { workspace = true } pretty_assertions = "1.2.1" From db446259bcc55209af6c3acbf411c57fe9246d5b Mon Sep 17 00:00:00 2001 From: Alexander Popiak Date: Wed, 12 Jul 2023 19:00:44 +0200 Subject: [PATCH 02/24] bump crate versions --- Cargo.lock | 10 +++++----- math/Cargo.toml | 2 +- pallets/dca/Cargo.toml | 2 +- primitives/Cargo.toml | 2 +- runtime/adapters/Cargo.toml | 2 +- runtime/hydradx/Cargo.toml | 2 +- runtime/hydradx/src/lib.rs | 2 +- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 04db82c11b..46cbcaac65 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3686,7 +3686,7 @@ dependencies = [ [[package]] name = "hydra-dx-math" -version = "7.4.2" +version = "7.4.3" dependencies = [ "approx", "criterion", @@ -3783,7 +3783,7 @@ dependencies = [ [[package]] name = "hydradx-adapters" -version = "0.4.0" +version = "0.4.1" dependencies = [ "cumulus-pallet-parachain-system", "cumulus-primitives-core", @@ -3815,7 +3815,7 @@ dependencies = [ [[package]] name = "hydradx-runtime" -version = "166.0.0" +version = "167.0.0" dependencies = [ "cumulus-pallet-aura-ext", "cumulus-pallet-dmp-queue", @@ -6561,7 +6561,7 @@ dependencies = [ [[package]] name = "pallet-dca" -version = "1.1.6" +version = "1.1.7" dependencies = [ "cumulus-pallet-parachain-system", "cumulus-primitives-core", @@ -9350,7 +9350,7 @@ dependencies = [ [[package]] name = "primitives" -version = "5.8.1" +version = "5.8.2" dependencies = [ "frame-support", "hex-literal 0.3.4", diff --git a/math/Cargo.toml b/math/Cargo.toml index 47191d1c98..c6005ee41d 100644 --- a/math/Cargo.toml +++ b/math/Cargo.toml @@ -6,7 +6,7 @@ license = 'Apache-2.0' name = "hydra-dx-math" description = "A collection of utilities to make performing liquidity pool calculations more convenient." repository = 'https://github.com/galacticcouncil/hydradx-math' -version = "7.4.2" +version = "7.4.3" [dependencies] primitive-types = {default-features = false, version = '0.12.0'} diff --git a/pallets/dca/Cargo.toml b/pallets/dca/Cargo.toml index 4db1fa6c3d..f22fd3df7f 100644 --- a/pallets/dca/Cargo.toml +++ b/pallets/dca/Cargo.toml @@ -1,6 +1,6 @@ [package] name = 'pallet-dca' -version = '1.1.6' +version = "1.1.7" description = 'A pallet to manage DCA scheduling' authors = ['GalacticCouncil'] edition = '2021' diff --git a/primitives/Cargo.toml b/primitives/Cargo.toml index f8a3c16225..a42eb1efc9 100644 --- a/primitives/Cargo.toml +++ b/primitives/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "primitives" -version = "5.8.1" +version = "5.8.2" authors = ["GalacticCouncil"] edition = "2021" repository = "https://github.com/galacticcouncil/HydraDX-node" diff --git a/runtime/adapters/Cargo.toml b/runtime/adapters/Cargo.toml index c5e1cbe5b9..6c0e162d0e 100644 --- a/runtime/adapters/Cargo.toml +++ b/runtime/adapters/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "hydradx-adapters" -version = "0.4.0" +version = "0.4.1" description = "Structs and other generic types for building runtimes." authors = ["GalacticCouncil"] edition = "2021" diff --git a/runtime/hydradx/Cargo.toml b/runtime/hydradx/Cargo.toml index ba21c3895a..8aff00d07f 100644 --- a/runtime/hydradx/Cargo.toml +++ b/runtime/hydradx/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "hydradx-runtime" -version = "166.0.0" +version = "167.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 b1e1fce054..8bcf9a6e36 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: 166, + spec_version: 167, impl_version: 0, apis: RUNTIME_API_VERSIONS, transaction_version: 1, From 79a64a179498a1afe970fc32b13117259bd32ad6 Mon Sep 17 00:00:00 2001 From: Alexander Popiak Date: Mon, 24 Jul 2023 11:54:17 +0200 Subject: [PATCH 03/24] Revert "remove xcm rate limiter from runtime" This reverts commit 1119b137f2caed0a6ab82b4562fd092d5fe6c8e1. --- integration-tests/src/lib.rs | 1 + integration-tests/src/xcm_rate_limiter.rs | 243 ++++++++++++++++++++++ runtime/hydradx/src/lib.rs | 1 + runtime/hydradx/src/xcm.rs | 21 +- 4 files changed, 264 insertions(+), 2 deletions(-) create mode 100644 integration-tests/src/xcm_rate_limiter.rs diff --git a/integration-tests/src/lib.rs b/integration-tests/src/lib.rs index 0450b3afc0..1a7d9a85a8 100644 --- a/integration-tests/src/lib.rs +++ b/integration-tests/src/lib.rs @@ -14,6 +14,7 @@ mod otc; mod polkadot_test_net; mod transact_call_filter; mod vesting; +mod xcm_rate_limiter; #[macro_export] macro_rules! assert_balance { diff --git a/integration-tests/src/xcm_rate_limiter.rs b/integration-tests/src/xcm_rate_limiter.rs new file mode 100644 index 0000000000..feb7306433 --- /dev/null +++ b/integration-tests/src/xcm_rate_limiter.rs @@ -0,0 +1,243 @@ +#![cfg(test)] + +use crate::polkadot_test_net::*; + +use frame_support::{assert_ok, pallet_prelude::Weight}; +use orml_traits::currency::MultiCurrency; +use pallet_asset_registry::AssetType; +use polkadot_xcm::prelude::*; +use xcm_emulator::TestExt; + +/// Returns the message hash in the `XcmpMessageSent` event at the `n`th last event (1-indexed, so if the second to last +/// event has the hash, pass `2`); +fn get_message_hash_from_event(n: usize) -> Option<[u8; 32]> { + use cumulus_pallet_xcmp_queue::Event; + use hydradx_runtime::RuntimeEvent; + let RuntimeEvent::XcmpQueue(Event::XcmpMessageSent { message_hash }) = &last_hydra_events(n)[0] else { + panic!("expecting to find message sent event"); + }; + *message_hash +} + +#[test] +fn xcm_rate_limiter_should_limit_aca_when_limit_is_exceeded() { + // Arrange + TestNet::reset(); + + Hydra::execute_with(|| { + assert_ok!(hydradx_runtime::AssetRegistry::set_location( + hydradx_runtime::RuntimeOrigin::root(), + ACA, + hydradx_runtime::AssetLocation(MultiLocation::new(1, X2(Parachain(ACALA_PARA_ID), GeneralIndex(0)))) + )); + + // set an xcm rate limit + assert_ok!(hydradx_runtime::AssetRegistry::update( + hydradx_runtime::RuntimeOrigin::root(), + ACA, + b"ACA".to_vec(), + AssetType::Token, + None, + Some(50 * UNITS), + )); + + assert_eq!(hydradx_runtime::Tokens::free_balance(ACA, &AccountId::from(BOB)), 0); + }); + + let amount = 100 * UNITS; + let mut message_hash = None; + Acala::execute_with(|| { + // Act + assert_ok!(hydradx_runtime::XTokens::transfer( + hydradx_runtime::RuntimeOrigin::signed(ALICE.into()), + 0, + amount, + Box::new( + MultiLocation::new( + 1, + X2( + Junction::Parachain(HYDRA_PARA_ID), + Junction::AccountId32 { id: BOB, network: None } + ) + ) + .into() + ), + WeightLimit::Limited(Weight::from_ref_time(399_600_000_000)) + )); + + message_hash = get_message_hash_from_event(2); + + // Assert + assert_eq!( + hydradx_runtime::Balances::free_balance(&AccountId::from(ALICE)), + ALICE_INITIAL_NATIVE_BALANCE - amount + ); + }); + + Hydra::execute_with(|| { + expect_hydra_events(vec![ + cumulus_pallet_xcmp_queue::Event::XcmDeferred { + sender: ACALA_PARA_ID.into(), + sent_at: 3, + deferred_to: 604, // received at 4 plus 600 blocks of deferral + message_hash, + } + .into(), + pallet_relaychain_info::Event::CurrentBlockNumbers { + parachain_block_number: 1, + relaychain_block_number: 5, + } + .into(), + ]); + assert_eq!(hydradx_runtime::Tokens::free_balance(ACA, &AccountId::from(BOB)), 0); + }); +} + +#[test] +fn xcm_rate_limiter_should_not_limit_aca_when_limit_is_not_exceeded() { + // Arrange + TestNet::reset(); + + Hydra::execute_with(|| { + assert_ok!(hydradx_runtime::AssetRegistry::set_location( + hydradx_runtime::RuntimeOrigin::root(), + ACA, + hydradx_runtime::AssetLocation(MultiLocation::new(1, X2(Parachain(ACALA_PARA_ID), GeneralIndex(0)))) + )); + + // set an xcm rate limit + assert_ok!(hydradx_runtime::AssetRegistry::update( + hydradx_runtime::RuntimeOrigin::root(), + ACA, + b"ACA".to_vec(), + AssetType::Token, + None, + Some(101 * UNITS), + )); + }); + + let amount = 100 * UNITS; + Acala::execute_with(|| { + // Act + assert_ok!(hydradx_runtime::XTokens::transfer( + hydradx_runtime::RuntimeOrigin::signed(ALICE.into()), + 0, + amount, + Box::new( + MultiLocation::new( + 1, + X2( + Junction::Parachain(HYDRA_PARA_ID), + Junction::AccountId32 { id: BOB, network: None } + ) + ) + .into() + ), + WeightLimit::Limited(Weight::from_ref_time(399_600_000_000)) + )); + + // Assert + assert_eq!( + hydradx_runtime::Balances::free_balance(&AccountId::from(ALICE)), + ALICE_INITIAL_NATIVE_BALANCE - amount + ); + }); + + Hydra::execute_with(|| { + let fee = hydradx_runtime::Tokens::free_balance(ACA, &hydradx_runtime::Treasury::account_id()); + assert_eq!( + hydradx_runtime::Tokens::free_balance(ACA, &AccountId::from(BOB)), + amount - fee + ); + }); +} + +#[test] +fn deferred_messages_should_be_executable_by_root() { + // Arrange + TestNet::reset(); + + Hydra::execute_with(|| { + assert_ok!(hydradx_runtime::AssetRegistry::set_location( + hydradx_runtime::RuntimeOrigin::root(), + ACA, + hydradx_runtime::AssetLocation(MultiLocation::new(1, X2(Parachain(ACALA_PARA_ID), GeneralIndex(0)))) + )); + + // set an xcm rate limit + assert_ok!(hydradx_runtime::AssetRegistry::update( + hydradx_runtime::RuntimeOrigin::root(), + ACA, + b"ACA".to_vec(), + AssetType::Token, + None, + Some(50 * UNITS), + )); + + assert_eq!(hydradx_runtime::Tokens::free_balance(ACA, &AccountId::from(BOB)), 0); + }); + + let amount = 100 * UNITS; + let mut message_hash = None; + let max_weight = Weight::from_ref_time(399_600_000_000); + Acala::execute_with(|| { + // Act + assert_ok!(hydradx_runtime::XTokens::transfer( + hydradx_runtime::RuntimeOrigin::signed(ALICE.into()), + 0, + amount, + Box::new( + MultiLocation::new( + 1, + X2( + Junction::Parachain(HYDRA_PARA_ID), + Junction::AccountId32 { id: BOB, network: None } + ) + ) + .into() + ), + WeightLimit::Limited(max_weight), + )); + + message_hash = get_message_hash_from_event(2); + + // Assert + assert_eq!( + hydradx_runtime::Balances::free_balance(&AccountId::from(ALICE)), + ALICE_INITIAL_NATIVE_BALANCE - amount + ); + }); + + Hydra::execute_with(|| { + expect_hydra_events(vec![ + cumulus_pallet_xcmp_queue::Event::XcmDeferred { + sender: ACALA_PARA_ID.into(), + sent_at: 3, + deferred_to: 604, // received at 4 plus 600 blocks of deferral + message_hash, + } + .into(), + pallet_relaychain_info::Event::CurrentBlockNumbers { + parachain_block_number: 1, + relaychain_block_number: 5, + } + .into(), + ]); + assert_eq!(hydradx_runtime::Tokens::free_balance(ACA, &AccountId::from(BOB)), 0); + + set_relaychain_block_number(604); + + assert_eq!(hydradx_runtime::Tokens::free_balance(ACA, &AccountId::from(BOB)), 0); + assert_ok!(hydradx_runtime::XcmpQueue::service_deferred( + hydradx_runtime::RuntimeOrigin::root(), + max_weight, + ACALA_PARA_ID.into(), + )); + + let fee = hydradx_runtime::Tokens::free_balance(ACA, &hydradx_runtime::Treasury::account_id()); + assert_eq!( + hydradx_runtime::Tokens::free_balance(ACA, &AccountId::from(BOB)), + amount - fee + ); + }); +} diff --git a/runtime/hydradx/src/lib.rs b/runtime/hydradx/src/lib.rs index 8bcf9a6e36..8e6e037cde 100644 --- a/runtime/hydradx/src/lib.rs +++ b/runtime/hydradx/src/lib.rs @@ -158,6 +158,7 @@ construct_runtime!( Router: pallet_route_executor = 67, DynamicFees: pallet_dynamic_fees = 68, + XcmRateLimiter: pallet_xcm_rate_limiter = 69, // ORML related modules Tokens: orml_tokens = 77, diff --git a/runtime/hydradx/src/xcm.rs b/runtime/hydradx/src/xcm.rs index 9669b5ad93..42d2b0c9d8 100644 --- a/runtime/hydradx/src/xcm.rs +++ b/runtime/hydradx/src/xcm.rs @@ -17,8 +17,9 @@ use frame_system::EnsureRoot; use orml_traits::{location::AbsoluteReserveProvider, parameter_type_with_key}; use orml_xcm_support::{DepositToAlternative, IsNativeConcrete, MultiNativeAsset}; use pallet_xcm::XcmPassthrough; -use polkadot_parachain::primitives::Sibling; +use polkadot_parachain::primitives::{RelayChainBlockNumber, Sibling}; use polkadot_xcm::v3::{prelude::*, Weight as XcmWeight}; +use primitives::Price; use scale_info::TypeInfo; use xcm_builder::{ AccountId32Aliases, AllowKnownQueryResponses, AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom, @@ -144,7 +145,7 @@ impl cumulus_pallet_xcmp_queue::Config for Runtime { type ExecuteDeferredOrigin = EnsureRoot; type MaxDeferredMessages = ConstU32<100>; type RelayChainBlockNumberProvider = RelayChainBlockNumberProvider; - type XcmDeferFilter = (); + type XcmDeferFilter = XcmRateLimiter; } impl cumulus_pallet_dmp_queue::Config for Runtime { @@ -214,6 +215,22 @@ impl pallet_xcm::Config for Runtime { #[cfg(feature = "runtime-benchmarks")] type ReachableDest = ReachableDest; } + +parameter_types! { + pub DeferDuration: RelayChainBlockNumber = 600; // 1 hour + pub MaxDeferDuration: RelayChainBlockNumber = 600 * 24 * 10; // 10 days +} + +impl pallet_xcm_rate_limiter::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type AssetId = AssetId; + type DeferDuration = DeferDuration; + type MaxDeferDuration = MaxDeferDuration; + type RelayBlockNumberProvider = RelayChainBlockNumberProvider; + type CurrencyIdConvert = CurrencyIdConvert; + type RateLimitFor = pallet_asset_registry::XcmRateLimitsInRegistry; +} + pub struct CurrencyIdConvert; use primitives::constants::chain::CORE_ASSET_ID; From 144605ee6290c39b612216399996590886a119bc Mon Sep 17 00:00:00 2001 From: Alexander Popiak Date: Mon, 24 Jul 2023 11:57:59 +0200 Subject: [PATCH 04/24] update xcmp queue pallet --- Cargo.lock | 100 ++++++++++++++++++++++++++--------------------------- 1 file changed, 50 insertions(+), 50 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 46cbcaac65..ba049b139e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1571,7 +1571,7 @@ dependencies = [ [[package]] name = "cumulus-client-cli" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a03c6bd502c64900c29df35c76ba1504debc5169" dependencies = [ "clap 4.3.9", "parity-scale-codec", @@ -1586,7 +1586,7 @@ dependencies = [ [[package]] name = "cumulus-client-collator" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a03c6bd502c64900c29df35c76ba1504debc5169" dependencies = [ "cumulus-client-consensus-common", "cumulus-client-network", @@ -1609,7 +1609,7 @@ dependencies = [ [[package]] name = "cumulus-client-consensus-aura" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a03c6bd502c64900c29df35c76ba1504debc5169" dependencies = [ "async-trait", "cumulus-client-consensus-common", @@ -1638,7 +1638,7 @@ dependencies = [ [[package]] name = "cumulus-client-consensus-common" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a03c6bd502c64900c29df35c76ba1504debc5169" dependencies = [ "async-trait", "cumulus-client-pov-recovery", @@ -1661,7 +1661,7 @@ dependencies = [ [[package]] name = "cumulus-client-consensus-relay-chain" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a03c6bd502c64900c29df35c76ba1504debc5169" dependencies = [ "async-trait", "cumulus-client-consensus-common", @@ -1684,7 +1684,7 @@ dependencies = [ [[package]] name = "cumulus-client-network" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a03c6bd502c64900c29df35c76ba1504debc5169" dependencies = [ "async-trait", "cumulus-relay-chain-interface", @@ -1707,7 +1707,7 @@ dependencies = [ [[package]] name = "cumulus-client-pov-recovery" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a03c6bd502c64900c29df35c76ba1504debc5169" dependencies = [ "cumulus-primitives-core", "cumulus-relay-chain-interface", @@ -1730,7 +1730,7 @@ dependencies = [ [[package]] name = "cumulus-client-service" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a03c6bd502c64900c29df35c76ba1504debc5169" dependencies = [ "cumulus-client-cli", "cumulus-client-collator", @@ -1758,7 +1758,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-aura-ext" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a03c6bd502c64900c29df35c76ba1504debc5169" dependencies = [ "frame-support", "frame-system", @@ -1774,7 +1774,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-dmp-queue" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a03c6bd502c64900c29df35c76ba1504debc5169" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -1791,7 +1791,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-parachain-system" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a03c6bd502c64900c29df35c76ba1504debc5169" dependencies = [ "bytes", "cumulus-pallet-parachain-system-proc-macro", @@ -1820,7 +1820,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-parachain-system-proc-macro" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a03c6bd502c64900c29df35c76ba1504debc5169" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -1831,7 +1831,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-xcm" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a03c6bd502c64900c29df35c76ba1504debc5169" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -1847,7 +1847,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-xcmp-queue" version = "0.2.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a03c6bd502c64900c29df35c76ba1504debc5169" dependencies = [ "cumulus-primitives-core", "frame-benchmarking", @@ -1869,7 +1869,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-core" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a03c6bd502c64900c29df35c76ba1504debc5169" dependencies = [ "parity-scale-codec", "polkadot-core-primitives", @@ -1885,7 +1885,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-parachain-inherent" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a03c6bd502c64900c29df35c76ba1504debc5169" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -1908,7 +1908,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-timestamp" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a03c6bd502c64900c29df35c76ba1504debc5169" dependencies = [ "cumulus-primitives-core", "futures", @@ -1921,7 +1921,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-utility" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a03c6bd502c64900c29df35c76ba1504debc5169" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -1939,7 +1939,7 @@ dependencies = [ [[package]] name = "cumulus-relay-chain-inprocess-interface" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a03c6bd502c64900c29df35c76ba1504debc5169" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -1964,7 +1964,7 @@ dependencies = [ [[package]] name = "cumulus-relay-chain-interface" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a03c6bd502c64900c29df35c76ba1504debc5169" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -1983,7 +1983,7 @@ dependencies = [ [[package]] name = "cumulus-relay-chain-minimal-node" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a03c6bd502c64900c29df35c76ba1504debc5169" dependencies = [ "array-bytes 6.1.0", "async-trait", @@ -2023,7 +2023,7 @@ dependencies = [ [[package]] name = "cumulus-relay-chain-rpc-interface" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a03c6bd502c64900c29df35c76ba1504debc5169" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -2052,7 +2052,7 @@ dependencies = [ [[package]] name = "cumulus-test-relay-sproof-builder" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a03c6bd502c64900c29df35c76ba1504debc5169" dependencies = [ "cumulus-primitives-core", "parity-scale-codec", @@ -6490,7 +6490,7 @@ dependencies = [ [[package]] name = "pallet-collator-selection" version = "3.0.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a03c6bd502c64900c29df35c76ba1504debc5169" dependencies = [ "frame-benchmarking", "frame-support", @@ -7690,7 +7690,7 @@ dependencies = [ [[package]] name = "parachain-info" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a03c6bd502c64900c29df35c76ba1504debc5169" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -15052,124 +15052,124 @@ dependencies = [ [[patch.unused]] name = "asset-test-utils" version = "1.0.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a03c6bd502c64900c29df35c76ba1504debc5169" [[patch.unused]] name = "bridge-hub-kusama-runtime" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a03c6bd502c64900c29df35c76ba1504debc5169" [[patch.unused]] name = "bridge-hub-polkadot-runtime" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a03c6bd502c64900c29df35c76ba1504debc5169" [[patch.unused]] name = "bridge-hub-rococo-runtime" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a03c6bd502c64900c29df35c76ba1504debc5169" [[patch.unused]] name = "collectives-polkadot-runtime" version = "1.0.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a03c6bd502c64900c29df35c76ba1504debc5169" [[patch.unused]] name = "contracts-rococo-runtime" version = "0.2.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a03c6bd502c64900c29df35c76ba1504debc5169" [[patch.unused]] name = "cumulus-pallet-session-benchmarking" version = "3.0.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a03c6bd502c64900c29df35c76ba1504debc5169" [[patch.unused]] name = "cumulus-pallet-solo-to-para" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a03c6bd502c64900c29df35c76ba1504debc5169" [[patch.unused]] name = "cumulus-ping" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a03c6bd502c64900c29df35c76ba1504debc5169" [[patch.unused]] name = "cumulus-test-client" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a03c6bd502c64900c29df35c76ba1504debc5169" [[patch.unused]] name = "cumulus-test-relay-validation-worker-provider" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a03c6bd502c64900c29df35c76ba1504debc5169" [[patch.unused]] name = "cumulus-test-runtime" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a03c6bd502c64900c29df35c76ba1504debc5169" [[patch.unused]] name = "cumulus-test-service" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a03c6bd502c64900c29df35c76ba1504debc5169" [[patch.unused]] name = "pallet-template" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a03c6bd502c64900c29df35c76ba1504debc5169" [[patch.unused]] name = "parachain-template-node" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a03c6bd502c64900c29df35c76ba1504debc5169" [[patch.unused]] name = "parachain-template-runtime" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a03c6bd502c64900c29df35c76ba1504debc5169" [[patch.unused]] name = "parachains-common" version = "1.0.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a03c6bd502c64900c29df35c76ba1504debc5169" [[patch.unused]] name = "penpal-runtime" version = "0.9.27" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a03c6bd502c64900c29df35c76ba1504debc5169" [[patch.unused]] name = "polkadot-parachain-bin" version = "0.9.380" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a03c6bd502c64900c29df35c76ba1504debc5169" [[patch.unused]] name = "rococo-parachain-runtime" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a03c6bd502c64900c29df35c76ba1504debc5169" [[patch.unused]] name = "seedling-runtime" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a03c6bd502c64900c29df35c76ba1504debc5169" [[patch.unused]] name = "shell-runtime" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a03c6bd502c64900c29df35c76ba1504debc5169" [[patch.unused]] name = "statemine-runtime" version = "2.0.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a03c6bd502c64900c29df35c76ba1504debc5169" [[patch.unused]] name = "statemint-runtime" version = "1.0.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a03c6bd502c64900c29df35c76ba1504debc5169" [[patch.unused]] name = "westmint-runtime" version = "1.0.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a03c6bd502c64900c29df35c76ba1504debc5169" From a6ee5de050e9afa5745324b4d960bffe5e59429f Mon Sep 17 00:00:00 2001 From: dmoka Date: Tue, 8 Aug 2023 13:27:27 +0200 Subject: [PATCH 05/24] bump integration tests --- integration-tests/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/integration-tests/Cargo.toml b/integration-tests/Cargo.toml index 99e769eacc..f987bbb405 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 a931eb051a83a30d882af805bc0f54508cae95d5 Mon Sep 17 00:00:00 2001 From: dmoka Date: Tue, 8 Aug 2023 13:31:33 +0200 Subject: [PATCH 06/24] 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 71535597ba..9ca8d86d68 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3814,7 +3814,7 @@ dependencies = [ [[package]] name = "hydradx-runtime" -version = "170.0.0" +version = "171.0.0" dependencies = [ "cumulus-pallet-aura-ext", "cumulus-pallet-dmp-queue", diff --git a/runtime/hydradx/Cargo.toml b/runtime/hydradx/Cargo.toml index b69adf064e..457d946373 100644 --- a/runtime/hydradx/Cargo.toml +++ b/runtime/hydradx/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "hydradx-runtime" -version = "170.0.0" +version = "171.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 049f94c985..da7b22b4ad 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: 170, + spec_version: 171, impl_version: 0, apis: RUNTIME_API_VERSIONS, transaction_version: 1, From 21f58667f4687f7523a6aee25b3f4351de77ace1 Mon Sep 17 00:00:00 2001 From: dmoka Date: Tue, 8 Aug 2023 13:33:48 +0200 Subject: [PATCH 07/24] change function order to follow execution orders --- pallets/xcm-rate-limiter/src/lib.rs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/pallets/xcm-rate-limiter/src/lib.rs b/pallets/xcm-rate-limiter/src/lib.rs index ec0fb03318..849faed2c6 100644 --- a/pallets/xcm-rate-limiter/src/lib.rs +++ b/pallets/xcm-rate-limiter/src/lib.rs @@ -164,16 +164,6 @@ pub mod pallet { impl Pallet {} } -fn get_loc_and_amount(m: &MultiAsset) -> Option<(MultiLocation, u128)> { - match m.id { - AssetId::Concrete(location) => match m.fun { - Fungibility::Fungible(amount) => Some((location, amount)), - _ => None, - }, - _ => None, - } -} - impl Pallet { fn get_locations_and_amounts(instruction: &Instruction) -> Vec<(MultiLocation, u128)> { use Instruction::*; @@ -187,6 +177,16 @@ impl Pallet { } } +fn get_loc_and_amount(m: &MultiAsset) -> Option<(MultiLocation, u128)> { + match m.id { + AssetId::Concrete(location) => match m.fun { + Fungibility::Fungible(amount) => Some((location, amount)), + _ => None, + }, + _ => None, + } +} + impl XcmDeferFilter for Pallet { fn deferred_by( _para: polkadot_parachain::primitives::Id, From b743f7764dfe53ea987f4ba51d220b5d51f3e3cc Mon Sep 17 00:00:00 2001 From: dmoka Date: Tue, 8 Aug 2023 13:38:29 +0200 Subject: [PATCH 08/24] bump patch versions of touched packages --- Cargo.lock | 4 ++-- integration-tests/Cargo.toml | 2 +- pallets/xcm-rate-limiter/Cargo.toml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9ca8d86d68..dc76c68384 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7632,7 +7632,7 @@ dependencies = [ [[package]] name = "pallet-xcm-rate-limiter" -version = "0.1.0" +version = "0.1.1" dependencies = [ "cumulus-pallet-xcmp-queue", "frame-benchmarking", @@ -10072,7 +10072,7 @@ dependencies = [ [[package]] name = "runtime-integration-tests" -version = "1.8.2" +version = "1.8.3" dependencies = [ "cumulus-pallet-aura-ext", "cumulus-pallet-dmp-queue", diff --git a/integration-tests/Cargo.toml b/integration-tests/Cargo.toml index f987bbb405..b73796e61e 100644 --- a/integration-tests/Cargo.toml +++ b/integration-tests/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "runtime-integration-tests" -version = "1.8.2" +version = "1.8.3" description = "Integration tests" authors = ["GalacticCouncil"] edition = "2021" diff --git a/pallets/xcm-rate-limiter/Cargo.toml b/pallets/xcm-rate-limiter/Cargo.toml index 7ac968e5b4..170cb8d87c 100644 --- a/pallets/xcm-rate-limiter/Cargo.toml +++ b/pallets/xcm-rate-limiter/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-xcm-rate-limiter" -version = "0.1.0" +version = "0.1.1" authors = ["GalacticCouncil "] edition = "2021" license = "Apache-2.0" From c95d0e54f53d71f64b1015b565fb92ea19484575 Mon Sep 17 00:00:00 2001 From: dmoka Date: Tue, 8 Aug 2023 17:13:40 +0200 Subject: [PATCH 09/24] fix xcm rate limiter non deterministic tests as we use different relay block number provider in runtime benchmarks --- integration-tests/src/xcm_rate_limiter.rs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/integration-tests/src/xcm_rate_limiter.rs b/integration-tests/src/xcm_rate_limiter.rs index feb7306433..9d77c85f6b 100644 --- a/integration-tests/src/xcm_rate_limiter.rs +++ b/integration-tests/src/xcm_rate_limiter.rs @@ -42,6 +42,11 @@ fn xcm_rate_limiter_should_limit_aca_when_limit_is_exceeded() { )); assert_eq!(hydradx_runtime::Tokens::free_balance(ACA, &AccountId::from(BOB)), 0); + + //Set it to same as the relay block number should be in XcmDeferFilter + //since we use different RelayChainBlockNumberProvider in runtime-benchmark feature + //where we return frame_system current time + frame_system::Pallet::::set_block_number(4); }); let amount = 100 * UNITS; @@ -84,7 +89,7 @@ fn xcm_rate_limiter_should_limit_aca_when_limit_is_exceeded() { } .into(), pallet_relaychain_info::Event::CurrentBlockNumbers { - parachain_block_number: 1, + parachain_block_number: 4, relaychain_block_number: 5, } .into(), @@ -175,6 +180,11 @@ fn deferred_messages_should_be_executable_by_root() { )); assert_eq!(hydradx_runtime::Tokens::free_balance(ACA, &AccountId::from(BOB)), 0); + + //Set it to same as the relay block number should be in XcmDeferFilter + //since we use different RelayChainBlockNumberProvider in runtime-benchmark feature + //where we return frame_system current time + frame_system::Pallet::::set_block_number(4); }); let amount = 100 * UNITS; @@ -218,7 +228,7 @@ fn deferred_messages_should_be_executable_by_root() { } .into(), pallet_relaychain_info::Event::CurrentBlockNumbers { - parachain_block_number: 1, + parachain_block_number: 4, relaychain_block_number: 5, } .into(), From 62ecd90baa40cc22f8f23d61199d560e1b73aef7 Mon Sep 17 00:00:00 2001 From: dmoka Date: Fri, 11 Aug 2023 16:12:10 +0200 Subject: [PATCH 10/24] 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 4514a5a2dc..ae89157585 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3817,7 +3817,7 @@ dependencies = [ [[package]] name = "hydradx-runtime" -version = "171.0.0" +version = "172.0.0" dependencies = [ "cumulus-pallet-aura-ext", "cumulus-pallet-dmp-queue", @@ -10120,7 +10120,7 @@ dependencies = [ [[package]] name = "runtime-integration-tests" -version = "1.9.0" +version = "1.9.1" dependencies = [ "cumulus-pallet-aura-ext", "cumulus-pallet-dmp-queue", diff --git a/integration-tests/Cargo.toml b/integration-tests/Cargo.toml index 2c3891f56d..271b47fa24 100644 --- a/integration-tests/Cargo.toml +++ b/integration-tests/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "runtime-integration-tests" -version = "1.9.0" +version = "1.9.1" description = "Integration tests" authors = ["GalacticCouncil"] edition = "2021" diff --git a/runtime/hydradx/Cargo.toml b/runtime/hydradx/Cargo.toml index 6aaa769a5f..e11bb99bf0 100644 --- a/runtime/hydradx/Cargo.toml +++ b/runtime/hydradx/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "hydradx-runtime" -version = "171.0.0" +version = "172.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 8c0203ab83..352216da39 100644 --- a/runtime/hydradx/src/lib.rs +++ b/runtime/hydradx/src/lib.rs @@ -94,7 +94,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: create_runtime_str!("hydradx"), impl_name: create_runtime_str!("hydradx"), authoring_version: 1, - spec_version: 171, + spec_version: 172, impl_version: 0, apis: RUNTIME_API_VERSIONS, transaction_version: 1, From 04440f3638d232861eefc4d3fc45e2fa10047b2a Mon Sep 17 00:00:00 2001 From: dmoka Date: Mon, 14 Aug 2023 09:58:20 +0200 Subject: [PATCH 11/24] bump runtime version --- runtime/hydradx/Cargo.toml | 2 +- runtime/hydradx/src/lib.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/runtime/hydradx/Cargo.toml b/runtime/hydradx/Cargo.toml index a028b6618b..a90434dbb0 100644 --- a/runtime/hydradx/Cargo.toml +++ b/runtime/hydradx/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "hydradx-runtime" -version = "172.0.0" +version = "173.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 2e8abe6c9c..1b20f0b847 100644 --- a/runtime/hydradx/src/lib.rs +++ b/runtime/hydradx/src/lib.rs @@ -94,7 +94,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: create_runtime_str!("hydradx"), impl_name: create_runtime_str!("hydradx"), authoring_version: 1, - spec_version: 172, + spec_version: 173, impl_version: 0, apis: RUNTIME_API_VERSIONS, transaction_version: 1, From 0671025a904da115247045e0c2cbab7811ccd568 Mon Sep 17 00:00:00 2001 From: dmoka Date: Mon, 14 Aug 2023 10:03:22 +0200 Subject: [PATCH 12/24] bump patch versions for touched packages --- integration-tests/Cargo.toml | 2 +- pallets/xcm-rate-limiter/Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/integration-tests/Cargo.toml b/integration-tests/Cargo.toml index 7dbefb3ee3..b3781b4d03 100644 --- a/integration-tests/Cargo.toml +++ b/integration-tests/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "runtime-integration-tests" -version = "1.9.1" +version = "1.9.2" description = "Integration tests" authors = ["GalacticCouncil"] edition = "2021" diff --git a/pallets/xcm-rate-limiter/Cargo.toml b/pallets/xcm-rate-limiter/Cargo.toml index 170cb8d87c..764312eef1 100644 --- a/pallets/xcm-rate-limiter/Cargo.toml +++ b/pallets/xcm-rate-limiter/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-xcm-rate-limiter" -version = "0.1.1" +version = "0.1.2" authors = ["GalacticCouncil "] edition = "2021" license = "Apache-2.0" From 658b7bef3cf9ceba49d14deaf64ae13a5440c4a4 Mon Sep 17 00:00:00 2001 From: dmoka Date: Mon, 14 Aug 2023 22:38:29 +0200 Subject: [PATCH 13/24] update lock --- Cargo.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1829ee9196..3f54ff143d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3817,7 +3817,7 @@ dependencies = [ [[package]] name = "hydradx-runtime" -version = "172.0.0" +version = "173.0.0" dependencies = [ "cumulus-pallet-aura-ext", "cumulus-pallet-dmp-queue", @@ -7706,7 +7706,7 @@ dependencies = [ [[package]] name = "pallet-xcm-rate-limiter" -version = "0.1.1" +version = "0.1.2" dependencies = [ "cumulus-pallet-xcmp-queue", "frame-benchmarking", @@ -10146,7 +10146,7 @@ dependencies = [ [[package]] name = "runtime-integration-tests" -version = "1.9.1" +version = "1.9.2" dependencies = [ "cumulus-pallet-aura-ext", "cumulus-pallet-dmp-queue", From 54744fe275af4f324d0ac1aa976d3f96ee9b7a7b Mon Sep 17 00:00:00 2001 From: Alexander Popiak Date: Fri, 20 Oct 2023 15:23:15 +0200 Subject: [PATCH 14/24] 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 cf5930a882..43f4bbca88 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3831,7 +3831,7 @@ dependencies = [ [[package]] name = "hydradx-runtime" -version = "183.0.0" +version = "184.0.0" dependencies = [ "cumulus-pallet-aura-ext", "cumulus-pallet-dmp-queue", @@ -10220,7 +10220,7 @@ dependencies = [ [[package]] name = "runtime-integration-tests" -version = "1.13.0" +version = "1.13.1" dependencies = [ "cumulus-pallet-aura-ext", "cumulus-pallet-dmp-queue", diff --git a/integration-tests/Cargo.toml b/integration-tests/Cargo.toml index 427cb6e537..62edc94201 100644 --- a/integration-tests/Cargo.toml +++ b/integration-tests/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "runtime-integration-tests" -version = "1.13.0" +version = "1.13.1" description = "Integration tests" authors = ["GalacticCouncil"] edition = "2021" diff --git a/runtime/hydradx/Cargo.toml b/runtime/hydradx/Cargo.toml index 4d36357fe9..bcbe3e3a51 100644 --- a/runtime/hydradx/Cargo.toml +++ b/runtime/hydradx/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "hydradx-runtime" -version = "183.0.0" +version = "184.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 253418903f..bca3141455 100644 --- a/runtime/hydradx/src/lib.rs +++ b/runtime/hydradx/src/lib.rs @@ -94,7 +94,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: create_runtime_str!("hydradx"), impl_name: create_runtime_str!("hydradx"), authoring_version: 1, - spec_version: 183, + spec_version: 184, impl_version: 0, apis: RUNTIME_API_VERSIONS, transaction_version: 1, From c90e46921973413adf40e9b930c62245a5a9770c Mon Sep 17 00:00:00 2001 From: Alexander Popiak Date: Fri, 20 Oct 2023 15:26:00 +0200 Subject: [PATCH 15/24] remove duplicate assert macro definitions --- integration-tests/src/polkadot_test_net.rs | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/integration-tests/src/polkadot_test_net.rs b/integration-tests/src/polkadot_test_net.rs index 3a7b8e2d4b..3947adf50a 100644 --- a/integration-tests/src/polkadot_test_net.rs +++ b/integration-tests/src/polkadot_test_net.rs @@ -474,17 +474,3 @@ pub fn init_omnipool() { Permill::from_percent(10) )); } - -#[macro_export] -macro_rules! assert_balance { - ( $who:expr, $asset:expr, $amount:expr) => {{ - assert_eq!(Currencies::free_balance($asset, &$who), $amount); - }}; -} - -#[macro_export] -macro_rules! assert_reserved_balance { - ( $who:expr, $asset:expr, $amount:expr) => {{ - assert_eq!(Currencies::reserved_balance($asset, &$who), $amount); - }}; -} From 0a0682ac6fcd59eef6c747dad9b6ddf3acf9ee8e Mon Sep 17 00:00:00 2001 From: Alexander Popiak Date: Fri, 20 Oct 2023 15:30:32 +0200 Subject: [PATCH 16/24] update xcmp queue pallet to new extended version --- Cargo.lock | 50 +++++++++++------------ runtime/hydradx/src/weights/xcmp_queue.rs | 19 ++++++++- runtime/hydradx/src/xcm.rs | 1 + 3 files changed, 44 insertions(+), 26 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 43f4bbca88..85a8a4174d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1561,7 +1561,7 @@ dependencies = [ [[package]] name = "cumulus-client-cli" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#bc34ec33523285a27e9b47775bd9dbea3a18276a" dependencies = [ "clap 4.3.9", "parity-scale-codec", @@ -1576,7 +1576,7 @@ dependencies = [ [[package]] name = "cumulus-client-collator" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#bc34ec33523285a27e9b47775bd9dbea3a18276a" dependencies = [ "cumulus-client-consensus-common", "cumulus-client-network", @@ -1599,7 +1599,7 @@ dependencies = [ [[package]] name = "cumulus-client-consensus-aura" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#bc34ec33523285a27e9b47775bd9dbea3a18276a" dependencies = [ "async-trait", "cumulus-client-consensus-common", @@ -1628,7 +1628,7 @@ dependencies = [ [[package]] name = "cumulus-client-consensus-common" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#bc34ec33523285a27e9b47775bd9dbea3a18276a" dependencies = [ "async-trait", "cumulus-client-pov-recovery", @@ -1651,7 +1651,7 @@ dependencies = [ [[package]] name = "cumulus-client-consensus-relay-chain" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#bc34ec33523285a27e9b47775bd9dbea3a18276a" dependencies = [ "async-trait", "cumulus-client-consensus-common", @@ -1674,7 +1674,7 @@ dependencies = [ [[package]] name = "cumulus-client-network" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#bc34ec33523285a27e9b47775bd9dbea3a18276a" dependencies = [ "async-trait", "cumulus-relay-chain-interface", @@ -1697,7 +1697,7 @@ dependencies = [ [[package]] name = "cumulus-client-pov-recovery" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#bc34ec33523285a27e9b47775bd9dbea3a18276a" dependencies = [ "cumulus-primitives-core", "cumulus-relay-chain-interface", @@ -1720,7 +1720,7 @@ dependencies = [ [[package]] name = "cumulus-client-service" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#bc34ec33523285a27e9b47775bd9dbea3a18276a" dependencies = [ "cumulus-client-cli", "cumulus-client-collator", @@ -1748,7 +1748,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-aura-ext" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#bc34ec33523285a27e9b47775bd9dbea3a18276a" dependencies = [ "frame-support", "frame-system", @@ -1764,7 +1764,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-dmp-queue" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#bc34ec33523285a27e9b47775bd9dbea3a18276a" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -1781,7 +1781,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-parachain-system" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#bc34ec33523285a27e9b47775bd9dbea3a18276a" dependencies = [ "bytes", "cumulus-pallet-parachain-system-proc-macro", @@ -1810,7 +1810,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-parachain-system-proc-macro" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#bc34ec33523285a27e9b47775bd9dbea3a18276a" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -1821,7 +1821,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-xcm" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#bc34ec33523285a27e9b47775bd9dbea3a18276a" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -1837,7 +1837,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-xcmp-queue" version = "0.2.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#bc34ec33523285a27e9b47775bd9dbea3a18276a" dependencies = [ "cumulus-primitives-core", "frame-benchmarking", @@ -1859,7 +1859,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-core" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#bc34ec33523285a27e9b47775bd9dbea3a18276a" dependencies = [ "parity-scale-codec", "polkadot-core-primitives", @@ -1875,7 +1875,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-parachain-inherent" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#bc34ec33523285a27e9b47775bd9dbea3a18276a" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -1898,7 +1898,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-timestamp" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#bc34ec33523285a27e9b47775bd9dbea3a18276a" dependencies = [ "cumulus-primitives-core", "futures", @@ -1911,7 +1911,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-utility" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#bc34ec33523285a27e9b47775bd9dbea3a18276a" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -1929,7 +1929,7 @@ dependencies = [ [[package]] name = "cumulus-relay-chain-inprocess-interface" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#bc34ec33523285a27e9b47775bd9dbea3a18276a" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -1954,7 +1954,7 @@ dependencies = [ [[package]] name = "cumulus-relay-chain-interface" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#bc34ec33523285a27e9b47775bd9dbea3a18276a" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -1973,7 +1973,7 @@ dependencies = [ [[package]] name = "cumulus-relay-chain-minimal-node" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#bc34ec33523285a27e9b47775bd9dbea3a18276a" dependencies = [ "array-bytes 6.1.0", "async-trait", @@ -2013,7 +2013,7 @@ dependencies = [ [[package]] name = "cumulus-relay-chain-rpc-interface" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#bc34ec33523285a27e9b47775bd9dbea3a18276a" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -2042,7 +2042,7 @@ dependencies = [ [[package]] name = "cumulus-test-relay-sproof-builder" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#bc34ec33523285a27e9b47775bd9dbea3a18276a" dependencies = [ "cumulus-primitives-core", "parity-scale-codec", @@ -6527,7 +6527,7 @@ dependencies = [ [[package]] name = "pallet-collator-selection" version = "3.0.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#bc34ec33523285a27e9b47775bd9dbea3a18276a" dependencies = [ "frame-benchmarking", "frame-support", @@ -7809,7 +7809,7 @@ dependencies = [ [[package]] name = "parachain-info" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#bc34ec33523285a27e9b47775bd9dbea3a18276a" dependencies = [ "cumulus-primitives-core", "frame-support", diff --git a/runtime/hydradx/src/weights/xcmp_queue.rs b/runtime/hydradx/src/weights/xcmp_queue.rs index bed7181f58..a92cc21736 100644 --- a/runtime/hydradx/src/weights/xcmp_queue.rs +++ b/runtime/hydradx/src/weights/xcmp_queue.rs @@ -86,9 +86,26 @@ impl WeightInfo for HydraWeight { .saturating_add(T::DbWeight::get().reads(104 as u64)) .saturating_add(T::DbWeight::get().writes(103 as u64)) } + // TODO: update weights // Storage: XcmpQueue DeferredXcmMessages (r:1 w:1) // Proof Skipped: XcmpQueue DeferredXcmMessages (max_values: None, max_size: None, mode: Measured) - fn discard_deferred() -> Weight { + fn discard_deferred_bucket() -> Weight { + // Minimum execution time: 62_131_073 nanoseconds. + Weight::from_ref_time(63_092_826_000 as u64) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } + + // Storage: XcmpQueue DeferredXcmMessages (r:1 w:1) + // Proof Skipped: XcmpQueue DeferredXcmMessages (max_values: None, max_size: None, mode: Measured) + fn discard_deferred_individual() -> Weight { + // Minimum execution time: 62_131_073 nanoseconds. + Weight::from_ref_time(63_092_826_000 as u64) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } + + fn try_place_in_deferred_queue() -> Weight { // Minimum execution time: 62_131_073 nanoseconds. Weight::from_ref_time(63_092_826_000 as u64) .saturating_add(T::DbWeight::get().reads(1 as u64)) diff --git a/runtime/hydradx/src/xcm.rs b/runtime/hydradx/src/xcm.rs index e549db152f..e78d0dd469 100644 --- a/runtime/hydradx/src/xcm.rs +++ b/runtime/hydradx/src/xcm.rs @@ -151,6 +151,7 @@ impl cumulus_pallet_xcmp_queue::Config for Runtime { type WeightInfo = weights::xcmp_queue::HydraWeight; type ExecuteDeferredOrigin = EnsureRoot; type MaxDeferredMessages = ConstU32<100>; + type MaxDeferredBuckets = ConstU32<1000>; type RelayChainBlockNumberProvider = RelayChainBlockNumberProvider; type XcmDeferFilter = XcmRateLimiter; } From ff7c10261601a5fa7193fa1e63d82f97a6a5d440 Mon Sep 17 00:00:00 2001 From: Alexander Popiak Date: Fri, 20 Oct 2023 17:06:57 +0200 Subject: [PATCH 17/24] update integration tests --- integration-tests/src/xcm_rate_limiter.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/integration-tests/src/xcm_rate_limiter.rs b/integration-tests/src/xcm_rate_limiter.rs index 9d77c85f6b..55c74fa23e 100644 --- a/integration-tests/src/xcm_rate_limiter.rs +++ b/integration-tests/src/xcm_rate_limiter.rs @@ -84,8 +84,10 @@ fn xcm_rate_limiter_should_limit_aca_when_limit_is_exceeded() { cumulus_pallet_xcmp_queue::Event::XcmDeferred { sender: ACALA_PARA_ID.into(), sent_at: 3, - deferred_to: 604, // received at 4 plus 600 blocks of deferral + deferred_to: hydradx_runtime::DeferDuration::get() + 4, message_hash, + index: (hydradx_runtime::DeferDuration::get() + 4, 0), + position: 0, } .into(), pallet_relaychain_info::Event::CurrentBlockNumbers { @@ -223,8 +225,10 @@ fn deferred_messages_should_be_executable_by_root() { cumulus_pallet_xcmp_queue::Event::XcmDeferred { sender: ACALA_PARA_ID.into(), sent_at: 3, - deferred_to: 604, // received at 4 plus 600 blocks of deferral + deferred_to: hydradx_runtime::DeferDuration::get() + 4, message_hash, + index: (hydradx_runtime::DeferDuration::get() + 4, 0), + position: 0, } .into(), pallet_relaychain_info::Event::CurrentBlockNumbers { @@ -235,7 +239,7 @@ fn deferred_messages_should_be_executable_by_root() { ]); assert_eq!(hydradx_runtime::Tokens::free_balance(ACA, &AccountId::from(BOB)), 0); - set_relaychain_block_number(604); + set_relaychain_block_number(hydradx_runtime::DeferDuration::get() + 4); assert_eq!(hydradx_runtime::Tokens::free_balance(ACA, &AccountId::from(BOB)), 0); assert_ok!(hydradx_runtime::XcmpQueue::service_deferred( From 7a1eaedeadfbf92b5e498b8bf9572ee57e5c4553 Mon Sep 17 00:00:00 2001 From: Alexander Popiak Date: Fri, 20 Oct 2023 17:07:22 +0200 Subject: [PATCH 18/24] formatting --- runtime/hydradx/src/weights/xcmp_queue.rs | 73 ++++++++++++----------- 1 file changed, 39 insertions(+), 34 deletions(-) diff --git a/runtime/hydradx/src/weights/xcmp_queue.rs b/runtime/hydradx/src/weights/xcmp_queue.rs index a92cc21736..473c91b8d5 100644 --- a/runtime/hydradx/src/weights/xcmp_queue.rs +++ b/runtime/hydradx/src/weights/xcmp_queue.rs @@ -18,25 +18,23 @@ //! Autogenerated weights for cumulus_pallet_xcmp_queue //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-06-16, STEPS: 5, REPEAT: 20, LOW RANGE: [], HIGH RANGE: [] +//! DATE: 2023-10-20, STEPS: 10, REPEAT: 30, LOW RANGE: [], HIGH RANGE: [] //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 // Executed Command: // target/release/hydradx // benchmark // pallet -// --pallet=cumulus-pallet-xcmp-queue +// --chain=dev +// --steps=10 +// --repeat=30 // --execution=wasm // --wasm-execution=compiled // --heap-pages=4096 -// --chain=dev +// --template=.maintain/pallet-weight-template-no-back.hbs +// --pallet=cumulus-pallet-xcmp-queue +// --output=xcmp_queue.rs // --extrinsic=* -// --steps=5 -// --repeat=20 -// --output -// xcmp_queue.rs -// --template -// .maintain/pallet-weight-template-no-back.hbs #![allow(unused_parens)] #![allow(unused_imports)] @@ -57,23 +55,29 @@ impl WeightInfo for HydraWeight { // Storage: XcmpQueue QueueConfig (r:1 w:1) // Proof Skipped: XcmpQueue QueueConfig (max_values: Some(1), max_size: None, mode: Measured) fn set_config_with_u32() -> Weight { - // Minimum execution time: 7_729 nanoseconds. - Weight::from_ref_time(8_046_000 as u64) + // Minimum execution time: 7_869 nanoseconds. + Weight::from_ref_time(8_101_000 as u64) .saturating_add(T::DbWeight::get().reads(1 as u64)) .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: XcmpQueue QueueConfig (r:1 w:1) // Proof Skipped: XcmpQueue QueueConfig (max_values: Some(1), max_size: None, mode: Measured) fn set_config_with_weight() -> Weight { - // Minimum execution time: 7_991 nanoseconds. - Weight::from_ref_time(8_303_000 as u64) + // Minimum execution time: 8_010 nanoseconds. + Weight::from_ref_time(8_212_000 as u64) .saturating_add(T::DbWeight::get().reads(1 as u64)) .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: XcmpQueue QueueConfig (r:1 w:0) // Proof Skipped: XcmpQueue QueueConfig (max_values: Some(1), max_size: None, mode: Measured) - // Storage: XcmpQueue DeferredXcmMessages (r:1 w:1) - // Proof Skipped: XcmpQueue DeferredXcmMessages (max_values: None, max_size: None, mode: Measured) + // Storage: XcmpQueue QueueSuspended (r:1 w:0) + // Proof Skipped: XcmpQueue QueueSuspended (max_values: Some(1), max_size: None, mode: Measured) + // Storage: XcmpQueue DeferredQueueSuspended (r:1 w:0) + // Proof Skipped: XcmpQueue DeferredQueueSuspended (max_values: Some(1), max_size: None, mode: Measured) + // Storage: XcmpQueue DeferredIndices (r:1 w:1) + // Proof Skipped: XcmpQueue DeferredIndices (max_values: None, max_size: None, mode: Measured) + // Storage: XcmpQueue DeferredMessageBuckets (r:1 w:1) + // Proof Skipped: XcmpQueue DeferredMessageBuckets (max_values: None, max_size: None, mode: Measured) // Storage: XcmpQueue CounterForOverweight (r:1 w:1) // Proof: XcmpQueue CounterForOverweight (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) // Storage: XcmpQueue OverweightCount (r:1 w:1) @@ -81,34 +85,35 @@ impl WeightInfo for HydraWeight { // Storage: XcmpQueue Overweight (r:100 w:100) // Proof Skipped: XcmpQueue Overweight (max_values: None, max_size: None, mode: Measured) fn service_deferred() -> Weight { - // Minimum execution time: 90_934_683 nanoseconds. - Weight::from_ref_time(91_491_151_000 as u64) - .saturating_add(T::DbWeight::get().reads(104 as u64)) - .saturating_add(T::DbWeight::get().writes(103 as u64)) + // Minimum execution time: 193_410_426 nanoseconds. + Weight::from_ref_time(193_901_312_000 as u64) + .saturating_add(T::DbWeight::get().reads(107 as u64)) + .saturating_add(T::DbWeight::get().writes(104 as u64)) } - // TODO: update weights - // Storage: XcmpQueue DeferredXcmMessages (r:1 w:1) - // Proof Skipped: XcmpQueue DeferredXcmMessages (max_values: None, max_size: None, mode: Measured) + // Storage: XcmpQueue DeferredMessageBuckets (r:1 w:1) + // Proof Skipped: XcmpQueue DeferredMessageBuckets (max_values: None, max_size: None, mode: Measured) fn discard_deferred_bucket() -> Weight { - // Minimum execution time: 62_131_073 nanoseconds. - Weight::from_ref_time(63_092_826_000 as u64) + // Minimum execution time: 112_292_897 nanoseconds. + Weight::from_ref_time(112_586_652_000 as u64) .saturating_add(T::DbWeight::get().reads(1 as u64)) .saturating_add(T::DbWeight::get().writes(1 as u64)) } - - // Storage: XcmpQueue DeferredXcmMessages (r:1 w:1) - // Proof Skipped: XcmpQueue DeferredXcmMessages (max_values: None, max_size: None, mode: Measured) + // Storage: XcmpQueue DeferredMessageBuckets (r:1 w:1) + // Proof Skipped: XcmpQueue DeferredMessageBuckets (max_values: None, max_size: None, mode: Measured) fn discard_deferred_individual() -> Weight { - // Minimum execution time: 62_131_073 nanoseconds. - Weight::from_ref_time(63_092_826_000 as u64) + // Minimum execution time: 124_783_889 nanoseconds. + Weight::from_ref_time(125_149_821_000 as u64) .saturating_add(T::DbWeight::get().reads(1 as u64)) .saturating_add(T::DbWeight::get().writes(1 as u64)) } - + // Storage: XcmpQueue DeferredIndices (r:1 w:1) + // Proof Skipped: XcmpQueue DeferredIndices (max_values: None, max_size: None, mode: Measured) + // Storage: XcmpQueue DeferredMessageBuckets (r:1 w:1) + // Proof Skipped: XcmpQueue DeferredMessageBuckets (max_values: None, max_size: None, mode: Measured) fn try_place_in_deferred_queue() -> Weight { - // Minimum execution time: 62_131_073 nanoseconds. - Weight::from_ref_time(63_092_826_000 as u64) - .saturating_add(T::DbWeight::get().reads(1 as u64)) - .saturating_add(T::DbWeight::get().writes(1 as u64)) + // Minimum execution time: 530_788 nanoseconds. + Weight::from_ref_time(537_065_000 as u64) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) } } From d958f16e9e10839a4884b7b40d0d85789c75ea45 Mon Sep 17 00:00:00 2001 From: Alexander Popiak Date: Fri, 8 Dec 2023 12:49:31 +0100 Subject: [PATCH 19/24] configure defer duration --- runtime/hydradx/src/xcm.rs | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/runtime/hydradx/src/xcm.rs b/runtime/hydradx/src/xcm.rs index e78d0dd469..0d50aa4afb 100644 --- a/runtime/hydradx/src/xcm.rs +++ b/runtime/hydradx/src/xcm.rs @@ -230,8 +230,25 @@ impl pallet_xcm::Config for Runtime { type ReachableDest = ReachableDest; } +#[test] +fn defer_duration_configuration() { + use sp_runtime::{traits::One, FixedPointNumber, FixedU128}; + /// Calculate the configuration value for the defer duration based on the desired defer duration and + /// the threshold percentage when to start deferring. + /// - `defer_by`: the desired defer duration when reaching the rate limit + /// - `a``: the fraction of the rate limit where we start deferring, e.g. 0.9 + fn defer_duration(defer_by: u32, a: FixedU128) -> u32 { + assert!(a < FixedU128::one()); + // defer_by * a / (1 - a) + (FixedU128::one() / (FixedU128::one() - a)).saturating_mul_int(a.saturating_mul_int(defer_by)) + } + assert_eq!( + defer_duration(600 * 4, FixedU128::from_rational(9, 10)), + DeferDuration::get() + ); +} parameter_types! { - pub DeferDuration: RelayChainBlockNumber = 600; // 1 hour + pub DeferDuration: RelayChainBlockNumber = 600 * 36; // 36 hours pub MaxDeferDuration: RelayChainBlockNumber = 600 * 24 * 10; // 10 days } From c4f8c5c2df6ea272f0de860326ce30d3506585a5 Mon Sep 17 00:00:00 2001 From: Alexander Popiak Date: Fri, 22 Dec 2023 11:18:14 +0100 Subject: [PATCH 20/24] fix merge issues and tests --- integration-tests/src/xcm_rate_limiter.rs | 41 ++++++++++++++--------- runtime/hydradx/src/weights/xcmp_queue.rs | 18 ---------- 2 files changed, 25 insertions(+), 34 deletions(-) diff --git a/integration-tests/src/xcm_rate_limiter.rs b/integration-tests/src/xcm_rate_limiter.rs index 55c74fa23e..e1662ac60e 100644 --- a/integration-tests/src/xcm_rate_limiter.rs +++ b/integration-tests/src/xcm_rate_limiter.rs @@ -16,7 +16,7 @@ fn get_message_hash_from_event(n: usize) -> Option<[u8; 32]> { let RuntimeEvent::XcmpQueue(Event::XcmpMessageSent { message_hash }) = &last_hydra_events(n)[0] else { panic!("expecting to find message sent event"); }; - *message_hash + Some(*message_hash) } #[test] @@ -67,7 +67,7 @@ fn xcm_rate_limiter_should_limit_aca_when_limit_is_exceeded() { ) .into() ), - WeightLimit::Limited(Weight::from_ref_time(399_600_000_000)) + WeightLimit::Limited(Weight::from_parts(399_600_000_000, 0)) )); message_hash = get_message_hash_from_event(2); @@ -79,20 +79,24 @@ fn xcm_rate_limiter_should_limit_aca_when_limit_is_exceeded() { ); }); + let relay_block = PolkadotRelay::execute_with(|| { + polkadot_runtime::System::block_number() + }); + Hydra::execute_with(|| { expect_hydra_events(vec![ cumulus_pallet_xcmp_queue::Event::XcmDeferred { sender: ACALA_PARA_ID.into(), - sent_at: 3, - deferred_to: hydradx_runtime::DeferDuration::get() + 4, + sent_at: relay_block, + deferred_to: hydradx_runtime::DeferDuration::get() + relay_block - 1, message_hash, - index: (hydradx_runtime::DeferDuration::get() + 4, 0), + index: (hydradx_runtime::DeferDuration::get() + relay_block - 1, 0), position: 0, } .into(), pallet_relaychain_info::Event::CurrentBlockNumbers { - parachain_block_number: 4, - relaychain_block_number: 5, + parachain_block_number: 5, + relaychain_block_number: relay_block + 1, } .into(), ]); @@ -140,7 +144,7 @@ fn xcm_rate_limiter_should_not_limit_aca_when_limit_is_not_exceeded() { ) .into() ), - WeightLimit::Limited(Weight::from_ref_time(399_600_000_000)) + WeightLimit::Limited(Weight::from_parts(399_600_000_000, 0)) )); // Assert @@ -191,7 +195,7 @@ fn deferred_messages_should_be_executable_by_root() { let amount = 100 * UNITS; let mut message_hash = None; - let max_weight = Weight::from_ref_time(399_600_000_000); + let max_weight = Weight::from_parts(399_600_000_000, 0); Acala::execute_with(|| { // Act assert_ok!(hydradx_runtime::XTokens::transfer( @@ -220,32 +224,37 @@ fn deferred_messages_should_be_executable_by_root() { ); }); + let relay_block = PolkadotRelay::execute_with(|| { + polkadot_runtime::System::block_number() + }); + Hydra::execute_with(|| { expect_hydra_events(vec![ cumulus_pallet_xcmp_queue::Event::XcmDeferred { sender: ACALA_PARA_ID.into(), - sent_at: 3, - deferred_to: hydradx_runtime::DeferDuration::get() + 4, + sent_at: relay_block, + deferred_to: hydradx_runtime::DeferDuration::get() + relay_block - 1, message_hash, - index: (hydradx_runtime::DeferDuration::get() + 4, 0), + index: (hydradx_runtime::DeferDuration::get() + relay_block - 1, 0), position: 0, } .into(), pallet_relaychain_info::Event::CurrentBlockNumbers { - parachain_block_number: 4, - relaychain_block_number: 5, + parachain_block_number: 5, + relaychain_block_number: relay_block + 1, } .into(), ]); assert_eq!(hydradx_runtime::Tokens::free_balance(ACA, &AccountId::from(BOB)), 0); - set_relaychain_block_number(hydradx_runtime::DeferDuration::get() + 4); + set_relaychain_block_number(hydradx_runtime::DeferDuration::get() + relay_block); assert_eq!(hydradx_runtime::Tokens::free_balance(ACA, &AccountId::from(BOB)), 0); assert_ok!(hydradx_runtime::XcmpQueue::service_deferred( hydradx_runtime::RuntimeOrigin::root(), - max_weight, + hydradx_runtime::ReservedXcmpWeight::get(), ACALA_PARA_ID.into(), + hydradx_runtime::MaxDeferredBuckets::get(), )); let fee = hydradx_runtime::Tokens::free_balance(ACA, &hydradx_runtime::Treasury::account_id()); diff --git a/runtime/hydradx/src/weights/xcmp_queue.rs b/runtime/hydradx/src/weights/xcmp_queue.rs index 355d95cbe5..c6197d1d7c 100644 --- a/runtime/hydradx/src/weights/xcmp_queue.rs +++ b/runtime/hydradx/src/weights/xcmp_queue.rs @@ -149,22 +149,4 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for HydraWei .saturating_add(T::DbWeight::get().writes(2)) .saturating_add(Weight::from_parts(0, 15020).saturating_mul(m.into())) } - // Storage: XcmpQueue DeferredMessageBuckets (r:1 w:1) - // Proof Skipped: XcmpQueue DeferredMessageBuckets (max_values: None, max_size: None, mode: Measured) - fn discard_deferred_individual() -> Weight { - // Minimum execution time: 124_783_889 nanoseconds. - Weight::from_ref_time(125_149_821_000 as u64) - .saturating_add(T::DbWeight::get().reads(1 as u64)) - .saturating_add(T::DbWeight::get().writes(1 as u64)) - } - // Storage: XcmpQueue DeferredIndices (r:1 w:1) - // Proof Skipped: XcmpQueue DeferredIndices (max_values: None, max_size: None, mode: Measured) - // Storage: XcmpQueue DeferredMessageBuckets (r:1 w:1) - // Proof Skipped: XcmpQueue DeferredMessageBuckets (max_values: None, max_size: None, mode: Measured) - fn try_place_in_deferred_queue() -> Weight { - // Minimum execution time: 530_788 nanoseconds. - Weight::from_ref_time(537_065_000 as u64) - .saturating_add(T::DbWeight::get().reads(2 as u64)) - .saturating_add(T::DbWeight::get().writes(2 as u64)) - } } From c3e7610964d10a5e23e82199cbf97fd2cf89d0de Mon Sep 17 00:00:00 2001 From: Alexander Popiak Date: Fri, 22 Dec 2023 11:19:02 +0100 Subject: [PATCH 21/24] formatting --- integration-tests/src/xcm_rate_limiter.rs | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/integration-tests/src/xcm_rate_limiter.rs b/integration-tests/src/xcm_rate_limiter.rs index e1662ac60e..62382322de 100644 --- a/integration-tests/src/xcm_rate_limiter.rs +++ b/integration-tests/src/xcm_rate_limiter.rs @@ -79,9 +79,7 @@ fn xcm_rate_limiter_should_limit_aca_when_limit_is_exceeded() { ); }); - let relay_block = PolkadotRelay::execute_with(|| { - polkadot_runtime::System::block_number() - }); + let relay_block = PolkadotRelay::execute_with(|| polkadot_runtime::System::block_number()); Hydra::execute_with(|| { expect_hydra_events(vec![ @@ -224,16 +222,14 @@ fn deferred_messages_should_be_executable_by_root() { ); }); - let relay_block = PolkadotRelay::execute_with(|| { - polkadot_runtime::System::block_number() - }); + let relay_block = PolkadotRelay::execute_with(|| polkadot_runtime::System::block_number()); Hydra::execute_with(|| { expect_hydra_events(vec![ cumulus_pallet_xcmp_queue::Event::XcmDeferred { sender: ACALA_PARA_ID.into(), sent_at: relay_block, - deferred_to: hydradx_runtime::DeferDuration::get() + relay_block - 1, + deferred_to: hydradx_runtime::DeferDuration::get() + relay_block - 1, message_hash, index: (hydradx_runtime::DeferDuration::get() + relay_block - 1, 0), position: 0, From f5de0cac278f71bd48f1c68053d4755f97f441fb Mon Sep 17 00:00:00 2001 From: Alexander Popiak Date: Fri, 22 Dec 2023 11:45:13 +0100 Subject: [PATCH 22/24] bump crate versions --- Cargo.lock | 6 +++--- integration-tests/Cargo.toml | 2 +- pallets/xcm-rate-limiter/Cargo.toml | 2 +- runtime/hydradx/Cargo.toml | 2 +- runtime/hydradx/src/lib.rs | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index fd398e53df..1084e39061 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4617,7 +4617,7 @@ dependencies = [ [[package]] name = "hydradx-runtime" -version = "195.0.0" +version = "196.0.0" dependencies = [ "cumulus-pallet-aura-ext", "cumulus-pallet-dmp-queue", @@ -8645,7 +8645,7 @@ dependencies = [ [[package]] name = "pallet-xcm-rate-limiter" -version = "0.1.3" +version = "0.1.4" dependencies = [ "cumulus-pallet-xcmp-queue", "frame-benchmarking", @@ -11202,7 +11202,7 @@ dependencies = [ [[package]] name = "runtime-integration-tests" -version = "1.17.0" +version = "1.17.1" dependencies = [ "cumulus-pallet-aura-ext", "cumulus-pallet-dmp-queue", diff --git a/integration-tests/Cargo.toml b/integration-tests/Cargo.toml index 0dba04926a..d5abc252aa 100644 --- a/integration-tests/Cargo.toml +++ b/integration-tests/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "runtime-integration-tests" -version = "1.17.0" +version = "1.17.1" description = "Integration tests" authors = ["GalacticCouncil"] edition = "2021" diff --git a/pallets/xcm-rate-limiter/Cargo.toml b/pallets/xcm-rate-limiter/Cargo.toml index e0580fb65c..c562299274 100644 --- a/pallets/xcm-rate-limiter/Cargo.toml +++ b/pallets/xcm-rate-limiter/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-xcm-rate-limiter" -version = "0.1.3" +version = "0.1.4" authors = ["GalacticCouncil "] edition = "2021" license = "Apache-2.0" diff --git a/runtime/hydradx/Cargo.toml b/runtime/hydradx/Cargo.toml index bf92c46964..bcd9925e44 100644 --- a/runtime/hydradx/Cargo.toml +++ b/runtime/hydradx/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "hydradx-runtime" -version = "195.0.0" +version = "196.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 2a2e0491f7..f394b1da35 100644 --- a/runtime/hydradx/src/lib.rs +++ b/runtime/hydradx/src/lib.rs @@ -107,7 +107,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: create_runtime_str!("hydradx"), impl_name: create_runtime_str!("hydradx"), authoring_version: 1, - spec_version: 195, + spec_version: 196, impl_version: 0, apis: RUNTIME_API_VERSIONS, transaction_version: 1, From bbbe2d45f9efa97fad8ebaa044f1095781bfff75 Mon Sep 17 00:00:00 2001 From: Alexander Popiak Date: Fri, 22 Dec 2023 13:01:34 +0100 Subject: [PATCH 23/24] make clippy happy --- integration-tests/src/xcm_rate_limiter.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/integration-tests/src/xcm_rate_limiter.rs b/integration-tests/src/xcm_rate_limiter.rs index 62382322de..a1c21763f2 100644 --- a/integration-tests/src/xcm_rate_limiter.rs +++ b/integration-tests/src/xcm_rate_limiter.rs @@ -74,12 +74,12 @@ fn xcm_rate_limiter_should_limit_aca_when_limit_is_exceeded() { // Assert assert_eq!( - hydradx_runtime::Balances::free_balance(&AccountId::from(ALICE)), + hydradx_runtime::Balances::free_balance(AccountId::from(ALICE)), ALICE_INITIAL_NATIVE_BALANCE - amount ); }); - let relay_block = PolkadotRelay::execute_with(|| polkadot_runtime::System::block_number()); + let relay_block = PolkadotRelay::execute_with(polkadot_runtime::System::block_number); Hydra::execute_with(|| { expect_hydra_events(vec![ @@ -147,7 +147,7 @@ fn xcm_rate_limiter_should_not_limit_aca_when_limit_is_not_exceeded() { // Assert assert_eq!( - hydradx_runtime::Balances::free_balance(&AccountId::from(ALICE)), + hydradx_runtime::Balances::free_balance(AccountId::from(ALICE)), ALICE_INITIAL_NATIVE_BALANCE - amount ); }); @@ -217,12 +217,12 @@ fn deferred_messages_should_be_executable_by_root() { // Assert assert_eq!( - hydradx_runtime::Balances::free_balance(&AccountId::from(ALICE)), + hydradx_runtime::Balances::free_balance(AccountId::from(ALICE)), ALICE_INITIAL_NATIVE_BALANCE - amount ); }); - let relay_block = PolkadotRelay::execute_with(|| polkadot_runtime::System::block_number()); + let relay_block = PolkadotRelay::execute_with(polkadot_runtime::System::block_number); Hydra::execute_with(|| { expect_hydra_events(vec![ From c51a163a8ba08c79fdaa62df4d1724525ff88e3e Mon Sep 17 00:00:00 2001 From: Roznovjak Date: Mon, 25 Dec 2023 20:50:18 +0000 Subject: [PATCH 24/24] add previously removed fn --- integration-tests/src/polkadot_test_net.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/integration-tests/src/polkadot_test_net.rs b/integration-tests/src/polkadot_test_net.rs index 883fe1dbd9..060c9ed0fa 100644 --- a/integration-tests/src/polkadot_test_net.rs +++ b/integration-tests/src/polkadot_test_net.rs @@ -684,3 +684,12 @@ pub fn init_omnipool() { set_zero_reward_for_referrals(DAI); set_zero_reward_for_referrals(HDX); } + +pub fn set_zero_reward_for_referrals(asset_id: AssetId) { + assert_ok!(Referrals::set_reward_percentage( + RawOrigin::Root.into(), + asset_id, + Level::None, + FeeDistribution::default(), + )); +}