Skip to content

Commit

Permalink
Activate 10 Mb PoVs (#553)
Browse files Browse the repository at this point in the history
This will activate 10 Mb PoVs on Kusama as soon as the runtime is
upgraded.
The point is that we want to activate it anyway, and we better have it
activated sooner rather than later to allow more time for testing before
proposing that for Polkadot.

CC @eskimor @sandreim

---------

Co-authored-by: Bastian Köcher <[email protected]>
  • Loading branch information
s0me0ne-unkn0wn and bkchr authored Jan 21, 2025
1 parent a9669a2 commit 307c512
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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))
- 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)

Expand Down
58 changes: 51 additions & 7 deletions relay/kusama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ extern crate alloc;
use codec::{Decode, Encode, MaxEncodedLen};
use frame_support::{
dynamic_params::{dynamic_pallet_params, dynamic_params},
traits::{EnsureOrigin, EnsureOriginWithArg},
traits::{EnsureOrigin, EnsureOriginWithArg, OnRuntimeUpgrade},
weights::constants::{WEIGHT_PROOF_SIZE_PER_KB, WEIGHT_REF_TIME_PER_MICROS},
};
use kusama_runtime_constants::system_parachain::coretime::TIMESLICE_PERIOD;
Expand Down Expand Up @@ -57,12 +57,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,
Expand Down Expand Up @@ -1902,6 +1904,47 @@ parameter_types! {
pub const MaxPoolsToMigrate: u32 = 500;
}

const NEW_MAX_POV: u32 = 10 * 1024 * 1024;

pub struct Activate10MbPovs;
impl OnRuntimeUpgrade for Activate10MbPovs {
#[cfg(feature = "try-runtime")]
fn pre_upgrade() -> Result<Vec<u8>, sp_runtime::TryRuntimeError> {
// The pre-upgrade state doesn't matter
Ok(vec![])
}

fn on_runtime_upgrade() -> Weight {
match parachains_configuration::Pallet::<Runtime>::set_max_pov_size(
frame_system::RawOrigin::Root.into(),
NEW_MAX_POV,
) {
Ok(()) =>
weights::runtime_parachains_configuration::WeightInfo::<Runtime>::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<u8>) -> Result<(), sp_runtime::TryRuntimeError> {
let pending = parachains_configuration::PendingConfigs::<Runtime>::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
Expand All @@ -1925,6 +1968,7 @@ pub mod migrations {
Runtime,
MaxPoolsToMigrate,
>,
Activate10MbPovs,
);

/// Migrations/checks that do not need to be versioned and can run on every update.
Expand Down

0 comments on commit 307c512

Please sign in to comment.