From 2b197180ad488a9ec6168f95854e66f7152ce328 Mon Sep 17 00:00:00 2001 From: Branislav Kontur Date: Fri, 16 Feb 2024 14:09:07 +0100 Subject: [PATCH 01/11] Update relay/kusama/src/lib.rs --- relay/kusama/src/lib.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/relay/kusama/src/lib.rs b/relay/kusama/src/lib.rs index 1575a1c0d2..e60c698f5e 100644 --- a/relay/kusama/src/lib.rs +++ b/relay/kusama/src/lib.rs @@ -936,7 +936,6 @@ impl pallet_identity::Config for Runtime { type Slashed = Treasury; type ForceOrigin = EitherOf, GeneralAdmin>; type RegistrarOrigin = EitherOf, GeneralAdmin>; - // TODO:(PR#159) check adds bellow and remove this comment! type OffchainSignature = Signature; type SigningPublicKey = ::Signer; type UsernameAuthorityOrigin = EnsureRoot; From 54e8b05ff94f8197c8a82946ab0ce364360ee2bb Mon Sep 17 00:00:00 2001 From: Branislav Kontur Date: Fri, 16 Feb 2024 14:09:12 +0100 Subject: [PATCH 02/11] Update relay/polkadot/src/lib.rs --- relay/polkadot/src/lib.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/relay/polkadot/src/lib.rs b/relay/polkadot/src/lib.rs index 64f119c129..8541e240f0 100644 --- a/relay/polkadot/src/lib.rs +++ b/relay/polkadot/src/lib.rs @@ -817,7 +817,6 @@ impl pallet_identity::Config for Runtime { type Slashed = Treasury; type ForceOrigin = EitherOf, GeneralAdmin>; type RegistrarOrigin = EitherOf, GeneralAdmin>; - // TODO:(PR#159) check adds bellow and remove this comment! type OffchainSignature = Signature; type SigningPublicKey = ::Signer; type UsernameAuthorityOrigin = EnsureRoot; From 36e80203e9842f9d50971f3aae8a5f85792e974f Mon Sep 17 00:00:00 2001 From: Branislav Kontur Date: Fri, 16 Feb 2024 13:56:41 +0100 Subject: [PATCH 03/11] [xcm] adapt https://github.com/paritytech/polkadot-sdk/pull/2422 (IsChildSystemParachain) --- Cargo.lock | 4 +-- relay/kusama/constants/Cargo.toml | 4 +-- relay/kusama/constants/src/lib.rs | 18 +++---------- relay/polkadot/constants/Cargo.toml | 4 +-- relay/polkadot/constants/src/lib.rs | 18 +++---------- .../asset-hub-kusama/src/xcm_config.rs | 27 ++++++------------- .../asset-hub-polkadot/src/xcm_config.rs | 23 ++++------------ .../bridge-hub-kusama/src/xcm_config.rs | 23 +++++----------- .../bridge-hub-polkadot/src/xcm_config.rs | 19 +++---------- .../collectives-polkadot/src/xcm_config.rs | 20 ++++---------- 10 files changed, 43 insertions(+), 117 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ac1ac8e0f1..ea4889ec5d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5332,7 +5332,7 @@ dependencies = [ "sp-core 28.0.0", "sp-runtime 31.0.1", "sp-weights 27.0.0", - "staging-xcm 7.0.0", + "staging-xcm-builder 7.0.3", ] [[package]] @@ -9722,7 +9722,7 @@ dependencies = [ "sp-core 28.0.0", "sp-runtime 31.0.1", "sp-weights 27.0.0", - "staging-xcm 7.0.0", + "staging-xcm-builder 7.0.3", ] [[package]] diff --git a/relay/kusama/constants/Cargo.toml b/relay/kusama/constants/Cargo.toml index 99e9e84975..f62cc11612 100644 --- a/relay/kusama/constants/Cargo.toml +++ b/relay/kusama/constants/Cargo.toml @@ -16,7 +16,7 @@ sp-runtime = { default-features = false , version = "31.0.1" } sp-weights = { default-features = false , version = "27.0.0" } sp-core = { default-features = false , version = "28.0.0" } -xcm = { package = "staging-xcm", default-features = false , version = "7.0.0" } +xcm-builder = { package = "staging-xcm-builder", default-features = false , version = "7.0.3" } [features] default = [ "std" ] @@ -27,5 +27,5 @@ std = [ "sp-core/std", "sp-runtime/std", "sp-weights/std", - "xcm/std" + "xcm-builder/std" ] diff --git a/relay/kusama/constants/src/lib.rs b/relay/kusama/constants/src/lib.rs index 342359608b..cda697ace0 100644 --- a/relay/kusama/constants/src/lib.rs +++ b/relay/kusama/constants/src/lib.rs @@ -99,7 +99,8 @@ pub mod fee { /// System Parachains. pub mod system_parachain { - use xcm::latest::prelude::*; + use primitives::Id; + use xcm_builder::IsChildSystemParachain; /// Asset Hub parachain ID. pub const ASSET_HUB_ID: u32 = 1000; @@ -108,19 +109,8 @@ pub mod system_parachain { /// Bridge Hub parachain ID. pub const BRIDGE_HUB_ID: u32 = 1002; - frame_support::match_types! { - // System parachains from Kusama point of view. - pub type SystemParachains: impl Contains = { - MultiLocation { - parents: 0, - interior: X1(Parachain( - ASSET_HUB_ID | - ENCOINTER_ID | - BRIDGE_HUB_ID - )), - } - }; - } + // System parachains from Kusama point of view. + pub type SystemParachains = IsChildSystemParachain; } /// Kusama Treasury pallet instance. diff --git a/relay/polkadot/constants/Cargo.toml b/relay/polkadot/constants/Cargo.toml index 9aca9fd84a..1c7250e884 100644 --- a/relay/polkadot/constants/Cargo.toml +++ b/relay/polkadot/constants/Cargo.toml @@ -16,7 +16,7 @@ sp-runtime = { default-features = false , version = "31.0.1" } sp-weights = { default-features = false , version = "27.0.0" } sp-core = { default-features = false , version = "28.0.0" } -xcm = { package = "staging-xcm", default-features = false , version = "7.0.0" } +xcm-builder = { package = "staging-xcm-builder", default-features = false , version = "7.0.3" } [features] default = [ "std" ] @@ -27,5 +27,5 @@ std = [ "sp-core/std", "sp-runtime/std", "sp-weights/std", - "xcm/std" + "xcm-builder/std" ] diff --git a/relay/polkadot/constants/src/lib.rs b/relay/polkadot/constants/src/lib.rs index 113c825ac6..e64b27d7b9 100644 --- a/relay/polkadot/constants/src/lib.rs +++ b/relay/polkadot/constants/src/lib.rs @@ -115,7 +115,8 @@ pub mod xcm { /// System Parachains. pub mod system_parachain { - use xcm::latest::prelude::*; + use primitives::Id; + use xcm_builder::IsChildSystemParachain; /// Asset Hub parachain ID. pub const ASSET_HUB_ID: u32 = 1000; @@ -124,19 +125,8 @@ pub mod system_parachain { /// Bridge Hub parachain ID. pub const BRIDGE_HUB_ID: u32 = 1002; - frame_support::match_types! { - // System parachains from Polkadot point of view. - pub type SystemParachains: impl Contains = { - MultiLocation { - parents: 0, - interior: X1(Parachain( - ASSET_HUB_ID | - COLLECTIVES_ID | - BRIDGE_HUB_ID - )), - } - }; - } + // System parachains from Polkadot point of view. + pub type SystemParachains = IsChildSystemParachain; } /// Polkadot Treasury pallet instance. diff --git a/system-parachains/asset-hubs/asset-hub-kusama/src/xcm_config.rs b/system-parachains/asset-hubs/asset-hub-kusama/src/xcm_config.rs index 8d8665c0dd..774edf68b4 100644 --- a/system-parachains/asset-hubs/asset-hub-kusama/src/xcm_config.rs +++ b/system-parachains/asset-hubs/asset-hub-kusama/src/xcm_config.rs @@ -26,13 +26,12 @@ use frame_support::{ traits::{ConstU32, Contains, Equals, Everything, Nothing, PalletInfoAccess}, }; use frame_system::EnsureRoot; -use kusama_runtime_constants::system_parachain; use pallet_xcm::XcmPassthrough; use parachains_common::{ impls::ToStakingPot, xcm_config::{ - AssetFeeAsExistentialDepositMultiplier, ConcreteAssetFromSystem, - RelayOrOtherSystemParachains, + AllSiblingSystemParachains, AssetFeeAsExistentialDepositMultiplier, + ConcreteAssetFromSystem, RelayOrOtherSystemParachains, }, }; use polkadot_parachain_primitives::primitives::Sibling; @@ -130,8 +129,8 @@ pub type ForeignAssetsConvertedConcreteId = assets_common::ForeignAssetsConverte // Ignore `TrustBackedAssets` explicitly StartsWith, // Ignore assets that start explicitly with our `GlobalConsensus(NetworkId)`, means: - // - foreign assets from our consensus should be: `MultiLocation {parents: 1, - // X*(Parachain(xyz), ..)}` + // - foreign assets from our consensus should be: `Location {parents: 1, X*(Parachain(xyz), + // ..)}` // - foreign assets outside our consensus with the same `GlobalConsensus(NetworkId)` won't // be accepted here StartsWithExplicitGlobalConsensus, @@ -479,23 +478,13 @@ pub type AssetFeeAsExistentialDepositMultiplierFeeCharger = AssetFeeAsExistentia TrustBackedAssetsInstance, >; -match_types! { - pub type SystemParachains: impl Contains = { - MultiLocation { - parents: 1, - interior: X1(Parachain( - system_parachain::ENCOINTER_ID | - system_parachain::BRIDGE_HUB_ID - )), - } - }; -} - /// Locations that will not be charged fees in the executor, /// either execution or delivery. /// We only waive fees for system functions, which these locations represent. -pub type WaivedLocations = - (RelayOrOtherSystemParachains, Equals); +pub type WaivedLocations = ( + RelayOrOtherSystemParachains, + Equals, +); /// Cases where a remote origin is accepted as trusted Teleporter for a given asset: /// diff --git a/system-parachains/asset-hubs/asset-hub-polkadot/src/xcm_config.rs b/system-parachains/asset-hubs/asset-hub-polkadot/src/xcm_config.rs index 1391ec1266..606ef93034 100644 --- a/system-parachains/asset-hubs/asset-hub-polkadot/src/xcm_config.rs +++ b/system-parachains/asset-hubs/asset-hub-polkadot/src/xcm_config.rs @@ -30,12 +30,11 @@ use pallet_xcm::XcmPassthrough; use parachains_common::{ impls::ToStakingPot, xcm_config::{ - AssetFeeAsExistentialDepositMultiplier, ConcreteAssetFromSystem, - RelayOrOtherSystemParachains, + AllSiblingSystemParachains, AssetFeeAsExistentialDepositMultiplier, + ConcreteAssetFromSystem, RelayOrOtherSystemParachains, }, }; use polkadot_parachain_primitives::primitives::Sibling; -use polkadot_runtime_constants::system_parachain; use sp_runtime::traits::{AccountIdConversion, ConvertInto}; use system_parachains_constants::TREASURY_PALLET_ID; use xcm::latest::prelude::*; @@ -126,8 +125,8 @@ pub type ForeignAssetsConvertedConcreteId = assets_common::ForeignAssetsConverte // Ignore `TrustBackedAssets` explicitly StartsWith, // Ignore assets that start explicitly with our `GlobalConsensus(NetworkId)`, means: - // - foreign assets from our consensus should be: `MultiLocation {parents: 1, - // X*(Parachain(xyz), ..)}` + // - foreign assets from our consensus should be: `Location {parents: 1, X*(Parachain(xyz), + // ..)}` // - foreign assets outside our consensus with the same `GlobalConsensus(NetworkId)` won't // be accepted here StartsWithExplicitGlobalConsensus, @@ -422,23 +421,11 @@ pub type AssetFeeAsExistentialDepositMultiplierFeeCharger = AssetFeeAsExistentia TrustBackedAssetsInstance, >; -match_types! { - pub type SystemParachains: impl Contains = { - MultiLocation { - parents: 1, - interior: X1(Parachain( - system_parachain::COLLECTIVES_ID | - system_parachain::BRIDGE_HUB_ID - )), - } - }; -} - /// Locations that will not be charged fees in the executor, /// either execution or delivery. /// We only waive fees for system functions, which these locations represent. pub type WaivedLocations = ( - RelayOrOtherSystemParachains, + RelayOrOtherSystemParachains, Equals, FellowshipEntities, ); diff --git a/system-parachains/bridge-hubs/bridge-hub-kusama/src/xcm_config.rs b/system-parachains/bridge-hubs/bridge-hub-kusama/src/xcm_config.rs index dff1b23071..ae322290ad 100644 --- a/system-parachains/bridge-hubs/bridge-hub-kusama/src/xcm_config.rs +++ b/system-parachains/bridge-hubs/bridge-hub-kusama/src/xcm_config.rs @@ -27,11 +27,12 @@ use frame_support::{ traits::{ConstU32, Contains, Equals, Everything, Nothing}, }; use frame_system::EnsureRoot; -use kusama_runtime_constants::system_parachain; use pallet_xcm::XcmPassthrough; use parachains_common::{ impls::ToStakingPot, - xcm_config::{ConcreteAssetFromSystem, RelayOrOtherSystemParachains}, + xcm_config::{ + AllSiblingSystemParachains, ConcreteAssetFromSystem, RelayOrOtherSystemParachains, + }, }; use polkadot_parachain_primitives::primitives::Sibling; use sp_runtime::traits::AccountIdConversion; @@ -226,23 +227,13 @@ pub type Barrier = TrailingSetTopicAsId< >, >; -match_types! { - pub type SystemParachains: impl Contains = { - MultiLocation { - parents: 1, - interior: X1(Parachain( - system_parachain::ASSET_HUB_ID | - system_parachain::ENCOINTER_ID - )), - } - }; -} - /// Locations that will not be charged fees in the executor, /// either execution or delivery. /// We only waive fees for system functions, which these locations represent. -pub type WaivedLocations = - (RelayOrOtherSystemParachains, Equals); +pub type WaivedLocations = ( + RelayOrOtherSystemParachains, + Equals, +); /// Cases where a remote origin is accepted as trusted Teleporter for a given asset: /// - KSM with the parent Relay Chain and sibling parachains. diff --git a/system-parachains/bridge-hubs/bridge-hub-polkadot/src/xcm_config.rs b/system-parachains/bridge-hubs/bridge-hub-polkadot/src/xcm_config.rs index 35db46788f..6fd603a1f0 100644 --- a/system-parachains/bridge-hubs/bridge-hub-polkadot/src/xcm_config.rs +++ b/system-parachains/bridge-hubs/bridge-hub-polkadot/src/xcm_config.rs @@ -30,10 +30,11 @@ use frame_system::EnsureRoot; use pallet_xcm::XcmPassthrough; use parachains_common::{ impls::ToStakingPot, - xcm_config::{ConcreteAssetFromSystem, RelayOrOtherSystemParachains}, + xcm_config::{ + AllSiblingSystemParachains, ConcreteAssetFromSystem, RelayOrOtherSystemParachains, + }, }; use polkadot_parachain_primitives::primitives::Sibling; -use polkadot_runtime_constants::system_parachain; use sp_runtime::traits::AccountIdConversion; use system_parachains_constants::TREASURY_PALLET_ID; use xcm::latest::prelude::*; @@ -230,23 +231,11 @@ pub type Barrier = TrailingSetTopicAsId< >, >; -match_types! { - pub type SystemParachains: impl Contains = { - MultiLocation { - parents: 1, - interior: X1(Parachain( - system_parachain::ASSET_HUB_ID | - system_parachain::COLLECTIVES_ID - )), - } - }; -} - /// Locations that will not be charged fees in the executor, /// either execution or delivery. /// We only waive fees for system functions, which these locations represent. pub type WaivedLocations = ( - RelayOrOtherSystemParachains, + RelayOrOtherSystemParachains, Equals, FellowsPlurality, ); diff --git a/system-parachains/collectives/collectives-polkadot/src/xcm_config.rs b/system-parachains/collectives/collectives-polkadot/src/xcm_config.rs index a67316518d..e0ce22e858 100644 --- a/system-parachains/collectives/collectives-polkadot/src/xcm_config.rs +++ b/system-parachains/collectives/collectives-polkadot/src/xcm_config.rs @@ -27,10 +27,12 @@ use frame_system::EnsureRoot; use pallet_xcm::XcmPassthrough; use parachains_common::{ impls::ToStakingPot, - xcm_config::{ConcreteAssetFromSystem, RelayOrOtherSystemParachains}, + xcm_config::{ + AllSiblingSystemParachains, ConcreteAssetFromSystem, RelayOrOtherSystemParachains, + }, }; use polkadot_parachain_primitives::primitives::Sibling; -use polkadot_runtime_constants::{system_parachain, xcm as xcm_constants}; +use polkadot_runtime_constants::xcm as xcm_constants; use sp_runtime::traits::AccountIdConversion; use system_parachains_constants::TREASURY_PALLET_ID; use xcm::latest::prelude::*; @@ -253,23 +255,11 @@ pub type Barrier = TrailingSetTopicAsId< >, >; -match_types! { - pub type SystemParachains: impl Contains = { - MultiLocation { - parents: 1, - interior: X1(Parachain( - system_parachain::ASSET_HUB_ID | - system_parachain::BRIDGE_HUB_ID - )), - } - }; -} - /// Locations that will not be charged fees in the executor, /// either execution or delivery. /// We only waive fees for system functions, which these locations represent. pub type WaivedLocations = ( - RelayOrOtherSystemParachains, + RelayOrOtherSystemParachains, Equals, Equals, LocalPlurality, From 44eefcca721585627ebda8dc87c7710abff24c12 Mon Sep 17 00:00:00 2001 From: Branislav Kontur Date: Thu, 15 Feb 2024 13:44:36 +0100 Subject: [PATCH 04/11] [xcm] adapt https://github.com/paritytech/polkadot-sdk/pull/2428 (ParentRelayOrSiblingParachains) --- .../asset-hubs/asset-hub-kusama/src/xcm_config.rs | 8 ++------ .../asset-hubs/asset-hub-polkadot/src/xcm_config.rs | 8 ++------ .../bridge-hubs/bridge-hub-kusama/src/xcm_config.rs | 9 +++------ .../bridge-hubs/bridge-hub-polkadot/src/xcm_config.rs | 9 +++------ .../collectives/collectives-polkadot/src/xcm_config.rs | 9 +++------ 5 files changed, 13 insertions(+), 30 deletions(-) diff --git a/system-parachains/asset-hubs/asset-hub-kusama/src/xcm_config.rs b/system-parachains/asset-hubs/asset-hub-kusama/src/xcm_config.rs index 774edf68b4..3820d5c793 100644 --- a/system-parachains/asset-hubs/asset-hub-kusama/src/xcm_config.rs +++ b/system-parachains/asset-hubs/asset-hub-kusama/src/xcm_config.rs @@ -31,7 +31,7 @@ use parachains_common::{ impls::ToStakingPot, xcm_config::{ AllSiblingSystemParachains, AssetFeeAsExistentialDepositMultiplier, - ConcreteAssetFromSystem, RelayOrOtherSystemParachains, + ConcreteAssetFromSystem, ParentRelayOrSiblingParachains, RelayOrOtherSystemParachains, }, }; use polkadot_parachain_primitives::primitives::Sibling; @@ -214,10 +214,6 @@ match_types! { MultiLocation { parents: 1, interior: Here } | MultiLocation { parents: 1, interior: X1(Plurality { .. }) } }; - pub type ParentOrSiblings: impl Contains = { - MultiLocation { parents: 1, interior: Here } | - MultiLocation { parents: 1, interior: X1(_) } - }; } /// A call filter for the XCM Transact instruction. This is a temporary measure until we properly @@ -462,7 +458,7 @@ pub type Barrier = TrailingSetTopicAsId< Equals, )>, // Subscriptions for version tracking are OK. - AllowSubscriptionsFrom, + AllowSubscriptionsFrom, ), UniversalLocation, ConstU32<8>, diff --git a/system-parachains/asset-hubs/asset-hub-polkadot/src/xcm_config.rs b/system-parachains/asset-hubs/asset-hub-polkadot/src/xcm_config.rs index 606ef93034..6b50feb0d3 100644 --- a/system-parachains/asset-hubs/asset-hub-polkadot/src/xcm_config.rs +++ b/system-parachains/asset-hubs/asset-hub-polkadot/src/xcm_config.rs @@ -31,7 +31,7 @@ use parachains_common::{ impls::ToStakingPot, xcm_config::{ AllSiblingSystemParachains, AssetFeeAsExistentialDepositMultiplier, - ConcreteAssetFromSystem, RelayOrOtherSystemParachains, + ConcreteAssetFromSystem, ParentRelayOrSiblingParachains, RelayOrOtherSystemParachains, }, }; use polkadot_parachain_primitives::primitives::Sibling; @@ -188,10 +188,6 @@ match_types! { MultiLocation { parents: 1, interior: Here } | MultiLocation { parents: 1, interior: X1(Plurality { .. }) } }; - pub type ParentOrSiblings: impl Contains = { - MultiLocation { parents: 1, interior: Here } | - MultiLocation { parents: 1, interior: X1(_) } - }; pub type FellowshipEntities: impl Contains = { // Fellowship Plurality MultiLocation { parents: 1, interior: X2(Parachain(1001), Plurality { id: BodyId::Technical, ..}) } | @@ -405,7 +401,7 @@ pub type Barrier = TrailingSetTopicAsId< Equals, )>, // Subscriptions for version tracking are OK. - AllowSubscriptionsFrom, + AllowSubscriptionsFrom, ), UniversalLocation, ConstU32<8>, diff --git a/system-parachains/bridge-hubs/bridge-hub-kusama/src/xcm_config.rs b/system-parachains/bridge-hubs/bridge-hub-kusama/src/xcm_config.rs index ae322290ad..8d2dbf762d 100644 --- a/system-parachains/bridge-hubs/bridge-hub-kusama/src/xcm_config.rs +++ b/system-parachains/bridge-hubs/bridge-hub-kusama/src/xcm_config.rs @@ -31,7 +31,8 @@ use pallet_xcm::XcmPassthrough; use parachains_common::{ impls::ToStakingPot, xcm_config::{ - AllSiblingSystemParachains, ConcreteAssetFromSystem, RelayOrOtherSystemParachains, + AllSiblingSystemParachains, ConcreteAssetFromSystem, ParentRelayOrSiblingParachains, + RelayOrOtherSystemParachains, }, }; use polkadot_parachain_primitives::primitives::Sibling; @@ -121,10 +122,6 @@ match_types! { MultiLocation { parents: 1, interior: Here } | MultiLocation { parents: 1, interior: X1(Plurality { .. }) } }; - pub type ParentOrSiblings: impl Contains = { - MultiLocation { parents: 1, interior: Here } | - MultiLocation { parents: 1, interior: X1(_) } - }; } /// A call filter for the XCM Transact instruction. This is a temporary measure until we properly /// account for proof size weights. @@ -218,7 +215,7 @@ pub type Barrier = TrailingSetTopicAsId< Equals, )>, // Subscriptions for version tracking are OK. - AllowSubscriptionsFrom, + AllowSubscriptionsFrom, ), UniversalLocation, ConstU32<8>, diff --git a/system-parachains/bridge-hubs/bridge-hub-polkadot/src/xcm_config.rs b/system-parachains/bridge-hubs/bridge-hub-polkadot/src/xcm_config.rs index 6fd603a1f0..d0bb97438c 100644 --- a/system-parachains/bridge-hubs/bridge-hub-polkadot/src/xcm_config.rs +++ b/system-parachains/bridge-hubs/bridge-hub-polkadot/src/xcm_config.rs @@ -31,7 +31,8 @@ use pallet_xcm::XcmPassthrough; use parachains_common::{ impls::ToStakingPot, xcm_config::{ - AllSiblingSystemParachains, ConcreteAssetFromSystem, RelayOrOtherSystemParachains, + AllSiblingSystemParachains, ConcreteAssetFromSystem, ParentRelayOrSiblingParachains, + RelayOrOtherSystemParachains, }, }; use polkadot_parachain_primitives::primitives::Sibling; @@ -121,10 +122,6 @@ match_types! { MultiLocation { parents: 1, interior: Here } | MultiLocation { parents: 1, interior: X1(Plurality { .. }) } }; - pub type ParentOrSiblings: impl Contains = { - MultiLocation { parents: 1, interior: Here } | - MultiLocation { parents: 1, interior: X1(_) } - }; pub type FellowsPlurality: impl Contains = { MultiLocation { parents: 1, interior: X2(Parachain(1001), Plurality { id: BodyId::Technical, ..}) } }; @@ -222,7 +219,7 @@ pub type Barrier = TrailingSetTopicAsId< Equals, )>, // Subscriptions for version tracking are OK. - AllowSubscriptionsFrom, + AllowSubscriptionsFrom, ), UniversalLocation, ConstU32<8>, diff --git a/system-parachains/collectives/collectives-polkadot/src/xcm_config.rs b/system-parachains/collectives/collectives-polkadot/src/xcm_config.rs index e0ce22e858..0325fea242 100644 --- a/system-parachains/collectives/collectives-polkadot/src/xcm_config.rs +++ b/system-parachains/collectives/collectives-polkadot/src/xcm_config.rs @@ -28,7 +28,8 @@ use pallet_xcm::XcmPassthrough; use parachains_common::{ impls::ToStakingPot, xcm_config::{ - AllSiblingSystemParachains, ConcreteAssetFromSystem, RelayOrOtherSystemParachains, + AllSiblingSystemParachains, ConcreteAssetFromSystem, ParentRelayOrSiblingParachains, + RelayOrOtherSystemParachains, }, }; use polkadot_parachain_primitives::primitives::Sibling; @@ -134,10 +135,6 @@ match_types! { MultiLocation { parents: 1, interior: Here } | MultiLocation { parents: 1, interior: X1(Plurality { .. }) } }; - pub type ParentOrSiblings: impl Contains = { - MultiLocation { parents: 1, interior: Here } | - MultiLocation { parents: 1, interior: X1(_) } - }; pub type LocalPlurality: impl Contains = { MultiLocation { parents: 0, interior: X1(Plurality { .. }) } }; @@ -246,7 +243,7 @@ pub type Barrier = TrailingSetTopicAsId< Equals, )>, // Subscriptions for version tracking are OK. - AllowSubscriptionsFrom, + AllowSubscriptionsFrom, ), UniversalLocation, ConstU32<8>, From 31707332a9c8b3ce32c31ef4c52a4a34a99620e9 Mon Sep 17 00:00:00 2001 From: Branislav Kontur Date: Fri, 16 Feb 2024 15:33:18 +0100 Subject: [PATCH 05/11] Change TreasuryArguments for collectives --- .../collectives/collectives-polkadot/src/fellowship/mod.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/system-parachains/collectives/collectives-polkadot/src/fellowship/mod.rs b/system-parachains/collectives/collectives-polkadot/src/fellowship/mod.rs index 8af872a2a2..088e6437f9 100644 --- a/system-parachains/collectives/collectives-polkadot/src/fellowship/mod.rs +++ b/system-parachains/collectives/collectives-polkadot/src/fellowship/mod.rs @@ -345,5 +345,8 @@ impl pallet_treasury::Config for Runtime { type BalanceConverter = AssetRate; type PayoutPeriod = ConstU32<{ 30 * DAYS }>; #[cfg(feature = "runtime-benchmarks")] - type BenchmarkHelper = polkadot_runtime_common::impls::benchmarks::TreasuryArguments; + type BenchmarkHelper = polkadot_runtime_common::impls::benchmarks::TreasuryArguments< + sp_core::ConstU8<1>, + ConstU32<1000>, + >; } From a0a61ae1e9613b6e9a6079dd9ad0ecbb341e89e3 Mon Sep 17 00:00:00 2001 From: Branislav Kontur Date: Fri, 16 Feb 2024 15:59:07 +0100 Subject: [PATCH 06/11] [bridges] Removed older TODO for bridges fees estimation --- .../bridge-hub-kusama/primitives/src/lib.rs | 6 +- .../bridge-hub-kusama/tests/tests.rs | 146 +++++++++++++----- .../bridge-hub-polkadot/primitives/src/lib.rs | 6 +- .../bridge-hub-polkadot/tests/tests.rs | 145 ++++++++++++----- 4 files changed, 227 insertions(+), 76 deletions(-) diff --git a/system-parachains/bridge-hubs/bridge-hub-kusama/primitives/src/lib.rs b/system-parachains/bridge-hubs/bridge-hub-kusama/primitives/src/lib.rs index a746c2e022..d1faa0e11a 100644 --- a/system-parachains/bridge-hubs/bridge-hub-kusama/primitives/src/lib.rs +++ b/system-parachains/bridge-hubs/bridge-hub-kusama/primitives/src/lib.rs @@ -87,15 +87,15 @@ frame_support::parameter_types! { /// The XCM fee that is paid for executing XCM program (with `ExportMessage` instruction) at the Kusama /// BridgeHub. /// (initially was calculated by test `BridgeHubKusama::can_calculate_weight_for_paid_export_message_with_reserve_transfer` + `33%`) - pub const BridgeHubKusamaBaseXcmFeeInKsms: u128 = 16_196_533_317; + pub const BridgeHubKusamaBaseXcmFeeInKsms: u128 = 16_156_041_984; /// Transaction fee that is paid at the Kusama BridgeHub for delivering single inbound message. /// (initially was calculated by test `BridgeHubKusama::can_calculate_fee_for_complex_message_delivery_transaction` + `33%`) - pub const BridgeHubKusamaBaseDeliveryFeeInKsms: u128 = 56_516_280_489; + pub const BridgeHubKusamaBaseDeliveryFeeInKsms: u128 = 56_374_989_788; /// Transaction fee that is paid at the Kusama BridgeHub for delivering single outbound message confirmation. /// (initially was calculated by test `BridgeHubKusama::can_calculate_fee_for_complex_message_confirmation_transaction` + `33%`) - pub const BridgeHubKusamaBaseConfirmationFeeInKsms: u128 = 53_943_614_276; + pub const BridgeHubKusamaBaseConfirmationFeeInKsms: u128 = 53_808_755_240; } /// Compute the total estimated fee that needs to be paid in KSMs by the sender when sending diff --git a/system-parachains/bridge-hubs/bridge-hub-kusama/tests/tests.rs b/system-parachains/bridge-hubs/bridge-hub-kusama/tests/tests.rs index bf614b2096..4b93dd7e73 100644 --- a/system-parachains/bridge-hubs/bridge-hub-kusama/tests/tests.rs +++ b/system-parachains/bridge-hubs/bridge-hub-kusama/tests/tests.rs @@ -26,11 +26,11 @@ use bridge_hub_kusama_runtime::{ xcm_config::{KsmRelayLocation, RelayNetwork, XcmConfig}, AllPalletsWithoutSystem, BridgeRejectObsoleteHeadersAndMessages, Executive, ExistentialDeposit, ParachainSystem, PolkadotXcm, Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin, SessionKeys, - SignedExtra, UncheckedExtrinsic, + SignedExtra, TransactionPayment, UncheckedExtrinsic, }; use bridge_hub_test_utils::test_cases::from_parachain; use codec::{Decode, Encode}; -use frame_support::{parameter_types, traits::ConstU8}; +use frame_support::{dispatch::GetDispatchInfo, parameter_types, traits::ConstU8}; use parachains_common::{AccountId, AuraId, Balance}; use sp_keyring::AccountKeyring::Alice; use sp_runtime::{ @@ -97,6 +97,13 @@ fn construct_and_apply_extrinsic( r.unwrap() } +fn construct_and_estimate_extrinsic_fee(batch: pallet_utility::Call) -> Balance { + let batch_call = RuntimeCall::Utility(batch); + let batch_info = batch_call.get_dispatch_info(); + let xt = construct_extrinsic(Alice, batch_call); + TransactionPayment::compute_fee(xt.encoded_size() as _, &batch_info, 0) +} + fn collator_session_keys() -> bridge_hub_test_utils::CollatorSessionKeys { bridge_hub_test_utils::CollatorSessionKeys::new( AccountId::from(Alice), @@ -261,42 +268,111 @@ pub fn complex_relay_extrinsic_works() { #[test] pub fn can_calculate_weight_for_paid_export_message_with_reserve_transfer() { - let estimated = bridge_hub_test_utils::test_cases::can_calculate_weight_for_paid_export_message_with_reserve_transfer::< - Runtime, - XcmConfig, - WeightToFee, - >(); + check_sane_fees_values( + "bp_bridge_hub_kusama::BridgeHubKusamaBaseXcmFeeInKsms", + bp_bridge_hub_kusama::BridgeHubKusamaBaseXcmFeeInKsms::get(), + || { + bridge_hub_test_utils::test_cases::can_calculate_weight_for_paid_export_message_with_reserve_transfer::< + Runtime, + XcmConfig, + WeightToFee, + >() + }, + Perbill::from_percent(33), + Some(-33), + &format!( + "Estimate fee for `ExportMessage` for runtime: {:?}", + ::Version::get() + ), + ) +} + +#[test] +pub fn can_calculate_fee_for_complex_message_delivery_transaction() { + check_sane_fees_values( + "bp_bridge_hub_kusama::BridgeHubKusamaBaseDeliveryFeeInKsms", + bp_bridge_hub_kusama::BridgeHubKusamaBaseDeliveryFeeInKsms::get(), + || { + from_parachain::can_calculate_fee_for_complex_message_delivery_transaction::< + RuntimeTestsAdapter, + >(collator_session_keys(), construct_and_estimate_extrinsic_fee) + }, + Perbill::from_percent(33), + Some(-33), + &format!( + "Estimate fee for `single message delivery` for runtime: {:?}", + ::Version::get() + ), + ) +} + +#[test] +pub fn can_calculate_fee_for_complex_message_confirmation_transaction() { + check_sane_fees_values( + "bp_bridge_hub_kusama::BridgeHubKusamaBaseConfirmationFeeInKsms", + bp_bridge_hub_kusama::BridgeHubKusamaBaseConfirmationFeeInKsms::get(), + || { + from_parachain::can_calculate_fee_for_complex_message_confirmation_transaction::< + RuntimeTestsAdapter, + >(collator_session_keys(), construct_and_estimate_extrinsic_fee) + }, + Perbill::from_percent(33), + Some(-33), + &format!( + "Estimate fee for `single message confirmation` for runtime: {:?}", + ::Version::get() + ), + ) +} + +use sp_runtime::Perbill; + +// TODO:(PR#159): remove when `polkadot-sdk@1.8.0` bump +/// A helper function for comparing the actual value of a fee constant with its estimated value. The +/// estimated value can be overestimated (`overestimate_in_percent`), and if the difference to the +/// actual value is below `margin_overestimate_diff_in_percent_for_lowering`, we should lower the +/// actual value. +pub fn check_sane_fees_values( + const_name: &str, + actual: u128, + calculate_estimated_fee: fn() -> u128, + overestimate_in_percent: Perbill, + margin_overestimate_diff_in_percent_for_lowering: Option, + label: &str, +) { + let estimated = calculate_estimated_fee(); + let estimated_plus_overestimate = estimated + (overestimate_in_percent * estimated); + let diff_to_estimated = diff_as_percent(actual, estimated); + let diff_to_estimated_plus_overestimate = diff_as_percent(actual, estimated_plus_overestimate); + + log::error!( + target: "bridges::estimate", + "{label}:\nconstant: {const_name}\n[+] actual: {actual}\n[+] estimated: {estimated} ({diff_to_estimated:.2?})\n[+] estimated(+33%): {estimated_plus_overestimate} ({diff_to_estimated_plus_overestimate:.2?})", + ); // check if estimated value is sane - let max_expected = bp_bridge_hub_kusama::BridgeHubKusamaBaseXcmFeeInKsms::get(); assert!( - estimated <= max_expected, - "calculated: {:?}, max_expected: {:?}, please adjust `bp_bridge_hub_kusama::BridgeHubKusamaBaseXcmFeeInKsms` value", - estimated, - max_expected + estimated <= actual, + "estimated: {estimated}, actual: {actual}, please adjust `{const_name}` to the value: {estimated_plus_overestimate}", + ); + assert!( + estimated_plus_overestimate <= actual, + "estimated_plus_overestimate: {estimated_plus_overestimate}, actual: {actual}, please adjust `{const_name}` to the value: {estimated_plus_overestimate}", + ); + + if let Some(margin_overestimate_diff_in_percent_for_lowering) = + margin_overestimate_diff_in_percent_for_lowering + { + assert!( + diff_to_estimated_plus_overestimate > margin_overestimate_diff_in_percent_for_lowering as f64, + "diff_to_estimated_plus_overestimate: {diff_to_estimated_plus_overestimate:.2}, overestimate_diff_in_percent_for_lowering: {margin_overestimate_diff_in_percent_for_lowering}, please adjust `{const_name}` to the value: {estimated_plus_overestimate}", ); + } } -// TODO: replace me with direct usages of `bridge_hub_test_utils` after deps are bumped to (at -// least) 1.4 -// -// Following two tests have to be implemented properly after upgrade to 1.6. -// See https://github.com/paritytech/polkadot-sdk/pull/2139/ and https://github.com/paritytech/parity-bridges-common/pull/2728 -// for impl details -// -// Until that, anyone can run it manually by doing following: -// -// 1) cargo vendor ../vendored-dependencies -// 2) apply relevant changes from above PRs -// 3) change workspace Cargo.toml: -// [patch.crates-io] -// bp-polkadot-core = { path = "../vendored-dependencies/bp-polkadot-core" } -// bridge-hub-test-utils = { path = "../vendored-dependencies/bridge-hub-test-utils" } -// bridge-runtime-common = { path = "../vendored-dependencies/bridge-runtime-common" } -// 4) add actual tests code and do `cargo test -p bridge-hub-polkadot-runtime` - -#[test] -pub fn can_calculate_fee_for_complex_message_delivery_transaction() {} - -#[test] -pub fn can_calculate_fee_for_complex_message_confirmation_transaction() {} +// TODO:(PR#159): remove when `polkadot-sdk@1.8.0` bump +pub fn diff_as_percent(left: u128, right: u128) -> f64 { + let left = left as f64; + let right = right as f64; + ((left - right).abs() / left) * 100f64 * (if left >= right { -1 } else { 1 }) as f64 +} diff --git a/system-parachains/bridge-hubs/bridge-hub-polkadot/primitives/src/lib.rs b/system-parachains/bridge-hubs/bridge-hub-polkadot/primitives/src/lib.rs index b02f6107d6..50c7713549 100644 --- a/system-parachains/bridge-hubs/bridge-hub-polkadot/primitives/src/lib.rs +++ b/system-parachains/bridge-hubs/bridge-hub-polkadot/primitives/src/lib.rs @@ -78,15 +78,15 @@ frame_support::parameter_types! { /// The XCM fee that is paid for executing XCM program (with `ExportMessage` instruction) at the Polkadot /// BridgeHub. /// (initially was calculated by test `BridgeHubPolkadot::can_calculate_weight_for_paid_export_message_with_reserve_transfer` + `33%`) - pub const BridgeHubPolkadotBaseXcmFeeInDots: Balance = 4_858_960_000; + pub const BridgeHubPolkadotBaseXcmFeeInDots: Balance = 4_846_812_600; /// Transaction fee that is paid at the Polkadot BridgeHub for delivering single inbound message. /// (initially was calculated by test `BridgeHubPolkadot::can_calculate_fee_for_complex_message_delivery_transaction` + `33%`) - pub const BridgeHubPolkadotBaseDeliveryFeeInDots: Balance = 16_954_899_613; + pub const BridgeHubPolkadotBaseDeliveryFeeInDots: Balance = 16_912_512_364; /// Transaction fee that is paid at the Polkadot BridgeHub for delivering single outbound message confirmation. /// (initially was calculated by test `BridgeHubPolkadot::can_calculate_fee_for_complex_message_confirmation_transaction` + `33%`) - pub const BridgeHubPolkadotBaseConfirmationFeeInDots: Balance = 16_183_099_613; + pub const BridgeHubPolkadotBaseConfirmationFeeInDots: Balance = 16_142_641_864; } /// Compute the total estimated fee that needs to be paid in DOTs by the sender when sending diff --git a/system-parachains/bridge-hubs/bridge-hub-polkadot/tests/tests.rs b/system-parachains/bridge-hubs/bridge-hub-polkadot/tests/tests.rs index c3a3517318..0832d31d4b 100644 --- a/system-parachains/bridge-hubs/bridge-hub-polkadot/tests/tests.rs +++ b/system-parachains/bridge-hubs/bridge-hub-polkadot/tests/tests.rs @@ -14,6 +14,7 @@ // You should have received a copy of the GNU General Public License // along with Cumulus. If not, see . +use bp_bridge_hub_kusama::Perbill; use bp_polkadot_core::Signature; use bridge_hub_polkadot_runtime::{ bridge_to_kusama_config::{ @@ -26,11 +27,11 @@ use bridge_hub_polkadot_runtime::{ xcm_config::{DotRelayLocation, RelayNetwork, XcmConfig}, AllPalletsWithoutSystem, BridgeRejectObsoleteHeadersAndMessages, Executive, ExistentialDeposit, ParachainSystem, PolkadotXcm, Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin, SessionKeys, - SignedExtra, UncheckedExtrinsic, + SignedExtra, TransactionPayment, UncheckedExtrinsic, }; use bridge_hub_test_utils::test_cases::from_parachain; use codec::{Decode, Encode}; -use frame_support::{parameter_types, traits::ConstU8}; +use frame_support::{dispatch::GetDispatchInfo, parameter_types, traits::ConstU8}; use parachains_common::{AccountId, AuraId, Balance}; use sp_keyring::AccountKeyring::Alice; use sp_runtime::{ @@ -97,6 +98,13 @@ fn construct_and_apply_extrinsic( r.unwrap() } +fn construct_and_estimate_extrinsic_fee(batch: pallet_utility::Call) -> Balance { + let batch_call = RuntimeCall::Utility(batch); + let batch_info = batch_call.get_dispatch_info(); + let xt = construct_extrinsic(Alice, batch_call); + TransactionPayment::compute_fee(xt.encoded_size() as _, &batch_info, 0) +} + fn collator_session_keys() -> bridge_hub_test_utils::CollatorSessionKeys { bridge_hub_test_utils::CollatorSessionKeys::new( AccountId::from(Alice), @@ -261,42 +269,109 @@ pub fn complex_relay_extrinsic_works() { #[test] pub fn can_calculate_weight_for_paid_export_message_with_reserve_transfer() { - let estimated = bridge_hub_test_utils::test_cases::can_calculate_weight_for_paid_export_message_with_reserve_transfer::< - Runtime, - XcmConfig, - WeightToFee, - >(); + check_sane_fees_values( + "bp_bridge_hub_polkadot::BridgeHubPolkadotBaseXcmFeeInDots", + bp_bridge_hub_polkadot::BridgeHubPolkadotBaseXcmFeeInDots::get(), + || { + bridge_hub_test_utils::test_cases::can_calculate_weight_for_paid_export_message_with_reserve_transfer::< + Runtime, + XcmConfig, + WeightToFee, + >() + }, + Perbill::from_percent(33), + Some(-33), + &format!( + "Estimate fee for `ExportMessage` for runtime: {:?}", + ::Version::get() + ), + ) +} + +#[test] +pub fn can_calculate_fee_for_complex_message_delivery_transaction() { + check_sane_fees_values( + "bp_bridge_hub_polkadot::BridgeHubPolkadotBaseDeliveryFeeInDots", + bp_bridge_hub_polkadot::BridgeHubPolkadotBaseDeliveryFeeInDots::get(), + || { + from_parachain::can_calculate_fee_for_complex_message_delivery_transaction::< + RuntimeTestsAdapter, + >(collator_session_keys(), construct_and_estimate_extrinsic_fee) + }, + Perbill::from_percent(33), + Some(-33), + &format!( + "Estimate fee for `single message delivery` for runtime: {:?}", + ::Version::get() + ), + ) +} + +#[test] +pub fn can_calculate_fee_for_complex_message_confirmation_transaction() { + check_sane_fees_values( + "bp_bridge_hub_polkadot::BridgeHubPolkadotBaseConfirmationFeeInDots", + bp_bridge_hub_polkadot::BridgeHubPolkadotBaseConfirmationFeeInDots::get(), + || { + from_parachain::can_calculate_fee_for_complex_message_confirmation_transaction::< + RuntimeTestsAdapter, + >(collator_session_keys(), construct_and_estimate_extrinsic_fee) + }, + Perbill::from_percent(33), + Some(-33), + &format!( + "Estimate fee for `single message confirmation` for runtime: {:?}", + ::Version::get() + ), + ) +} + +// TODO:(PR#159): remove when `polkadot-sdk@1.8.0` bump +/// A helper function for comparing the actual value of a fee constant with its estimated value. The +/// estimated value can be overestimated (`overestimate_in_percent`), and if the difference to the +/// actual value is below `margin_overestimate_diff_in_percent_for_lowering`, we should lower the +/// actual value. +pub fn check_sane_fees_values( + const_name: &str, + actual: u128, + calculate_estimated_fee: fn() -> u128, + overestimate_in_percent: Perbill, + margin_overestimate_diff_in_percent_for_lowering: Option, + label: &str, +) { + let estimated = calculate_estimated_fee(); + let estimated_plus_overestimate = estimated + (overestimate_in_percent * estimated); + let diff_to_estimated = diff_as_percent(actual, estimated); + let diff_to_estimated_plus_overestimate = diff_as_percent(actual, estimated_plus_overestimate); + + log::error!( + target: "bridges::estimate", + "{label}:\nconstant: {const_name}\n[+] actual: {actual}\n[+] estimated: {estimated} ({diff_to_estimated:.2?})\n[+] estimated(+33%): {estimated_plus_overestimate} ({diff_to_estimated_plus_overestimate:.2?})", + ); // check if estimated value is sane - let max_expected = bp_bridge_hub_polkadot::BridgeHubPolkadotBaseXcmFeeInDots::get(); assert!( - estimated <= max_expected, - "calculated: {:?}, max_expected: {:?}, please adjust `bp_bridge_hub_polkadot::BridgeHubPolkadotBaseXcmFeeInDots` value", - estimated, - max_expected + estimated <= actual, + "estimated: {estimated}, actual: {actual}, please adjust `{const_name}` to the value: {estimated_plus_overestimate}", + ); + assert!( + estimated_plus_overestimate <= actual, + "estimated_plus_overestimate: {estimated_plus_overestimate}, actual: {actual}, please adjust `{const_name}` to the value: {estimated_plus_overestimate}", + ); + + if let Some(margin_overestimate_diff_in_percent_for_lowering) = + margin_overestimate_diff_in_percent_for_lowering + { + assert!( + diff_to_estimated_plus_overestimate > margin_overestimate_diff_in_percent_for_lowering as f64, + "diff_to_estimated_plus_overestimate: {diff_to_estimated_plus_overestimate:.2}, overestimate_diff_in_percent_for_lowering: {margin_overestimate_diff_in_percent_for_lowering}, please adjust `{const_name}` to the value: {estimated_plus_overestimate}", ); + } } -// TODO: replace me with direct usages of `bridge_hub_test_utils` after deps are bumped to (at -// least) 1.4 -// -// Following two tests have to be implemented properly after upgrade to 1.6. -// See https://github.com/paritytech/polkadot-sdk/pull/2139/ and https://github.com/paritytech/parity-bridges-common/pull/2728 -// for impl details -// -// Until that, anyone can run it manually by doing following: -// -// 1) cargo vendor ../vendored-dependencies -// 2) apply relevant changes from above PRs -// 3) change workspace Cargo.toml: -// [patch.crates-io] -// bp-polkadot-core = { path = "../vendored-dependencies/bp-polkadot-core" } -// bridge-hub-test-utils = { path = "../vendored-dependencies/bridge-hub-test-utils" } -// bridge-runtime-common = { path = "../vendored-dependencies/bridge-runtime-common" } -// 4) add actual tests code and do `cargo test -p bridge-hub-polkadot-runtime` - -#[test] -pub fn can_calculate_fee_for_complex_message_delivery_transaction() {} - -#[test] -pub fn can_calculate_fee_for_complex_message_confirmation_transaction() {} +// TODO:(PR#159): remove when `polkadot-sdk@1.8.0` bump +pub fn diff_as_percent(left: u128, right: u128) -> f64 { + let left = left as f64; + let right = right as f64; + ((left - right).abs() / left) * 100f64 * (if left >= right { -1 } else { 1 }) as f64 +} From b987e8d885b7db7c9897d6a7194f65c1b973ece8 Mon Sep 17 00:00:00 2001 From: Branislav Kontur Date: Fri, 16 Feb 2024 16:03:42 +0100 Subject: [PATCH 07/11] Updated TODOs --- .../bridge-hubs/bridge-hub-kusama/tests/tests.rs | 4 ++-- .../bridge-hubs/bridge-hub-polkadot/tests/tests.rs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/system-parachains/bridge-hubs/bridge-hub-kusama/tests/tests.rs b/system-parachains/bridge-hubs/bridge-hub-kusama/tests/tests.rs index 4b93dd7e73..a69892be80 100644 --- a/system-parachains/bridge-hubs/bridge-hub-kusama/tests/tests.rs +++ b/system-parachains/bridge-hubs/bridge-hub-kusama/tests/tests.rs @@ -327,7 +327,7 @@ pub fn can_calculate_fee_for_complex_message_confirmation_transaction() { use sp_runtime::Perbill; -// TODO:(PR#159): remove when `polkadot-sdk@1.8.0` bump +// TODO:(PR#159): remove when `polkadot-sdk@1.8.0` bump (https://github.com/polkadot-fellows/runtimes/issues/186) /// A helper function for comparing the actual value of a fee constant with its estimated value. The /// estimated value can be overestimated (`overestimate_in_percent`), and if the difference to the /// actual value is below `margin_overestimate_diff_in_percent_for_lowering`, we should lower the @@ -370,7 +370,7 @@ pub fn check_sane_fees_values( } } -// TODO:(PR#159): remove when `polkadot-sdk@1.8.0` bump +// TODO:(PR#159): remove when `polkadot-sdk@1.8.0` bump (https://github.com/polkadot-fellows/runtimes/issues/186) pub fn diff_as_percent(left: u128, right: u128) -> f64 { let left = left as f64; let right = right as f64; diff --git a/system-parachains/bridge-hubs/bridge-hub-polkadot/tests/tests.rs b/system-parachains/bridge-hubs/bridge-hub-polkadot/tests/tests.rs index 0832d31d4b..8d0423f4ee 100644 --- a/system-parachains/bridge-hubs/bridge-hub-polkadot/tests/tests.rs +++ b/system-parachains/bridge-hubs/bridge-hub-polkadot/tests/tests.rs @@ -326,7 +326,7 @@ pub fn can_calculate_fee_for_complex_message_confirmation_transaction() { ) } -// TODO:(PR#159): remove when `polkadot-sdk@1.8.0` bump +// TODO:(PR#159): remove when `polkadot-sdk@1.8.0` bump (https://github.com/polkadot-fellows/runtimes/issues/186) /// A helper function for comparing the actual value of a fee constant with its estimated value. The /// estimated value can be overestimated (`overestimate_in_percent`), and if the difference to the /// actual value is below `margin_overestimate_diff_in_percent_for_lowering`, we should lower the @@ -369,7 +369,7 @@ pub fn check_sane_fees_values( } } -// TODO:(PR#159): remove when `polkadot-sdk@1.8.0` bump +// TODO:(PR#159): remove when `polkadot-sdk@1.8.0` bump (https://github.com/polkadot-fellows/runtimes/issues/186) pub fn diff_as_percent(left: u128, right: u128) -> f64 { let left = left as f64; let right = right as f64; From 4cb2d2ae3943260c755b34c9c4e3e0bc38d7d565 Mon Sep 17 00:00:00 2001 From: Branislav Kontur Date: Fri, 16 Feb 2024 21:19:47 +0100 Subject: [PATCH 08/11] Update relay/kusama/src/lib.rs Co-authored-by: Ross Bulat --- relay/kusama/src/lib.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/relay/kusama/src/lib.rs b/relay/kusama/src/lib.rs index e60c698f5e..29cbe7ff9e 100644 --- a/relay/kusama/src/lib.rs +++ b/relay/kusama/src/lib.rs @@ -683,7 +683,6 @@ impl pallet_staking::Config for Runtime { type NominationsQuota = pallet_staking::FixedNominationsQuota<{ MaxNominations::get() }>; type MaxUnlockingChunks = frame_support::traits::ConstU32<32>; type HistoryDepth = frame_support::traits::ConstU32<84>; - // TODO:(PR#159) check/set correct constant and remove this comment! type MaxControllersInDeprecationBatch = ConstU32<751>; type BenchmarkingConfig = runtime_common::StakingBenchmarkingConfig; type EventListeners = NominationPools; From c724e91b1ac308a4d074f81976df02d3fe120a69 Mon Sep 17 00:00:00 2001 From: Branislav Kontur Date: Fri, 16 Feb 2024 21:19:58 +0100 Subject: [PATCH 09/11] Update relay/polkadot/src/lib.rs Co-authored-by: Ross Bulat --- relay/polkadot/src/lib.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/relay/polkadot/src/lib.rs b/relay/polkadot/src/lib.rs index 8541e240f0..4b07c9d98c 100644 --- a/relay/polkadot/src/lib.rs +++ b/relay/polkadot/src/lib.rs @@ -777,7 +777,6 @@ impl pallet_staking::Config for Runtime { type NominationsQuota = pallet_staking::FixedNominationsQuota<{ MaxNominations::get() }>; type MaxUnlockingChunks = frame_support::traits::ConstU32<32>; type HistoryDepth = frame_support::traits::ConstU32<84>; - // TODO:(PR#159) check/set correct constant and remove this comment! type MaxControllersInDeprecationBatch = ConstU32<751>; type BenchmarkingConfig = runtime_common::StakingBenchmarkingConfig; type EventListeners = NominationPools; From b6293a7aed427ba4336f7af59c06b4a4fd55ac1c Mon Sep 17 00:00:00 2001 From: Branislav Kontur Date: Fri, 16 Feb 2024 21:20:08 +0100 Subject: [PATCH 10/11] Update relay/polkadot/src/lib.rs Co-authored-by: Ross Bulat --- relay/polkadot/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/relay/polkadot/src/lib.rs b/relay/polkadot/src/lib.rs index 4b07c9d98c..2a562ae2c8 100644 --- a/relay/polkadot/src/lib.rs +++ b/relay/polkadot/src/lib.rs @@ -777,7 +777,7 @@ impl pallet_staking::Config for Runtime { type NominationsQuota = pallet_staking::FixedNominationsQuota<{ MaxNominations::get() }>; type MaxUnlockingChunks = frame_support::traits::ConstU32<32>; type HistoryDepth = frame_support::traits::ConstU32<84>; - type MaxControllersInDeprecationBatch = ConstU32<751>; + type MaxControllersInDeprecationBatch = ConstU32<5314>; type BenchmarkingConfig = runtime_common::StakingBenchmarkingConfig; type EventListeners = NominationPools; type WeightInfo = weights::pallet_staking::WeightInfo; From e3a80b572c730baaff4dfe6256fcf2fc1c66cd46 Mon Sep 17 00:00:00 2001 From: Branislav Kontur Date: Fri, 16 Feb 2024 21:20:17 +0100 Subject: [PATCH 11/11] Update relay/kusama/src/lib.rs Co-authored-by: Ross Bulat --- relay/kusama/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/relay/kusama/src/lib.rs b/relay/kusama/src/lib.rs index 29cbe7ff9e..3fdf7f7a76 100644 --- a/relay/kusama/src/lib.rs +++ b/relay/kusama/src/lib.rs @@ -683,7 +683,7 @@ impl pallet_staking::Config for Runtime { type NominationsQuota = pallet_staking::FixedNominationsQuota<{ MaxNominations::get() }>; type MaxUnlockingChunks = frame_support::traits::ConstU32<32>; type HistoryDepth = frame_support::traits::ConstU32<84>; - type MaxControllersInDeprecationBatch = ConstU32<751>; + type MaxControllersInDeprecationBatch = ConstU32<5169>; type BenchmarkingConfig = runtime_common::StakingBenchmarkingConfig; type EventListeners = NominationPools; type WeightInfo = weights::pallet_staking::WeightInfo;