Create benchmark for the system::set_code instrisic (#13373)

* Still WIP

# Conflicts:
#	frame/system/src/weights.rs

* Still WIP

* Add benchmark for system::set_code intrinsic

fixes #13192

* Fix format

* Add missing benchmark runtime

* Fix lint warning

* Consume the rest of the block and add test verification after the benchmark

* Rewrite set_code function

* Try to fix benchmarks and tests

* Remove weight tags

* Update frame/system/src/tests.rs

Co-authored-by: Bastian Köcher <git@kchr.de>

* Register ReadRuntimeVersionExt for benches

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Fix tests

* Fix deprecations

* Fix deprecations

* ".git/.scripts/commands/bench/bench.sh" pallet dev frame_system

* Add update info and remove obsolete complexity comments.

* ".git/.scripts/commands/fmt/fmt.sh"

* Update frame/system/src/lib.rs

Co-authored-by: Bastian Köcher <git@kchr.de>

* Update frame/system/src/lib.rs

Co-authored-by: Bastian Köcher <git@kchr.de>

* Update frame/system/src/lib.rs

Co-authored-by: Bastian Köcher <git@kchr.de>

* Update frame/system/src/lib.rs

Co-authored-by: Bastian Köcher <git@kchr.de>

* Update frame/system/benchmarking/src/lib.rs

Co-authored-by: Bastian Köcher <git@kchr.de>

* ".git/.scripts/commands/fmt/fmt.sh"

* Update README.md

Just trigger CI rebuild

* Update README.md

Trigger CI

---------

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Co-authored-by: Bastian Köcher <git@kchr.de>
Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Co-authored-by: command-bot <>
This commit is contained in:
Falco Hirschenberger
2023-05-11 18:25:50 +02:00
committed by GitHub
parent 05201c4047
commit 0eeaf7709f
11 changed files with 148 additions and 75 deletions
+75 -47
View File
@@ -18,25 +18,26 @@
//! Autogenerated weights for frame_system
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2023-04-06, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! DATE: 2023-04-13, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `bm2`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz`
//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz`
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024
// Executed Command:
// ./target/production/substrate
// target/production/substrate
// benchmark
// pallet
// --chain=dev
// --steps=50
// --repeat=20
// --pallet=frame_system
// --extrinsic=*
// --execution=wasm
// --wasm-execution=compiled
// --heap-pages=4096
// --output=./frame/system/src/weights.rs
// --json-file=/var/lib/gitlab-runner/builds/zyw4fam_/0/parity/mirrors/substrate/.git/.artifacts/bench.json
// --pallet=frame_system
// --chain=dev
// --header=./HEADER-APACHE2
// --output=./frame/system/src/weights.rs
// --template=./.maintain/frame-weight-template.hbs
#![cfg_attr(rustfmt, rustfmt_skip)]
@@ -44,13 +45,14 @@
#![allow(unused_imports)]
use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
use sp_std::marker::PhantomData;
use core::marker::PhantomData;
/// Weight functions needed for frame_system.
pub trait WeightInfo {
fn remark(b: u32, ) -> Weight;
fn remark_with_event(b: u32, ) -> Weight;
fn set_heap_pages() -> Weight;
fn set_code() -> Weight;
fn set_storage(i: u32, ) -> Weight;
fn kill_storage(i: u32, ) -> Weight;
fn kill_prefix(p: u32, ) -> Weight;
@@ -64,20 +66,20 @@ impl<T: crate::Config> WeightInfo for SubstrateWeight<T> {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 2_430_000 picoseconds.
Weight::from_parts(2_522_000, 0)
// Minimum execution time: 2_344_000 picoseconds.
Weight::from_parts(2_471_000, 0)
// Standard Error: 0
.saturating_add(Weight::from_parts(362, 0).saturating_mul(b.into()))
.saturating_add(Weight::from_parts(364, 0).saturating_mul(b.into()))
}
/// The range of component `b` is `[0, 3932160]`.
fn remark_with_event(b: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 8_738_000 picoseconds.
Weight::from_parts(8_963_000, 0)
// Minimum execution time: 8_815_000 picoseconds.
Weight::from_parts(9_140_000, 0)
// Standard Error: 0
.saturating_add(Weight::from_parts(1_113, 0).saturating_mul(b.into()))
.saturating_add(Weight::from_parts(1_122, 0).saturating_mul(b.into()))
}
/// Storage: System Digest (r:1 w:1)
/// Proof Skipped: System Digest (max_values: Some(1), max_size: None, mode: Measured)
@@ -87,8 +89,21 @@ impl<T: crate::Config> WeightInfo for SubstrateWeight<T> {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `1485`
// Minimum execution time: 5_109_000 picoseconds.
Weight::from_parts(5_336_000, 1485)
// Minimum execution time: 5_233_000 picoseconds.
Weight::from_parts(5_462_000, 1485)
.saturating_add(T::DbWeight::get().reads(1_u64))
.saturating_add(T::DbWeight::get().writes(2_u64))
}
/// Storage: System Digest (r:1 w:1)
/// Proof Skipped: System Digest (max_values: Some(1), max_size: None, mode: Measured)
/// Storage: unknown `0x3a636f6465` (r:0 w:1)
/// Proof Skipped: unknown `0x3a636f6465` (r:0 w:1)
fn set_code() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `1485`
// Minimum execution time: 58_606_683_000 picoseconds.
Weight::from_parts(59_115_121_000, 1485)
.saturating_add(T::DbWeight::get().reads(1_u64))
.saturating_add(T::DbWeight::get().writes(2_u64))
}
@@ -99,10 +114,10 @@ impl<T: crate::Config> WeightInfo for SubstrateWeight<T> {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 2_531_000 picoseconds.
Weight::from_parts(2_617_000, 0)
// Standard Error: 861
.saturating_add(Weight::from_parts(761_465, 0).saturating_mul(i.into()))
// Minimum execution time: 2_317_000 picoseconds.
Weight::from_parts(2_457_000, 0)
// Standard Error: 894
.saturating_add(Weight::from_parts(750_850, 0).saturating_mul(i.into()))
.saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into())))
}
/// Storage: Skipped Metadata (r:0 w:0)
@@ -112,10 +127,10 @@ impl<T: crate::Config> WeightInfo for SubstrateWeight<T> {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 2_631_000 picoseconds.
Weight::from_parts(2_717_000, 0)
// Standard Error: 1_097
.saturating_add(Weight::from_parts(570_803, 0).saturating_mul(i.into()))
// Minimum execution time: 2_498_000 picoseconds.
Weight::from_parts(2_552_000, 0)
// Standard Error: 1_027
.saturating_add(Weight::from_parts(566_064, 0).saturating_mul(i.into()))
.saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into())))
}
/// Storage: Skipped Metadata (r:0 w:0)
@@ -125,10 +140,10 @@ impl<T: crate::Config> WeightInfo for SubstrateWeight<T> {
// Proof Size summary in bytes:
// Measured: `116 + p * (69 ±0)`
// Estimated: `121 + p * (70 ±0)`
// Minimum execution time: 4_692_000 picoseconds.
Weight::from_parts(4_789_000, 121)
// Standard Error: 1_013
.saturating_add(Weight::from_parts(1_143_616, 0).saturating_mul(p.into()))
// Minimum execution time: 4_646_000 picoseconds.
Weight::from_parts(4_725_000, 121)
// Standard Error: 1_195
.saturating_add(Weight::from_parts(1_144_884, 0).saturating_mul(p.into()))
.saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(p.into())))
.saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(p.into())))
.saturating_add(Weight::from_parts(0, 70).saturating_mul(p.into()))
@@ -142,20 +157,20 @@ impl WeightInfo for () {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 2_430_000 picoseconds.
Weight::from_parts(2_522_000, 0)
// Minimum execution time: 2_344_000 picoseconds.
Weight::from_parts(2_471_000, 0)
// Standard Error: 0
.saturating_add(Weight::from_parts(362, 0).saturating_mul(b.into()))
.saturating_add(Weight::from_parts(364, 0).saturating_mul(b.into()))
}
/// The range of component `b` is `[0, 3932160]`.
fn remark_with_event(b: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 8_738_000 picoseconds.
Weight::from_parts(8_963_000, 0)
// Minimum execution time: 8_815_000 picoseconds.
Weight::from_parts(9_140_000, 0)
// Standard Error: 0
.saturating_add(Weight::from_parts(1_113, 0).saturating_mul(b.into()))
.saturating_add(Weight::from_parts(1_122, 0).saturating_mul(b.into()))
}
/// Storage: System Digest (r:1 w:1)
/// Proof Skipped: System Digest (max_values: Some(1), max_size: None, mode: Measured)
@@ -165,8 +180,21 @@ impl WeightInfo for () {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `1485`
// Minimum execution time: 5_109_000 picoseconds.
Weight::from_parts(5_336_000, 1485)
// Minimum execution time: 5_233_000 picoseconds.
Weight::from_parts(5_462_000, 1485)
.saturating_add(RocksDbWeight::get().reads(1_u64))
.saturating_add(RocksDbWeight::get().writes(2_u64))
}
/// Storage: System Digest (r:1 w:1)
/// Proof Skipped: System Digest (max_values: Some(1), max_size: None, mode: Measured)
/// Storage: unknown `0x3a636f6465` (r:0 w:1)
/// Proof Skipped: unknown `0x3a636f6465` (r:0 w:1)
fn set_code() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `1485`
// Minimum execution time: 58_606_683_000 picoseconds.
Weight::from_parts(59_115_121_000, 1485)
.saturating_add(RocksDbWeight::get().reads(1_u64))
.saturating_add(RocksDbWeight::get().writes(2_u64))
}
@@ -177,10 +205,10 @@ impl WeightInfo for () {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 2_531_000 picoseconds.
Weight::from_parts(2_617_000, 0)
// Standard Error: 861
.saturating_add(Weight::from_parts(761_465, 0).saturating_mul(i.into()))
// Minimum execution time: 2_317_000 picoseconds.
Weight::from_parts(2_457_000, 0)
// Standard Error: 894
.saturating_add(Weight::from_parts(750_850, 0).saturating_mul(i.into()))
.saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(i.into())))
}
/// Storage: Skipped Metadata (r:0 w:0)
@@ -190,10 +218,10 @@ impl WeightInfo for () {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 2_631_000 picoseconds.
Weight::from_parts(2_717_000, 0)
// Standard Error: 1_097
.saturating_add(Weight::from_parts(570_803, 0).saturating_mul(i.into()))
// Minimum execution time: 2_498_000 picoseconds.
Weight::from_parts(2_552_000, 0)
// Standard Error: 1_027
.saturating_add(Weight::from_parts(566_064, 0).saturating_mul(i.into()))
.saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(i.into())))
}
/// Storage: Skipped Metadata (r:0 w:0)
@@ -203,10 +231,10 @@ impl WeightInfo for () {
// Proof Size summary in bytes:
// Measured: `116 + p * (69 ±0)`
// Estimated: `121 + p * (70 ±0)`
// Minimum execution time: 4_692_000 picoseconds.
Weight::from_parts(4_789_000, 121)
// Standard Error: 1_013
.saturating_add(Weight::from_parts(1_143_616, 0).saturating_mul(p.into()))
// Minimum execution time: 4_646_000 picoseconds.
Weight::from_parts(4_725_000, 121)
// Standard Error: 1_195
.saturating_add(Weight::from_parts(1_144_884, 0).saturating_mul(p.into()))
.saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(p.into())))
.saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(p.into())))
.saturating_add(Weight::from_parts(0, 70).saturating_mul(p.into()))