Companion for substrate#14435 (BenchmarkHelper for frame-system) (#2766)

* Temporary fix for frame_system::set_code benchmark

* Removed temprary fix

* BenchmarkHelper for frame-system (TODO: add stuff for ParachainSystem OnSetCode)

* BenchmarkHelper for frame-system (TODO: add stuff for ParachainSystem OnSetCode)

* Glutton

* Fix benchmarks for `set_code`

* Changed dummy values to non-zero

* update lockfile for {"polkadot", "substrate"}

---------

Co-authored-by: parity-processbot <>
This commit is contained in:
Branislav Kontur
2023-06-23 14:34:54 +02:00
committed by GitHub
parent 443b139aa9
commit 9486fe9704
21 changed files with 421 additions and 286 deletions
@@ -1067,6 +1067,33 @@ impl<T: Config> Pallet<T> {
)],
})
}
/// Prepare/insert relevant data for `schedule_code_upgrade` for benchmarks.
#[cfg(feature = "runtime-benchmarks")]
pub fn initialize_for_set_code_benchmark(max_code_size: u32) {
// insert dummy ValidationData
let vfp = PersistedValidationData {
parent_head: polkadot_parachain::primitives::HeadData(Default::default()),
relay_parent_number: 1,
relay_parent_storage_root: Default::default(),
max_pov_size: 1_000,
};
<ValidationData<T>>::put(&vfp);
// insert dummy HostConfiguration with
let host_config = AbridgedHostConfiguration {
max_code_size,
max_head_data_size: 32 * 1024,
max_upward_queue_count: 8,
max_upward_queue_size: 1024 * 1024,
max_upward_message_size: 4 * 1024,
max_upward_message_num_per_candidate: 2,
hrmp_max_message_num_per_candidate: 2,
validation_upgrade_cooldown: 2,
validation_upgrade_delay: 2,
};
<HostConfiguration<T>>::put(host_config);
}
}
pub struct ParachainSetCode<T>(sp_std::marker::PhantomData<T>);