From c30bbb9ee7fc9fd73b71cbd40d8ecceed19433d0 Mon Sep 17 00:00:00 2001 From: Dmitry Sinyavin Date: Mon, 20 Jan 2025 13:27:21 +0100 Subject: [PATCH 1/4] Activate 10 Mb PoVs --- relay/kusama/src/lib.rs | 62 ++++++++++++++++++++++++++++++++++++----- 1 file changed, 55 insertions(+), 7 deletions(-) diff --git a/relay/kusama/src/lib.rs b/relay/kusama/src/lib.rs index 5252cf8728..5c9267d89e 100644 --- a/relay/kusama/src/lib.rs +++ b/relay/kusama/src/lib.rs @@ -22,10 +22,12 @@ extern crate alloc; +use core::marker::PhantomData; + use codec::{Decode, Encode, MaxEncodedLen}; use frame_support::{ dynamic_params::{dynamic_pallet_params, dynamic_params}, - traits::EnsureOriginWithArg, + traits::{EnsureOriginWithArg, OnRuntimeUpgrade}, weights::constants::{WEIGHT_PROOF_SIZE_PER_KB, WEIGHT_REF_TIME_PER_MICROS}, }; use kusama_runtime_constants::system_parachain::coretime::TIMESLICE_PERIOD; @@ -57,12 +59,14 @@ use sp_std::{ }; use runtime_parachains::{ - assigner_coretime as parachains_assigner_coretime, configuration as parachains_configuration, - configuration::ActiveConfigHrmpChannelSizeAndCapacityRatio, - coretime, disputes as parachains_disputes, - disputes::slashing as parachains_slashing, - dmp as parachains_dmp, hrmp as parachains_hrmp, inclusion as parachains_inclusion, - inclusion::{AggregateMessageOrigin, UmpQueueId}, + assigner_coretime as parachains_assigner_coretime, + configuration::{ + self as parachains_configuration, ActiveConfigHrmpChannelSizeAndCapacityRatio, WeightInfo, + }, + coretime, + disputes::{self as parachains_disputes, slashing as parachains_slashing}, + dmp as parachains_dmp, hrmp as parachains_hrmp, + inclusion::{self as parachains_inclusion, AggregateMessageOrigin, UmpQueueId}, initializer as parachains_initializer, on_demand as parachains_on_demand, origin as parachains_origin, paras as parachains_paras, paras_inherent as parachains_paras_inherent, reward_points as parachains_reward_points, @@ -1841,6 +1845,50 @@ impl Get for NominationPoolsMigrationV4OldPallet { } } +const NEW_MAX_POV: u32 = 10 * 1024 * 1024; + +pub struct Activate10MbPovs(PhantomData); +impl OnRuntimeUpgrade for Activate10MbPovs +where + T: parachains_configuration::Config, +{ + #[cfg(feature = "try-runtime")] + fn pre_upgrade() -> Result, sp_runtime::TryRuntimeError> { + // The pre-upgrade state doesn't matter + Ok(vec![]) + } + + fn on_runtime_upgrade() -> Weight { + match parachains_configuration::Pallet::::set_max_pov_size( + frame_system::RawOrigin::Root.into(), + NEW_MAX_POV, + ) { + Ok(()) => + weights::runtime_parachains_configuration::WeightInfo::::set_config_with_u32(), + Err(e) => { + log::warn!( + target: LOG_TARGET, + "Failed to set max PoV size. Error: {e:?}" + ); + Weight::zero() + }, + } + } + + #[cfg(feature = "try-runtime")] + fn post_upgrade(_state: Vec) -> Result<(), sp_runtime::TryRuntimeError> { + let pending = parachains_configuration::PendingConfigs::::get(); + let Some((_, last_pending)) = pending.last() else { + return Err(sp_runtime::TryRuntimeError::CannotLookup); + }; + frame_support::ensure!( + last_pending.max_pov_size == NEW_MAX_POV, + "Setting max PoV size to 10 Mb should be pending" + ); + Ok(()) + } +} + /// All migrations that will run on the next runtime upgrade. /// /// This contains the combined migrations of the last 10 releases. It allows to skip runtime From 4b58743a28082ebf284703b8eda3f8fe7775fea9 Mon Sep 17 00:00:00 2001 From: Dmitry Sinyavin Date: Mon, 20 Jan 2025 15:38:44 +0100 Subject: [PATCH 2/4] Add changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5a774ad187..a0226ea79b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,6 +29,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Kusama Treasury: remove funding to the Kappa Sigma Mu Society and disable burn ([polkadot-fellows/runtimes#507](https://github.com/polkadot-fellows/runtimes/pull/507)) - Kusama Treasury: allow burn parameters to be set via OpenGov ([polkadot-fellows/runtimes#511](https://github.com/polkadot-fellows/runtimes/pull/511)) - Remove Snowbridge create agent and channel extrinsics. ([polkadot-fellows/runtimes#506](https://github.com/polkadot-fellows/runtimes/pull/506)) +- Activate 10 Mb PoVs on Kusama ([polkadot-fellows/runtimes#553](https://github.com/polkadot-fellows/runtimes/pull/553)) #### From [#490](https://github.com/polkadot-fellows/runtimes/pull/490) From 6e3353a0a20be5b862a67f88833b27cabb071073 Mon Sep 17 00:00:00 2001 From: Dmitry Sinyavin Date: Mon, 20 Jan 2025 17:59:36 +0100 Subject: [PATCH 3/4] Remove generics --- relay/kusama/src/lib.rs | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/relay/kusama/src/lib.rs b/relay/kusama/src/lib.rs index 77d4cedd48..14004de653 100644 --- a/relay/kusama/src/lib.rs +++ b/relay/kusama/src/lib.rs @@ -22,8 +22,6 @@ extern crate alloc; -use core::marker::PhantomData; - use codec::{Decode, Encode, MaxEncodedLen}; use frame_support::{ dynamic_params::{dynamic_pallet_params, dynamic_params}, @@ -1908,11 +1906,8 @@ parameter_types! { const NEW_MAX_POV: u32 = 10 * 1024 * 1024; -pub struct Activate10MbPovs(PhantomData); -impl OnRuntimeUpgrade for Activate10MbPovs -where - T: parachains_configuration::Config, -{ +pub struct Activate10MbPovs; +impl OnRuntimeUpgrade for Activate10MbPovs { #[cfg(feature = "try-runtime")] fn pre_upgrade() -> Result, sp_runtime::TryRuntimeError> { // The pre-upgrade state doesn't matter @@ -1920,12 +1915,12 @@ where } fn on_runtime_upgrade() -> Weight { - match parachains_configuration::Pallet::::set_max_pov_size( + match parachains_configuration::Pallet::::set_max_pov_size( frame_system::RawOrigin::Root.into(), NEW_MAX_POV, ) { Ok(()) => - weights::runtime_parachains_configuration::WeightInfo::::set_config_with_u32(), + weights::runtime_parachains_configuration::WeightInfo::::set_config_with_u32(), Err(e) => { log::warn!( target: LOG_TARGET, @@ -1938,7 +1933,7 @@ where #[cfg(feature = "try-runtime")] fn post_upgrade(_state: Vec) -> Result<(), sp_runtime::TryRuntimeError> { - let pending = parachains_configuration::PendingConfigs::::get(); + let pending = parachains_configuration::PendingConfigs::::get(); let Some((_, last_pending)) = pending.last() else { return Err(sp_runtime::TryRuntimeError::CannotLookup); }; @@ -1973,7 +1968,7 @@ pub mod migrations { Runtime, MaxPoolsToMigrate, >, - Activate10MbPovs, + Activate10MbPovs, ); /// Migrations/checks that do not need to be versioned and can run on every update. From 693be974cdb66f04c93e3b3020c36118e0733308 Mon Sep 17 00:00:00 2001 From: s0me0ne-unkn0wn <48632512+s0me0ne-unkn0wn@users.noreply.github.com> Date: Mon, 20 Jan 2025 21:16:31 +0100 Subject: [PATCH 4/4] Update CHANGELOG.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Bastian Köcher --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a0226ea79b..27c4002d00 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,7 +29,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Kusama Treasury: remove funding to the Kappa Sigma Mu Society and disable burn ([polkadot-fellows/runtimes#507](https://github.com/polkadot-fellows/runtimes/pull/507)) - Kusama Treasury: allow burn parameters to be set via OpenGov ([polkadot-fellows/runtimes#511](https://github.com/polkadot-fellows/runtimes/pull/511)) - Remove Snowbridge create agent and channel extrinsics. ([polkadot-fellows/runtimes#506](https://github.com/polkadot-fellows/runtimes/pull/506)) -- Activate 10 Mb PoVs on Kusama ([polkadot-fellows/runtimes#553](https://github.com/polkadot-fellows/runtimes/pull/553)) +- Increase max PoV size to 10Mib on Kusama ([polkadot-fellows/runtimes#553](https://github.com/polkadot-fellows/runtimes/pull/553)) #### From [#490](https://github.com/polkadot-fellows/runtimes/pull/490)