pallet-glutton: over-unity consumption (#14338)

* pallet-glutton: over-unity consumption

* Add hard limit

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

* Tests

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

* Cleanup

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

* Highlight warning

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

* Fix docs

* Review test fixes

Co-authored-by: Guillaume Yu Thiolliere <gui.thiolliere@gmail.com>

* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet-glutton

* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet-glutton

---------

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Co-authored-by: Guillaume Yu Thiolliere <gui.thiolliere@gmail.com>
Co-authored-by: command-bot <>
This commit is contained in:
Oliver Tale-Yazdi
2023-06-13 17:57:04 +02:00
committed by GitHub
parent 2c7166eb9c
commit 3b6d31f03d
8 changed files with 246 additions and 166 deletions
+91 -89
View File
@@ -18,33 +18,35 @@
//! Autogenerated weights for pallet_glutton
//!
//! 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-06-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=pallet_glutton
// --extrinsic=*
// --execution=wasm
// --wasm-execution=compiled
// --heap-pages=4096
// --output=./frame/glutton/src/weights.rs
// --json-file=/var/lib/gitlab-runner/builds/zyw4fam_/0/parity/mirrors/substrate/.git/.artifacts/bench.json
// --pallet=pallet-glutton
// --chain=dev
// --header=./HEADER-APACHE2
// --output=./frame/glutton/src/weights.rs
// --template=./.maintain/frame-weight-template.hbs
#![cfg_attr(rustfmt, rustfmt_skip)]
#![allow(unused_parens)]
#![allow(unused_imports)]
#![allow(missing_docs)]
use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
use sp_std::marker::PhantomData;
use core::marker::PhantomData;
/// Weight functions needed for pallet_glutton.
pub trait WeightInfo {
@@ -69,12 +71,12 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
/// The range of component `n` is `[0, 1000]`.
fn initialize_pallet_grow(n: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `4`
// Measured: `86`
// Estimated: `1489`
// Minimum execution time: 10_410_000 picoseconds.
Weight::from_parts(10_515_000, 1489)
// Standard Error: 1_069
.saturating_add(Weight::from_parts(1_513_013, 0).saturating_mul(n.into()))
// Minimum execution time: 11_620_000 picoseconds.
Weight::from_parts(18_662_404, 1489)
// Standard Error: 8_342
.saturating_add(Weight::from_parts(8_453_895, 0).saturating_mul(n.into()))
.saturating_add(T::DbWeight::get().reads(1_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
.saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into())))
@@ -86,12 +88,12 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
/// The range of component `n` is `[0, 1000]`.
fn initialize_pallet_shrink(n: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `65`
// Measured: `119`
// Estimated: `1489`
// Minimum execution time: 11_105_000 picoseconds.
Weight::from_parts(584_850, 1489)
// Standard Error: 1_417
.saturating_add(Weight::from_parts(1_054_988, 0).saturating_mul(n.into()))
// Minimum execution time: 11_128_000 picoseconds.
Weight::from_parts(11_404_000, 1489)
// Standard Error: 1_098
.saturating_add(Weight::from_parts(1_007_030, 0).saturating_mul(n.into()))
.saturating_add(T::DbWeight::get().reads(1_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
.saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into())))
@@ -101,83 +103,83 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 709_000 picoseconds.
Weight::from_parts(7_409_096, 0)
// Standard Error: 23
.saturating_add(Weight::from_parts(95_342, 0).saturating_mul(i.into()))
// Minimum execution time: 598_000 picoseconds.
Weight::from_parts(607_000, 0)
// Standard Error: 18
.saturating_add(Weight::from_parts(85_323, 0).saturating_mul(i.into()))
}
/// Storage: Glutton TrashData (r:5000 w:0)
/// Proof: Glutton TrashData (max_values: Some(65000), max_size: Some(1036), added: 3016, mode: MaxEncodedLen)
/// The range of component `i` is `[0, 5000]`.
fn waste_proof_size_some(i: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `119036 + i * (1022 ±0)`
// Measured: `119114 + i * (1022 ±0)`
// Estimated: `990 + i * (3016 ±0)`
// Minimum execution time: 584_000 picoseconds.
Weight::from_parts(674_000, 990)
// Standard Error: 1_802
.saturating_add(Weight::from_parts(5_360_522, 0).saturating_mul(i.into()))
// Minimum execution time: 503_000 picoseconds.
Weight::from_parts(589_000, 990)
// Standard Error: 2_971
.saturating_add(Weight::from_parts(5_347_659, 0).saturating_mul(i.into()))
.saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(i.into())))
.saturating_add(Weight::from_parts(0, 3016).saturating_mul(i.into()))
}
/// Storage: Glutton Storage (r:1 w:0)
/// Proof: Glutton Storage (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen)
/// Proof: Glutton Storage (max_values: Some(1), max_size: Some(8), added: 503, mode: MaxEncodedLen)
/// Storage: Glutton Compute (r:1 w:0)
/// Proof: Glutton Compute (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen)
/// Proof: Glutton Compute (max_values: Some(1), max_size: Some(8), added: 503, mode: MaxEncodedLen)
/// Storage: Glutton TrashData (r:1737 w:0)
/// Proof: Glutton TrashData (max_values: Some(65000), max_size: Some(1036), added: 3016, mode: MaxEncodedLen)
fn on_idle_high_proof_waste() -> Weight {
// Proof Size summary in bytes:
// Measured: `1900466`
// Measured: `1900497`
// Estimated: `5239782`
// Minimum execution time: 57_124_610_000 picoseconds.
Weight::from_parts(57_256_059_000, 5239782)
// Minimum execution time: 55_496_326_000 picoseconds.
Weight::from_parts(55_707_517_000, 5239782)
.saturating_add(T::DbWeight::get().reads(1739_u64))
}
/// Storage: Glutton Storage (r:1 w:0)
/// Proof: Glutton Storage (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen)
/// Proof: Glutton Storage (max_values: Some(1), max_size: Some(8), added: 503, mode: MaxEncodedLen)
/// Storage: Glutton Compute (r:1 w:0)
/// Proof: Glutton Compute (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen)
/// Proof: Glutton Compute (max_values: Some(1), max_size: Some(8), added: 503, mode: MaxEncodedLen)
/// Storage: Glutton TrashData (r:5 w:0)
/// Proof: Glutton TrashData (max_values: Some(65000), max_size: Some(1036), added: 3016, mode: MaxEncodedLen)
fn on_idle_low_proof_waste() -> Weight {
// Proof Size summary in bytes:
// Measured: `9516`
// Measured: `9547`
// Estimated: `16070`
// Minimum execution time: 101_500_066_000 picoseconds.
Weight::from_parts(101_621_640_000, 16070)
// Minimum execution time: 98_314_570_000 picoseconds.
Weight::from_parts(98_702_199_000, 16070)
.saturating_add(T::DbWeight::get().reads(7_u64))
}
/// Storage: Glutton Storage (r:1 w:0)
/// Proof: Glutton Storage (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen)
/// Proof: Glutton Storage (max_values: Some(1), max_size: Some(8), added: 503, mode: MaxEncodedLen)
/// Storage: Glutton Compute (r:1 w:0)
/// Proof: Glutton Compute (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen)
/// Proof: Glutton Compute (max_values: Some(1), max_size: Some(8), added: 503, mode: MaxEncodedLen)
fn empty_on_idle() -> Weight {
// Proof Size summary in bytes:
// Measured: `4`
// Estimated: `1489`
// Minimum execution time: 4_164_000 picoseconds.
Weight::from_parts(4_378_000, 1489)
// Measured: `86`
// Estimated: `1493`
// Minimum execution time: 5_853_000 picoseconds.
Weight::from_parts(6_055_000, 1493)
.saturating_add(T::DbWeight::get().reads(2_u64))
}
/// Storage: Glutton Compute (r:0 w:1)
/// Proof: Glutton Compute (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen)
/// Proof: Glutton Compute (max_values: Some(1), max_size: Some(8), added: 503, mode: MaxEncodedLen)
fn set_compute() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 8_795_000 picoseconds.
Weight::from_parts(9_076_000, 0)
// Minimum execution time: 8_741_000 picoseconds.
Weight::from_parts(8_962_000, 0)
.saturating_add(T::DbWeight::get().writes(1_u64))
}
/// Storage: Glutton Storage (r:0 w:1)
/// Proof: Glutton Storage (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen)
/// Proof: Glutton Storage (max_values: Some(1), max_size: Some(8), added: 503, mode: MaxEncodedLen)
fn set_storage() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 8_979_000 picoseconds.
Weight::from_parts(9_195_000, 0)
// Minimum execution time: 8_585_000 picoseconds.
Weight::from_parts(8_789_000, 0)
.saturating_add(T::DbWeight::get().writes(1_u64))
}
}
@@ -191,12 +193,12 @@ impl WeightInfo for () {
/// The range of component `n` is `[0, 1000]`.
fn initialize_pallet_grow(n: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `4`
// Measured: `86`
// Estimated: `1489`
// Minimum execution time: 10_410_000 picoseconds.
Weight::from_parts(10_515_000, 1489)
// Standard Error: 1_069
.saturating_add(Weight::from_parts(1_513_013, 0).saturating_mul(n.into()))
// Minimum execution time: 11_620_000 picoseconds.
Weight::from_parts(18_662_404, 1489)
// Standard Error: 8_342
.saturating_add(Weight::from_parts(8_453_895, 0).saturating_mul(n.into()))
.saturating_add(RocksDbWeight::get().reads(1_u64))
.saturating_add(RocksDbWeight::get().writes(1_u64))
.saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(n.into())))
@@ -208,12 +210,12 @@ impl WeightInfo for () {
/// The range of component `n` is `[0, 1000]`.
fn initialize_pallet_shrink(n: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `65`
// Measured: `119`
// Estimated: `1489`
// Minimum execution time: 11_105_000 picoseconds.
Weight::from_parts(584_850, 1489)
// Standard Error: 1_417
.saturating_add(Weight::from_parts(1_054_988, 0).saturating_mul(n.into()))
// Minimum execution time: 11_128_000 picoseconds.
Weight::from_parts(11_404_000, 1489)
// Standard Error: 1_098
.saturating_add(Weight::from_parts(1_007_030, 0).saturating_mul(n.into()))
.saturating_add(RocksDbWeight::get().reads(1_u64))
.saturating_add(RocksDbWeight::get().writes(1_u64))
.saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(n.into())))
@@ -223,83 +225,83 @@ impl WeightInfo for () {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 709_000 picoseconds.
Weight::from_parts(7_409_096, 0)
// Standard Error: 23
.saturating_add(Weight::from_parts(95_342, 0).saturating_mul(i.into()))
// Minimum execution time: 598_000 picoseconds.
Weight::from_parts(607_000, 0)
// Standard Error: 18
.saturating_add(Weight::from_parts(85_323, 0).saturating_mul(i.into()))
}
/// Storage: Glutton TrashData (r:5000 w:0)
/// Proof: Glutton TrashData (max_values: Some(65000), max_size: Some(1036), added: 3016, mode: MaxEncodedLen)
/// The range of component `i` is `[0, 5000]`.
fn waste_proof_size_some(i: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `119036 + i * (1022 ±0)`
// Measured: `119114 + i * (1022 ±0)`
// Estimated: `990 + i * (3016 ±0)`
// Minimum execution time: 584_000 picoseconds.
Weight::from_parts(674_000, 990)
// Standard Error: 1_802
.saturating_add(Weight::from_parts(5_360_522, 0).saturating_mul(i.into()))
// Minimum execution time: 503_000 picoseconds.
Weight::from_parts(589_000, 990)
// Standard Error: 2_971
.saturating_add(Weight::from_parts(5_347_659, 0).saturating_mul(i.into()))
.saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(i.into())))
.saturating_add(Weight::from_parts(0, 3016).saturating_mul(i.into()))
}
/// Storage: Glutton Storage (r:1 w:0)
/// Proof: Glutton Storage (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen)
/// Proof: Glutton Storage (max_values: Some(1), max_size: Some(8), added: 503, mode: MaxEncodedLen)
/// Storage: Glutton Compute (r:1 w:0)
/// Proof: Glutton Compute (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen)
/// Proof: Glutton Compute (max_values: Some(1), max_size: Some(8), added: 503, mode: MaxEncodedLen)
/// Storage: Glutton TrashData (r:1737 w:0)
/// Proof: Glutton TrashData (max_values: Some(65000), max_size: Some(1036), added: 3016, mode: MaxEncodedLen)
fn on_idle_high_proof_waste() -> Weight {
// Proof Size summary in bytes:
// Measured: `1900466`
// Measured: `1900497`
// Estimated: `5239782`
// Minimum execution time: 57_124_610_000 picoseconds.
Weight::from_parts(57_256_059_000, 5239782)
// Minimum execution time: 55_496_326_000 picoseconds.
Weight::from_parts(55_707_517_000, 5239782)
.saturating_add(RocksDbWeight::get().reads(1739_u64))
}
/// Storage: Glutton Storage (r:1 w:0)
/// Proof: Glutton Storage (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen)
/// Proof: Glutton Storage (max_values: Some(1), max_size: Some(8), added: 503, mode: MaxEncodedLen)
/// Storage: Glutton Compute (r:1 w:0)
/// Proof: Glutton Compute (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen)
/// Proof: Glutton Compute (max_values: Some(1), max_size: Some(8), added: 503, mode: MaxEncodedLen)
/// Storage: Glutton TrashData (r:5 w:0)
/// Proof: Glutton TrashData (max_values: Some(65000), max_size: Some(1036), added: 3016, mode: MaxEncodedLen)
fn on_idle_low_proof_waste() -> Weight {
// Proof Size summary in bytes:
// Measured: `9516`
// Measured: `9547`
// Estimated: `16070`
// Minimum execution time: 101_500_066_000 picoseconds.
Weight::from_parts(101_621_640_000, 16070)
// Minimum execution time: 98_314_570_000 picoseconds.
Weight::from_parts(98_702_199_000, 16070)
.saturating_add(RocksDbWeight::get().reads(7_u64))
}
/// Storage: Glutton Storage (r:1 w:0)
/// Proof: Glutton Storage (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen)
/// Proof: Glutton Storage (max_values: Some(1), max_size: Some(8), added: 503, mode: MaxEncodedLen)
/// Storage: Glutton Compute (r:1 w:0)
/// Proof: Glutton Compute (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen)
/// Proof: Glutton Compute (max_values: Some(1), max_size: Some(8), added: 503, mode: MaxEncodedLen)
fn empty_on_idle() -> Weight {
// Proof Size summary in bytes:
// Measured: `4`
// Estimated: `1489`
// Minimum execution time: 4_164_000 picoseconds.
Weight::from_parts(4_378_000, 1489)
// Measured: `86`
// Estimated: `1493`
// Minimum execution time: 5_853_000 picoseconds.
Weight::from_parts(6_055_000, 1493)
.saturating_add(RocksDbWeight::get().reads(2_u64))
}
/// Storage: Glutton Compute (r:0 w:1)
/// Proof: Glutton Compute (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen)
/// Proof: Glutton Compute (max_values: Some(1), max_size: Some(8), added: 503, mode: MaxEncodedLen)
fn set_compute() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 8_795_000 picoseconds.
Weight::from_parts(9_076_000, 0)
// Minimum execution time: 8_741_000 picoseconds.
Weight::from_parts(8_962_000, 0)
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
/// Storage: Glutton Storage (r:0 w:1)
/// Proof: Glutton Storage (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen)
/// Proof: Glutton Storage (max_values: Some(1), max_size: Some(8), added: 503, mode: MaxEncodedLen)
fn set_storage() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 8_979_000 picoseconds.
Weight::from_parts(9_195_000, 0)
// Minimum execution time: 8_585_000 picoseconds.
Weight::from_parts(8_789_000, 0)
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
}