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
@@ -52,6 +52,7 @@ runtime-benchmarks = [
"frame-system-benchmarking/runtime-benchmarks",
"frame-system/runtime-benchmarks",
"pallet-glutton/runtime-benchmarks",
"cumulus-pallet-parachain-system/runtime-benchmarks",
"xcm-builder/runtime-benchmarks",
]
std = [
@@ -379,9 +379,18 @@ impl_runtime_apis! {
fn dispatch_benchmark(
config: frame_benchmarking::BenchmarkConfig
) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, sp_runtime::RuntimeString> {
use frame_benchmarking::{Benchmarking, BenchmarkBatch, TrackedStorageKey};
use frame_benchmarking::{Benchmarking, BenchmarkBatch, BenchmarkError, TrackedStorageKey};
use frame_system_benchmarking::Pallet as SystemBench;
impl frame_system_benchmarking::Config for Runtime {}
impl frame_system_benchmarking::Config for Runtime {
fn setup_set_code_requirements(code: &sp_std::vec::Vec<u8>) -> Result<(), BenchmarkError> {
ParachainSystem::initialize_for_set_code_benchmark(code.len() as u32);
Ok(())
}
fn verify_set_code() {
System::assert_last_event(cumulus_pallet_parachain_system::Event::<Runtime>::ValidationFunctionStored.into());
}
}
use frame_support::traits::WhitelistedStorageKeys;
let whitelist: Vec<TrackedStorageKey> = AllPalletsWithSystem::whitelisted_storage_keys();