From a8d52394fd4d3f3a2a75a775b0857cd8c5a5a62a Mon Sep 17 00:00:00 2001 From: Alin Dima Date: Thu, 22 Feb 2024 20:47:06 +0200 Subject: [PATCH 1/3] bump ParachainHost to api version 9 (#194) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Will be needed for enabling the fix for https://github.com/paritytech/polkadot-sdk/issues/3144 (unbricking paraids which acquire multiple cores via coretime). Will also be needed in the future for enabling other features, like https://github.com/paritytech/polkadot-sdk/pull/1644 and https://github.com/paritytech/polkadot-sdk/issues/628 --------- Signed-off-by: alindima Co-authored-by: Bastian Köcher --- CHANGELOG.md | 1 + integration-tests/emulated/chains/src/lib.rs | 2 +- relay/kusama/src/lib.rs | 18 +++++++++++------- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f26efe9c56..050db393b5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - MMR leaves generated by `pallet_mmr` point to the next-authority-set of the current block instead of the prior block [polkadot-fellows/runtimes#169](https://github.com/polkadot-fellows/runtimes/pull/169) - Upgrade dependencies to the `polkadot-sdk@1.5.0` release ([polkadot-fellows/runtimes#137](https://github.com/polkadot-fellows/runtimes/pull/137)) - Deprecate the `xcm::body::TREASURER_INDEX` constant and use the standard `Treasury` variant from the `xcm::BodyId` type instead ([polkadot-fellows/runtimes#149](https://github.com/polkadot-fellows/runtimes/pull/149)) +- Bump parachains runtime API to v9 in Kusama to enable the `node_features` function [polkadot-fellows/runtimes#194](https://github.com/polkadot-fellows/runtimes/pull/194) ### Removed diff --git a/integration-tests/emulated/chains/src/lib.rs b/integration-tests/emulated/chains/src/lib.rs index a4e6f3eed7..d56d2b190e 100644 --- a/integration-tests/emulated/chains/src/lib.rs +++ b/integration-tests/emulated/chains/src/lib.rs @@ -56,7 +56,7 @@ decl_test_relay_chains! { Hrmp: polkadot_runtime::Hrmp, } }, - #[api_version(8)] + #[api_version(9)] pub struct Kusama { genesis = kusama::genesis(), on_init = (), diff --git a/relay/kusama/src/lib.rs b/relay/kusama/src/lib.rs index 9460ee3c25..133aa3d81e 100644 --- a/relay/kusama/src/lib.rs +++ b/relay/kusama/src/lib.rs @@ -23,12 +23,12 @@ use pallet_nis::WithMaximumOf; use parity_scale_codec::{Decode, Encode, MaxEncodedLen}; use primitives::{ - slashing, AccountId, AccountIndex, Balance, BlockNumber, CandidateEvent, CandidateHash, - CommittedCandidateReceipt, CoreState, DisputeState, ExecutorParams, GroupRotationInfo, Hash, - Id as ParaId, InboundDownwardMessage, InboundHrmpMessage, Moment, Nonce, - OccupiedCoreAssumption, PersistedValidationData, ScrapedOnChainVotes, SessionInfo, Signature, - ValidationCode, ValidationCodeHash, ValidatorId, ValidatorIndex, LOWEST_PUBLIC_ID, - PARACHAIN_KEY_TYPE_ID, + slashing, vstaging::NodeFeatures, AccountId, AccountIndex, Balance, BlockNumber, + CandidateEvent, CandidateHash, CommittedCandidateReceipt, CoreState, DisputeState, + ExecutorParams, GroupRotationInfo, Hash, Id as ParaId, InboundDownwardMessage, + InboundHrmpMessage, Moment, Nonce, OccupiedCoreAssumption, PersistedValidationData, + ScrapedOnChainVotes, SessionInfo, Signature, ValidationCode, ValidationCodeHash, ValidatorId, + ValidatorIndex, LOWEST_PUBLIC_ID, PARACHAIN_KEY_TYPE_ID, }; use runtime_common::{ auctions, claims, crowdloan, impl_runtime_weights, @@ -1821,7 +1821,7 @@ sp_api::impl_runtime_apis! { } } - #[api_version(8)] + #[api_version(9)] impl primitives::runtime_api::ParachainHost for Runtime { fn validators() -> Vec { parachains_runtime_api_impl::validators::() @@ -1968,6 +1968,10 @@ sp_api::impl_runtime_apis! { fn disabled_validators() -> Vec { parachains_vstaging_api_impl::disabled_validators::() } + + fn node_features() -> NodeFeatures { + parachains_vstaging_api_impl::node_features::() + } } impl beefy_primitives::BeefyApi for Runtime { From ff86df60ad81aa9baaa20cb0adb2a4ba072827a5 Mon Sep 17 00:00:00 2001 From: Branislav Kontur Date: Fri, 23 Feb 2024 09:17:07 +0100 Subject: [PATCH 2/3] [pallet_asset_conversion] Fix correct value for MaxSwapPathLength (which fixes also failed benchmark) --- system-parachains/asset-hubs/asset-hub-kusama/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system-parachains/asset-hubs/asset-hub-kusama/src/lib.rs b/system-parachains/asset-hubs/asset-hub-kusama/src/lib.rs index 2050234005..c4b1dafa94 100644 --- a/system-parachains/asset-hubs/asset-hub-kusama/src/lib.rs +++ b/system-parachains/asset-hubs/asset-hub-kusama/src/lib.rs @@ -360,7 +360,7 @@ impl pallet_asset_conversion::Config for Runtime { type LiquidityWithdrawalFee = LiquidityWithdrawalFee; type LPFee = ConstU32<3>; type PalletId = AssetConversionPalletId; - type MaxSwapPathLength = ConstU32<4>; + type MaxSwapPathLength = ConstU32<3>; type MintMinLiquidity = ConstU128<100>; type WeightInfo = weights::pallet_asset_conversion::WeightInfo; #[cfg(feature = "runtime-benchmarks")] From 6930a5bd5f83603e8ac4888f0d5c6a83fac5aec0 Mon Sep 17 00:00:00 2001 From: joe petrowski <25483142+joepetrowski@users.noreply.github.com> Date: Fri, 23 Feb 2024 14:42:57 +0100 Subject: [PATCH 3/3] Add a "Wish for Change" Track (#184) Posting this PR for discussion, but perhaps people have other solutions in mind. The Root track was designed to handle only one referendum at a time, because calls requiring Root are usually sensitive and should be evaluated one at a time. However, we have also used the Root track to make remarks to signal desires/wishes of the network to various bodies in the network (e.g. RFC-12, instructing the Fellowship to add a collective). These statements do not execute any stateful logic that would affect the network, and in my opinion more than one could be evaluated at a time. These referenda should not hold up voting on proposals that actually do require Root, nor be forced to queue (for example, it should be possible to propose two new collectives in parallel). The approval/support requirements are the same as Root, but the origin does not map to any privilege. Passing something on the track is merely a signal. --------- Co-authored-by: Oliver Tale-Yazdi --- CHANGELOG.md | 1 + relay/kusama/src/governance/origins.rs | 3 +++ relay/kusama/src/governance/tracks.rs | 17 ++++++++++++++++- relay/polkadot/src/governance/origins.rs | 3 +++ relay/polkadot/src/governance/tracks.rs | 17 ++++++++++++++++- 5 files changed, 39 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 050db393b5..fd3fc3d74f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Add [Encointer](https://encointer.org) system parachain runtime, completing [RFC22](https://github.com/polkadot-fellows/RFCs/blob/main/text/ 0022-adopt-encointer-runtime.md) ([polkadot-fellows/runtimes#80](https://github.com/polkadot-fellows/runtimes/pull/80)) - Feature for enabling debug prints in the Polkadot and Kusama runtime ([polkadot-fellows/runtimes#85](https://github.com/polkadot-fellows/runtimes/pull/85)) +- Added new "Wish for Change" track ([polkadot-fellows/runtimes#184](https://github.com/polkadot-fellows/runtimes/pull/184)) ### Changed diff --git a/relay/kusama/src/governance/origins.rs b/relay/kusama/src/governance/origins.rs index c5cb035a52..0b55c0056d 100644 --- a/relay/kusama/src/governance/origins.rs +++ b/relay/kusama/src/governance/origins.rs @@ -86,6 +86,8 @@ pub mod pallet_custom_origins { Fellowship8Dan, /// Origin commanded by rank 9 of the Polkadot Fellowship and with a success of 9. Fellowship9Dan, + /// Origin for signaling that the network wishes for some change. + WishForChange, } macro_rules! decl_unit_ensures { @@ -128,6 +130,7 @@ pub mod pallet_custom_origins { ReferendumCanceller, ReferendumKiller, WhitelistedCaller, + WishForChange, FellowshipInitiates: u16 = 0, Fellows: u16 = 3, FellowshipExperts: u16 = 5, diff --git a/relay/kusama/src/governance/tracks.rs b/relay/kusama/src/governance/tracks.rs index c15a445b48..75781deff1 100644 --- a/relay/kusama/src/governance/tracks.rs +++ b/relay/kusama/src/governance/tracks.rs @@ -65,7 +65,7 @@ const APP_WHITELISTED_CALLER: Curve = const SUP_WHITELISTED_CALLER: Curve = Curve::make_reciprocal(1, 28, percent(20), percent(5), percent(50)); -const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo); 15] = [ +const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo); 16] = [ ( 0, pallet_referenda::TrackInfo { @@ -94,6 +94,20 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo); 15 min_support: SUP_WHITELISTED_CALLER, }, ), + ( + 2, + pallet_referenda::TrackInfo { + name: "wish_for_change", + max_deciding: 10, + decision_deposit: 20 * GRAND, + prepare_period: 2 * HOURS, + decision_period: 14 * DAYS, + confirm_period: 24 * HOURS, + min_enactment_period: 10 * MINUTES, + min_approval: APP_ROOT, + min_support: SUP_ROOT, + }, + ), ( 10, pallet_referenda::TrackInfo { @@ -294,6 +308,7 @@ impl pallet_referenda::TracksInfo for TracksInfo { } else if let Ok(custom_origin) = origins::Origin::try_from(id.clone()) { match custom_origin { origins::Origin::WhitelistedCaller => Ok(1), + origins::Origin::WishForChange => Ok(2), // General admin origins::Origin::StakingAdmin => Ok(10), origins::Origin::Treasurer => Ok(11), diff --git a/relay/polkadot/src/governance/origins.rs b/relay/polkadot/src/governance/origins.rs index 551e05e556..ac4f667d39 100644 --- a/relay/polkadot/src/governance/origins.rs +++ b/relay/polkadot/src/governance/origins.rs @@ -61,6 +61,8 @@ pub mod pallet_custom_origins { BigSpender, /// Origin able to dispatch a whitelisted call. WhitelistedCaller, + /// Origin for signaling that the network wishes for some change. + WishForChange, } macro_rules! decl_unit_ensures { @@ -103,6 +105,7 @@ pub mod pallet_custom_origins { ReferendumCanceller, ReferendumKiller, WhitelistedCaller, + WishForChange, ); macro_rules! decl_ensure { diff --git a/relay/polkadot/src/governance/tracks.rs b/relay/polkadot/src/governance/tracks.rs index 6d9f62cf22..4a167d606f 100644 --- a/relay/polkadot/src/governance/tracks.rs +++ b/relay/polkadot/src/governance/tracks.rs @@ -65,7 +65,7 @@ const APP_WHITELISTED_CALLER: Curve = const SUP_WHITELISTED_CALLER: Curve = Curve::make_reciprocal(1, 28, percent(20), percent(5), percent(50)); -const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo); 15] = [ +const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo); 16] = [ ( 0, pallet_referenda::TrackInfo { @@ -94,6 +94,20 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo); 15 min_support: SUP_WHITELISTED_CALLER, }, ), + ( + 2, + pallet_referenda::TrackInfo { + name: "wish_for_change", + max_deciding: 10, + decision_deposit: 20 * GRAND, + prepare_period: 2 * HOURS, + decision_period: 28 * DAYS, + confirm_period: 24 * HOURS, + min_enactment_period: 10 * MINUTES, + min_approval: APP_ROOT, + min_support: SUP_ROOT, + }, + ), ( 10, pallet_referenda::TrackInfo { @@ -294,6 +308,7 @@ impl pallet_referenda::TracksInfo for TracksInfo { } else if let Ok(custom_origin) = origins::Origin::try_from(id.clone()) { match custom_origin { origins::Origin::WhitelistedCaller => Ok(1), + origins::Origin::WishForChange => Ok(2), // General admin origins::Origin::StakingAdmin => Ok(10), origins::Origin::Treasurer => Ok(11),