mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 09:21:04 +00:00
add max_pov_size to runtime config and PersistedValidationData (#1984)
* add max_pov_size to runtime config and PersistedValidationData Closes #1572. * set default genesis max_pov_size * apply suggestions from code review * add default max_pov_size to polkadot_testnet_genesis
This commit is contained in:
committed by
GitHub
parent
5ac497d431
commit
d13a335df6
@@ -43,6 +43,8 @@ pub struct HostConfiguration<BlockNumber> {
|
||||
pub max_code_size: u32,
|
||||
/// The maximum head-data size, in bytes.
|
||||
pub max_head_data_size: u32,
|
||||
/// THe maximum POV block size, in bytes.
|
||||
pub max_pov_size: u32,
|
||||
/// The amount of execution cores to dedicate to parathread execution.
|
||||
pub parathread_cores: u32,
|
||||
/// The number of retries that a parathread author has to submit their block.
|
||||
@@ -172,6 +174,16 @@ decl_module! {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Set the max POV block size for incoming upgrades.
|
||||
#[weight = (1_000, DispatchClass::Operational)]
|
||||
pub fn set_max_pov_size(origin, new: u32) -> DispatchResult {
|
||||
ensure_root(origin)?;
|
||||
Self::update_config_member(|config| {
|
||||
sp_std::mem::replace(&mut config.max_pov_size, new) != new
|
||||
});
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Set the max head data size for paras.
|
||||
#[weight = (1_000, DispatchClass::Operational)]
|
||||
pub fn set_max_head_data_size(origin, new: u32) -> DispatchResult {
|
||||
@@ -484,6 +496,7 @@ mod tests {
|
||||
validation_upgrade_delay: 10,
|
||||
acceptance_period: 5,
|
||||
max_code_size: 100_000,
|
||||
max_pov_size: 1024,
|
||||
max_head_data_size: 1_000,
|
||||
parathread_cores: 2,
|
||||
parathread_retries: 5,
|
||||
@@ -524,6 +537,9 @@ mod tests {
|
||||
Configuration::set_max_code_size(
|
||||
Origin::root(), new_config.max_code_size,
|
||||
).unwrap();
|
||||
Configuration::set_max_pov_size(
|
||||
Origin::root(), new_config.max_pov_size,
|
||||
).unwrap();
|
||||
Configuration::set_max_head_data_size(
|
||||
Origin::root(), new_config.max_head_data_size,
|
||||
).unwrap();
|
||||
|
||||
@@ -28,6 +28,7 @@ use crate::{configuration, paras, dmp, hrmp};
|
||||
pub fn make_persisted_validation_data<T: paras::Trait + hrmp::Trait>(
|
||||
para_id: ParaId,
|
||||
) -> Option<PersistedValidationData<T::BlockNumber>> {
|
||||
let config = <configuration::Module<T>>::config();
|
||||
let relay_parent_number = <frame_system::Module<T>>::block_number() - One::one();
|
||||
|
||||
Some(PersistedValidationData {
|
||||
@@ -35,6 +36,7 @@ pub fn make_persisted_validation_data<T: paras::Trait + hrmp::Trait>(
|
||||
block_number: relay_parent_number,
|
||||
hrmp_mqc_heads: <hrmp::Module<T>>::hrmp_mqc_heads(para_id),
|
||||
dmq_mqc_head: <dmp::Module<T>>::dmq_mqc_head(para_id),
|
||||
max_pov_size: config.max_pov_size,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user